Using C#, Chrome, Selenium grid and parallel tests, I have been unable to find any solution to bypass browser authentication pop up.
I don't see this question as duplicate because all answers are extremely outdated or one of below hacks:
username:[email protected] 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);
alert.Accept();
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();
alert.Dismiss();
Same error.
Is there any proper way to handle this?
-
1This might give you a clue stackoverflow.com/questions/17701420/…Alexey R.– Alexey R.2018年04月12日 15:37:06 +00:00Commented Apr 12, 2018 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– kirbycope2018年04月12日 16:23:44 +00:00Commented Apr 12, 2018 at 16:23
-
Looking for the similar fix. Any luck?Guest– Guest2018年09月07日 09:15:13 +00:00Commented Sep 7, 2018 at 9:15
1 Answer 1
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:
- 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.
- Use a Proxy Service that can pass the HTTP/HTTPs auth in it's requests. I've seen BrowserMob mentioned a few times.
- 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.