I am trying to login to a website with selenium, then transfer the cookie to mechanize. I have successfully logged in with selenium and saved its session cookie to a variable. The problem comes when trying to load the cookie with cookielib.
Relevant coding:
.
. #loging in to website with selenium
.
cookie = browser.get_cookies() #save the session cookie from selenium to variable "cookie"
.
. #starting up mechanize
.
cj = cookielib.LWPCookieJar()
.
.
.
cj.set_cookie(cookie) #load cookie from selenium
the problem appear when setting the cookie with cj.set_cookie function, and I get the following error message
File "..../cookielib.py", line 1627, in set_cookie
if cookie.domain not in c: c[cookie.domain] = {}
AttributeError: 'list' object has no attribute 'domain'