I use selenium simulation log in a website,and I want to use urllib with the cookie that it is get from selenium driver.But there is crash with this log.
AttributeError: 'SimpleCookie' object has no attribute 'domain'
My code is these please help me how to fix it.
cj = http.cookiejar.CookieJar()
cookie_support = urllib.request.HTTPCookieProcessor(cj)
opener = urllib.request.build_opener(
cookie_support)
all_cookies = driver.get_cookies()
cookies = {}
for s_cookie in all_cookies:
cookies[s_cookie["name"]] = s_cookie["value"]
cookie = http.cookies.SimpleCookie()
cookie.load(cookies)
cj.set_cookie(cookie)
result = opener.open(url)
The error says it right.