Selenium Google Login Block

I had the same problem and found the solution for it. I am using

1) Windows 10 Pro

2) Chrome Version 83.0.4103.97 (Official Build) (64-bit)

3) selenium ChromeDriver 83.0.4103.39

Some simple C# code which open google pages

var options = new ChromeOptions();
options.addArguments(@"user-data-dir=c:\Users\{username}\AppData\Local\Google\Chrome\User Data\");
IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver();
driver = new ChromeDriver(Directory.GetCurrentDirectory(), options);
driver.Url = "https://accounts.google.com/";
Console.ReadKey();

The core problem here you cant login when you use selenium driver, but you can use the profile which already logged to the google accounts.

You have to find where your Chrome store profile is and append it with "user-data-dir" option.

PS. Replace {username} with your real account name.

On linux the user profile is in "~/.config/google-chrome".

Leave a Comment