python-requests cookies export session to selenium -


i want export cookies session python-requests selenium, im write code :

import requests selenium import webdriver  session=requests.session()  myheaderss = {"user-agent":"mozilla/5.0 (windows nt 10.0) applewebkit/537.32 (khtml, gecko) chrome/48.0.2564.109 safari/537.32", "x-gwt-permutation" : "6fefbe57c6e73f0ab33bd5a4e17945de", "content-type":"text/x-gwt-rpc; charset=utf-8"}  login_data = '''7|0|7|https://www.cartetitolari.mps.it/portaletitolari/|feac78ffdf81d6121438d70986af1c41|portale.titolari.client.service.ptservice|login|portale.titolari.client.common.login.loginrequest/3583069702|xxxxxxxxxxx|matteosbragia1984|1|2|3|4|1|5|5|0|0|6|7|'''   ra0=session.post('https://www.cartetitolari.mps.it/portaletitolari/service', data=login_data, headers=myheaderss) print ra0.content  profile = webdriver.firefoxprofile() profile.set_preference("general.useragent.override", "mozilla/5.0 (windows nt 10.0) applewebkit/537.32 (khtml, gecko) chrome/48.0.2564.109 safari/537.32")  driver = webdriver.firefox()  c in session.cookies :     driver.add_cookie({'name': c.name, 'value': c.value, 'path': c.path, 'expiry': c.expires})   print "dasdasds" driver.get("https://www.cartetitolari.mps.it/portaletitolari/titolari.html#h6vwdv5ce0") print "dasdasds2" driver.get("https://www.cartetitolari.mps.it/portaletitolari/downloadeco?id=0") 

the code work, not export session/cookies in selenium, when page loads required login! i'm wrong ?

cookies not floating around in browser preferences. tied specific domain or wildcard domain, have domain.

have @ selenium-requests package seems ease creation of cookies.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -