I'm using a function that creates new instances of WebDriver, so that I can switch user agent strings for each instance. I'm wondering whether or not there is a way to maintain the browser session from instance to instance, so that I do not have to log back in to the website every single time a new WebDriver instance is created?
Asked
Active
Viewed 50 times
0
-
Take a look at [this](https://stackoverflow.com/questions/34179420/can-i-run-selenium-chromedriver-with-cookies-from-actual-chrome-installation) question - using the same profile for each instances should solve your problem. – skandigraun Sep 22 '18 at 06:30
-
@skandigraun but then can i also switch the user agent string for each instance...? – oldboy Sep 22 '18 at 15:44
-
@skandigraun yeah, using a profile doesnt work. i was already using a profile, although before i was creating a new profile every time id create a new instance. however, i just tried creating a global profile, which also doesnt work... – oldboy Sep 22 '18 at 16:01
-
Have you investigated creating a cookie that looks like you've logged in already? This may or may not be possible, depending on the site. – JeffC Sep 22 '18 at 16:56
-
@JeffC i have not, but this def seems like the only possible option thus far – oldboy Sep 22 '18 at 17:22