i'm trying to login to a website with the requests library and use the session from the login afterwards for selenium because there are some elements are loaded dynamically. I dont know how i get hand over the request-session to selenium. Or is there a way to get the dynamic content without selenium?
I tried to save the cookies from teh request-session in a .pkl file and load them again with selenium, but that doesn't work because the : "Object of type 'Cookie' ist not JSON serializable" This entry doesnt help me out: https://stackoverflow.com/questions/37499452/python-requests-cookies-export-session-to-selenium
s = requests.session()
r = s.post(urlForSignin, data=payload)
with open(file,'wb') as f:
pickle.dump(s.cookies, f)
driver = webdriver.Firefox()
driver.delete_all_cookies()
cookies = pickle.load(open(file", "rb"))
for cookie in cookies:
driver.add_cookie(cookie)
driver.get(urlForSignin)
I expect that i can work in the request-session from the login in selenium. Am i wrong?