1# read cookies
2
3import pickle
4import selenium.webdriver
5
6driver = selenium.webdriver.Firefox()
7driver.get("http://www.google.com")
8cookies = pickle.load(open("cookies.pkl", "rb"))
9for cookie in cookies:
10 driver.add_cookie(cookie)
1# save cookies
2
3import pickle
4import selenium.webdriver
5
6driver = selenium.webdriver.Firefox()
7driver.get("http://www.google.com")
8pickle.dump( driver.get_cookies() , open("cookies.pkl","wb"))