'How to By Pass NTLM authentication pop up while performing automation testing using Selenium web driver for Chrome browser?

I used the following python code to bypass the NTLM popup.

chromedriver = webdriver.Chrome(executable_path=chromedriver_path, chrome_options=options)
chromedriver.get("https://username:[email protected]")

The popup couldn't bypass and still exists and test breaks.



Solution 1:[1]

As @BhuvaneshMani has mentioned in the comment's on this answer...

You need to observe how the NTLM is getting authenticated. (use the devTools in chrome under Network)

After you find the authentication call use that URL!

As @BhuvaneshMani's example:

For e.g., app url may be app.url however after hitting the url, it redirects to auth.server.url. So if you append username and password into app.url it wont work. It should be appended to auth.server.url.

So your code should look something like this:

driver = webdriver.Chrome(executable_path=chromedriver_path, chrome_options=options)
driver.get("https://username:[email protected]")

Or (I found that most authentication calls are to the same URL just to the server port: port:8080/auth/login)

driver.get("https://username:[email protected]:8080/auth/login")

Hope this helps you!

Solution 2:[2]

You could also enable Chrome to authenticate with NTLM as the current user with similar .reg file to the following:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome]
"AuthNegotiateDelegateWhitelist"="*.companydomain.org,*.companydomain.coop"
"AuthSchemes"="basic,digest,ntlm,negotiate"
"AuthServerWhitelist"="*.companydomain.org,*.companydomain.coop"

https://dev.to/seankilleen/quick-tip-ntlm-windows-pass-through-authentication-with-selenium-and-chromedriver-34m6

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Moshe Slavin
Solution 2 Tamás Kovács