2

Hi guys i was trying to get cookies in selenium . I used

driver.get_cookies()
cookies_list = driver.get_cookies()
cookies_dict = {} # create dictionary
for cookie in cookies_list:
    cookies_dict[cookie['name']] = cookie['value'] # populate it

print(cookies_dict)

but the only result i get is {} , how i can manage to do that ?

Marià
  • 255
  • 2
  • 12
  • i'm running chrome webdriver – Marià Sep 16 '18 at 16:55
  • https://stackoverflow.com/questions/15058462/how-to-save-and-load-cookies-using-python-selenium-webdriver – thebadguy Sep 17 '18 at 04:33
  • @thebadguy 'driver.get("https://www.google.com/recaptcha/api2/demo") pickle.dump( driver.get_cookies() , open("cookies.pkl","wb")) time.sleep(60) cookies = pickle.load(open("cookies.pkl", "rb")) for cookie in cookies: driver.add_cookie(cookie) driver.get("https://www.google.com/recaptcha/api2/demo")' i have tried to do that to save captcha coockies but seems not to work , why if i reload the page i have to redo the captcha ? – Marià Sep 17 '18 at 08:24

0 Answers0