I have a cookie puppet that I create with the following command
def doLogin(driver):
pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb"))
I have sample code for receiving cookies
driver = webdriver.PhantomJS()
self.doLogin(driver)
driver.delete_all_cookies()
for cookie in pickle.load(open("cookies.pkl", "rb")):
driver.add_cookie(cookie)
I see that it creates a cookie well, because if I am print, it’s great that add_cookie () does shadow things
This gives the following exception
WebDriverException: : { "errorMessage": " Cookie", "": { "": { "Accept": "/JSON", "Accept-Encoding": "", "": "", "Content-Length": "219", "Content-Type": "/JSON; = UTF-8", "": "127.0.0.1:50738", "User-Agent": "Python-urllib/2.7" }, "httpVersion": "1.1", "": "POST", "": "{\" SESSIONID\ ": \" 391db430-154a-11e6-8a0a-ef59204729f5 \ ",\" cookie \ ": {\" domain \ ": \" secretWebsite \ ",\" name \ ":\" JSESSIONID \ ",\" value \ ": \" 8332B6099FA3BBBC82893D4C7E6E918B \ ",\" \ ":\" \ ", \" httponly \ ": false,\" secure \ ": }}" "URL": "/", "urlParsed": { "": "", "": "," ":" "," ":" / "," ":" / "" ": "/", "": "," ": "," ": "," ": "," USERINFO ":" "" ": "," ": "," ": "/", "queryKey ": {}," ": [" "]}," urlOriginal ":" //391db430-154a-11e6-8a0a-ef59204729f5/ "}} :
, webdriver Firefox
PhantomJS?