VineGlobal / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
1 stars 0 forks source link

Selenium user session cookies #131

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system : windows server
What is your issue ?  I have been using selenium from excel macros for awhile 
to automate logging into some portals and downloading reports.  The main portal 
I use leverages Yahoo and google credentials to authenticate.  I had noted that 
the session that selenium for vba opens a different kind of chrome session than 
if I launch chrome myself - the key difference being that it had its own 
history/cookies and thus I needed to code a login process to trigger each time. 
 NOW, I have been forced to change my gmail and yahoo to have 2step 
authentication and thus I cannot code the logins.  I am trying to find other 
solutions, but I thought I would ask if there is another way to initiate the 
selenium chrome session where it could keep cookies between sessions.  Thanks.

Original issue reported on code.google.com by m...@choozeshoes.com on 19 Jan 2015 at 5:48

GoogleCodeExporter commented 9 years ago
You can keep the session by using a Firefox profile:
 Dim wd As New SeleniumWrapper.WebDriver
 wd.setProfile "MyProfile" 'Profile name
 wd.start "firefox", "https://mail.google.com/mail/"
 wd.open "/"
 ...

Or a Chrome profile:
 Dim wd As New SeleniumWrapper.WebDriver
 wd.setProfile "C:\MyProfile"  'Full path of the folder containing the profile
 wd.start "chrome", "https://mail.google.com/mail/"
 wd.open "/"
 ...

In both cases, the profile is automatically created if it is not already 
present.
For Firefox, you can manage profiles with this command line: firefox -p

Original comment by florentbr on 19 Jan 2015 at 9:39