7

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:password@url.com")

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

Moshe Slavin
  • 5,127
  • 5
  • 23
  • 38
coder123
  • 213
  • 2
  • 7

3 Answers3

5

You might be facing issue for domain login as browser converts domain separator \ to / and credentials become invalid. Use encoded separator %5C and it will work.

Browser will convert https://domain\username:password@URL to https://domain/username:password@URL.

User encoded separator for request.
https://domain\username:password@URL => https://domain%5Cusername:password@URL

kushwahav
  • 126
  • 3
3

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:password@auth.server.com")

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:password@url.com:8080/auth/login")

Hope this helps you!

Moshe Slavin
  • 5,127
  • 5
  • 23
  • 38
0

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

Tamás Kovács
  • 263
  • 5
  • 7