3

I have tried https://{USERNAME}:{PASSWORD}@xyz.com pattern to authenticate URL but it doesn't work for me.

Can someone suggest me the best way to handle chrome HTTP authentication popup?

1

2 Answers 2

2

Authentication via the URL has been deprecated for a while:

While this may sound like a thunder from clear skies for Chrome users, it is not. The deprecation “order” comes from RFC 3986: ...

3.2.1. User Information ... Use of the format "user:password" in the userinfo field is deprecated.

Source: Passing basic auth credentials in Google Chrome shows the pop again

There is an issue on GitHub to get this into WebDriver W3Cspecs: Missing support for HTTP authentication prompts #385.

You could try to use the argument --disable-blink-features="BlockCredentialedSubresources" to re-enable basic auth via the URL as described in this answer: Passing basic auth credentials in Google Chrome shows the pop again.

2

Despite you have chosen Niels answer as correct, I would also suggest a way to work around your issue.

What you're talking about is likely a "basic authentication". The best way to bypass this step is to add Authorization header to HTTP requests which are sent by your browser. To do that you need to set up some proxy which would add mentioned header with the value Basic userNameEncoded:passEncoded where userNameEncoded:passEncoded is the pair of your credentials encoded in Base64.

You can use some lightweight proxy like browsermob-proxy. Here you can find some examples of how to configure it for Java case. As far as I know the proxy has wrappers for Python and probably some other languages.

UPD: Here is the solution for Python Selenium case

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.