Google Login Issue in Selenium (.NET / C# / MSTest)

3 weeks ago 21
ARTICLE AD BOX

I’m currently working with Selenium WebDriver using .NET (C#) and MSTest for automated UI testing.

Until recently, I was able to access our service (which requires Google authentication) without any issues.

If I had previously logged into the service manually using Google Chrome on my machine, then when I ran my Selenium tests, the application would open directly without prompting for Google login again.

Later, this behavior became inconsistent. To fix it, I configured Selenium to launch Chrome using a specific Chrome user profile so that the session would already be authenticated and Google login would not be required during test execution.

Here is a simplified version of the setup code:

[TestInitialize] public void Startup() { var options = new ChromeOptions(); options.AddArgument(@"user-data-dir=C:\Path\To\Chrome\User Data"); options.AddArgument("profile-directory=ProfileName"); _driver = new ChromeDriver(options); }

Current Problem

Recently, this approach stopped working completely.

Even when:

Using the correct Chrome user profile

Ensuring the profile is already logged into Google

Trying alternative configurations

Google no longer allows the login session to be reused, and access to the admin panel is blocked. The automated browser is forced to go through Google login again — and in some cases, Google may even block the automation attempt.

Question

What is the recommended way to handle Google authentication in Selenium-based automation now?

Specifically:

Is there a reliable way to reuse authenticated sessions?

Has Google changed its security policies regarding automated browsers?

Should we switch to a token-based authentication mechanism instead of relying on browser profiles?

Is there a better architectural approach for handling Google SSO in automated UI tests?

Any guidance on how to properly solve Google login restrictions in modern Selenium setups would be greatly appreciated.

Read Entire Article