Answer the question
In order to leave comments, you need to log in
Python Selenium is it possible to work with one profile?
Hello, can you please tell me if it is possible to use one profile for webDriver selenium?.
The story is this: I am authorized on the site and use selenium to automate actions, but every time I start webdriver, the site recognizes me as an unconfirmed account user (that is, as if I didn’t log in, but maybe I was hacked, a new device, etc.). If you confirm in the account that it's me, then it works until the webDriver is restarted.
Answer the question
In order to leave comments, you need to log in
We save the session.
import pickle
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://www.quora.com')
# login code
pickle.dump(driver.get_cookies() , open("QuoraCookies.pkl","wb"))
import pickle
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://www.quora.com')
for cookie in pickle.load(open("QuoraCookies.pkl", "rb")):
driver.add_cookie(cookie)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question