title: How do I load session and cookies from requests library to Selenium browser in Python?
body: <p>i have this code to save cookies from requests</p>
  <pre><code>pickle.dump(session.cookies.get_dict(), open(&quot;cookies.pkl&quot;, &quot;wb&quot;))
  </code></pre>
  <p>i wanna to use it in selenium browser so i used this code but it doesn't work</p>
  <pre><code>cookies = pickle.load(open(&quot;cookies.pkl&quot;, &quot;rb&quot;))
  for cookie in cookies:
      driver.add_cookie(cookie)
  </code></pre>
  <p>i get this error message</p>
  <pre><code>driver.add_cookie(cookie)
    File &quot;C:\Users\Allah\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py&quot;, line 894, in add_cookie
      self.execute(Command.ADD_COOKIE, {'cookie': cookie_dict})
    File &quot;C:\Users\Allah\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py&quot;, line 321, in execute
      self.error_handler.check_response(response)
    File &quot;C:\Users\Allah\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py&quot;, line 242, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.InvalidArgumentException: Message: invalid type: string &quot;wa-xd-sessionid&quot;, expected struct AddCookieParameters at line 1 column 28
  </code></pre>