I\'m trying to add cookies to a browser, but getting the following error:
Message: invalid argument: invalid \'expiry\' (Session info: chrome=75.0.3770.90)
T
In my case, the previous answer did not work. I had to remove the expire key from the object.
for cookie in pickle.load(open(PATH, "rb")):
if 'expiry' in cookie:
del cookie['expiry']
self.driver.add_cookie(cookie)
This happens if you previously pickled the cookies directly as they're returned from the driver, like so:
pickle.dump(browser.get_cookies(), open(PATH, "wb"))