Using C#, Chrome, Selenium grid and parallel tests, I have been unable to find any solution to bypass browser authentication pop up.

enter image description here

I don't see this question as duplicate because all answers are extremely outdated or one of below hacks:

username:pass@example.com works, kind of, but our site acts odd with this kind of bypassing auth

AutoIt scripts or windows automation do not work because there is no way to use it on remote test execution machine with selenium grid

Browser extensions do not work because Chrome acts weird and there is no way to call parallel browsers unless they are 'clean' browsers. As far as I know that is.

  IAlert alert = d.SwitchTo().Alert();

  Alert.SetAuthenticationCredentials(name, pass);


Does not do anything: wd/hub/session/0921b245-39cd-4a1d-99f7-76a5c1964550/alert_text Timed Out error. System.Net.WebException : The operation has timed out

IAlert alert = d.SwitchTo().Alert();


Same error.

Is there any proper way to handle this?

  • 1
    This might give you a clue stackoverflow.com/questions/17701420/… – Alexey R. Apr 12 '18 at 15:37
  • Are you using Windows Active Directory? If so, there is an internet setting to auto-respond to those pop-ups if you add the site to the Safe Zone. – kirbycope Apr 12 '18 at 16:23
  • Looking for the similar fix. Any luck? – Guest Sep 7 '18 at 9:15

It's a known thing that Selenium intentionally does not handle browser authentication. It is considered "out of scope" for the WebDriver protocol. If you look at GitHub Issues for the project you'll find numerous bug reports on the subject.

I've found / tried a few methods:

  1. My current work around is to whitelist IPs on the server I'm trying to hit so my UI tests don't have to deal with bypassing any authentication. Free access.
  2. Use a Proxy Service that can pass the HTTP/HTTPs auth in it's requests. I've seen BrowserMob mentioned a few times.
  3. Use an HTTP library as part of your test framework that can make the auth call prior to starting any tests but store and pass along the session so you stay authenticated

It's worth noting that passing the basic auth as a parameter in the URL isn't supported by most browsers and I've never consistently gotten it working.

| improve this answer | |

Your Answer

