R
R
RD1706D2022-04-09 03:23:03
Python
RD1706D, 2022-04-09 03:23:03

Why is Cookie from Telegram not saved?

Hello! I need to automate the login to Telegram using Selenium, but when I try to save Cookies through the pickle library, I get nothing (and this code works fine with VK), what could be the problem? The code:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import pickle
from threading import Thread
import keyboard
import os

options = Options()


driver = webdriver.Firefox(
    executable_path="C:\\Users\\я\\Desktop\\Bot\\geckodriver.exe",
    options=options
)


driver.get("https://web.telegram.org/k/")

def checker():
    while True:
        if keyboard.is_pressed("f1"):
            pickle.dump(driver.get_cookies(), open(f"after.pkl", "wb"))

A = Thread(target=checker)
A.start()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2022-04-09
@RD1706D

Because there are no cookies on this site
6251502777284770475569.jpeg
The session is in localstorage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question