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
This is caused by an active bug in chromedriver: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3331
The bug is that chromedriver returns expiry cookies with get_cookies as a double, but does not accept a double for it with add_cookie. Here's the fix:
for cookie in pickle.load(open('cookies.pkl', 'rb')):
expiry = cookie.get('expiry', None)
if expiry:
cookie['expiry'] = int(expiry * 1000)
browser.add_cookie(cookie)