tryolabs/requestium

error with transfer_session_cookies_to_driver()

Abd0s opened this issue · 4 comments

Abd0s commented

When I try to use transfer_session_cookies_to_driver() to transfer my session to a driver I get the following error. Seems like this is a bug with the lib?

  File "src\gevent\greenlet.py", line 716, in gevent._greenlet.Greenlet.run
  File "C:\Users\Abdos\AppData\Local\Programs\Python\Python36\lib\site-packages\eel\__init__.py", line 191, in _process_message
    return_val = _exposed_functions[message['name']](*message['args'])
  File "C:\Users\Abdos\Documents\GitHub\Bol.com-AIbot\src\main.py", line 113, in bot_start
    s.transfer_session_cookies_to_driver()
  File "C:\Users\Abdos\AppData\Local\Programs\Python\Python36\lib\site-packages\requestium\requestium.py", line 114, in transfer_session_cookies_to_driver
    'expiry': c.expires, 'domain': c.domain})
  File "C:\Users\Abdos\AppData\Local\Programs\Python\Python36\lib\site-packages\requestium\requestium.py", line 235, in ensure_add_cookie
    self.add_cookie(cookie)
  File "C:\Users\Abdos\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 894, in add_cookie
    self.execute(Command.ADD_COOKIE, {'cookie': cookie_dict})
  File "C:\Users\Abdos\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Abdos\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid 'expiry'

I got the same issue.

This fix solves the issue for now, not really sure about the implications though, but i use it.

jimmy927@596db69

As described in detail here, the cookie specs say values should not be null, and chromedriver 2.46 started enforcing that. To resolve, we remove any properties of the cookie with a value of None before invoking the webdriver.

Resolved by PR #42.

I actually encountered this error and fixed it by simply changing 'expiry' to 'expires' ...

I actually encountered this error and fixed it by simply changing 'expiry' to 'expires' ...

Is the 'expiry/expires' value correctly set in cookie? I change 'expiry' to 'expires' can bypass the error, but value is not set correctly. (using chrome driver 78.0.3904.108)