2

I want to access with Selenium (through) Python, a URL that demands authentication.

When visit the URL, manually a new authentication window pops up, on which I need to fill in a username and password. Only after clicking on “OK” this window disappears and I return to the original site.

As I want to visit this URL on an interval base to download information and want to automatize this process in python.

In my current effort I use Selenium, but none of the examples that I found seem to do what I need. Thinks I tried but do not work are:

  • driver.get("https://username:[email protected]/")
  • selenium.FireEvent("OK", "click")
  • driver.find_element_by_id("UserName")

I do not know the actual element id’s

What I did manage is to load my Firefox profile that stores the authentication information, but I still need to confirm the authentication by clicking “ok”.

Is there any way to prevent this screen to pop up?

If not how to access this button on the authentication form, from which I cannot obtain id-information?

1 Answer 1

1

Using driver.get("https://username:[email protected]/") should directly log you in, without the popup being displayed,

What about this did not work for you?

EDIT


I am not sure this will work but after driver.get("https://username:[email protected]/")

Try accepting alert.

For the alert - @driver.switch_to.alert.accept in Ruby or driver.switchTo().alert().accept(); in Java

Sign up to request clarification or add additional context in comments.

5 Comments

Thats indeed what I figured out from all the examples I found, but this does not work for me. I still get the authentication popup, with the pasword and username already filled in; however, I still need to click the button 'OK' to actually continue.
Ps. I made a error in my origanal text. It should not be driver.get("username:[email protected]/") but instead: driver.get("username:[email protected]/"). I do not know how much this matters.
Warning - the address MUST be written as whole. So if the authentification lies on example.com/somewebsite.shtml, the way how to get there using Selenium is driver.get("https://username:[email protected]/somewebsite.shtml/")
I have the exact same issue and it beats me. I can't get passed the auth although it's passed in the URL.
Doesn't look like the auth dialog is seen as an alert by the ChromeDriver. So you can't accept it

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.