Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to load cookies with Pickle
#1
Full Code:
>>> while True:
	from selenium import webdriver
	driver = webdriver.Chrome()
	import pickle
	cookies = pickle.load(open("cookies.pkl", "rb"))
	while True:
		for cookie in cookies:
			driver.add_cookie(cookie)
		break
	break

Traceback (most recent call last):
  File "<pyshell#1>", line 8, in <module>
    driver.add_cookie(cookie)
  File "C:\Users\Arbi717\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 772, in add_cookie
    self.execute(Command.ADD_COOKIE, {'cookie': cookie_dict})
  File "C:\Users\Arbi717\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 308, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Arbi717\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unable to set cookie
  (Session info: chrome=63.0.3239.84)
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.16299 x86_64)

>>>
I have previously saved cookies with:
>>> pickle.dump( driver.get_cookies() , open("cookies.pkl","wb"))
It worked once, however now it is not working. I tried deleting the cookies.pkl file and recreating it again, but to no avail. Any help is appreciated.
Reply


Messages In This Thread
Unable to load cookies with Pickle - by HiImNew - Jan-04-2018, 01:30 AM
RE: Unable to load cookies with Pickle - by HiImNew - Jan-04-2018, 02:44 AM
RE: Unable to load cookies with Pickle - by HiImNew - Jan-04-2018, 03:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Saving/editing cookies? rhubarbpieguy 0 909 Dec-10-2022, 01:58 PM
Last Post: rhubarbpieguy
  Python cookies vj78 2 3,103 Apr-07-2021, 09:38 AM
Last Post: Naheed
  Catch all cookies from any website Chuky 8 10,416 Aug-20-2019, 04:24 PM
Last Post: snippsat
  python scraping all cookies halberdd 1 4,839 Feb-26-2019, 12:10 PM
Last Post: halberdd
  Flask: Cookies for Saving User Input ? jomonetta 2 3,512 Nov-03-2018, 10:47 AM
Last Post: j.crater
  Inserting multiple cookies using python requests freshtomatoes 0 5,320 Aug-16-2018, 09:25 PM
Last Post: freshtomatoes
  unable to load file using python selenium purnima1 4 6,511 Dec-12-2017, 04:04 PM
Last Post: hshivaraj
  Missing cookies in session with requests sechot 0 6,281 Oct-22-2017, 12:09 PM
Last Post: sechot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020