Last Updated: July 25, 2019
·
10.13K
· lazybios

selenium and cookies

from selenium import webdriver
browser = webdriver.Chrome()
browser.get('http://dev.e.qq.com/dev/#finance?mbid=l877677309')
import pickle
import selenium.webdriver 

driver = selenium.webdriver.Firefox()
driver.get("http://www.google.com")
pickle.dump( driver.get_cookies() , open("cookies.pkl","wb"))
import pickle
import selenium.webdriver 

driver = selenium.webdriver.Firefox()
driver.get("http://www.google.com")
cookies = pickle.load(open("cookies.pkl", "rb"))
for cookie in cookies:
    driver.add_cookie(cookie)