Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm using Selenium python binding to setup an automation test for our web application. I'm facing a problem while testing the web on beta server because it requires HTTP authentication for an intranet username and password.

from selenium import webdriver

driver = webdriver.Firefox()
driver.get("https://somewebsite.com/")

I need to submit a username and a password for the popup dialog upon accessing http://somewebsite.com/

Is there a neat way to do this?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I have found a solution to this question:

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.set_preference('network.http.phishy-userpass-length', 255)
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("https://username:[email protected]/")

The FirefoxProfile part is to dismiss the confirmation dialog because by default Firefox will show a popup dialog to prevent pishing.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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