VBA Excel Chrome Selenium - Save Cookies

tiago_rbs

New Member
Joined
Feb 12, 2022
Messages
5
Office Version
  1. 2010
Platform
  1. Windows
Hello!

I'm looking a way for the selenium webdriver use my profile and set my cookies. I use the spreadsheet for open a website for get some datas and I can't login everytime. Everytime that the chrome opens by selenium webdriver it create a new temporary profile, but I can't login everytime. I need when it opens a browser, it set my cookies and my login.

Could anybody help me with this?
 
Last edited by a moderator:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
EDIT:

I've already tried:

VBA Code:
driver.SetProfile "C:\Users\User\AppData\Local\Google\Chrome\User Data\Default", True

driver.AddArgument ("C:\Users\User\AppData\Local\Google\Chrome\User Data\Default")

driver.AddArgument ("--no-sandbox")

The path is ok, it opens with the correct path that i passed, but it's continue don't kept me logged. Every link it opens i have to loggin again. I've read a lot of foruns, i can't solve this.

Could someone help me, please?
 
Upvote 0
Problem solved, i'll not delete if someone has the same problem maybe it can help, when you look the path is:


C:\Users\User\AppData\Local\Google\Chrome\User Data\Default

But you must write only until "User Data", "Default" is automatically added in the end, otherwise the path will be 2 folders "Default" at the end.

I only changed it and wrote:

driver.SetProfile "C:\Users\User\AppData\Local\Google\Chrome\User Data", True

Now it's perfect.
 
Upvote 0
Have you been able to log in to your account in Chrome?
I have a similar problem and have applied your line "driver.SetProfile "C:\Users\User\AppData\Local\Google\Chrome\User Data", True"
After this, Chrome asks me to choose the profile (there are several on my PC), and after that nothing happens if a browser window with that profile was already open, or it reopens the same window if I close it before running the script. In any case, I have no way to open any website via selenium VBA under this profile. If I omit this line, I can open a new browser instance without a profile that I can control with Selenium, but I cannot log in to my profile as Google rejects log-in from a browser that is controlled by automation software like Selenium.
 
Upvote 0

Forum statistics

Threads
1,216,737
Messages
6,132,436
Members
449,728
Latest member
teodora bocarski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top