RE: Handle HTTP Authentication – Authentication required dialog

I’m using Selenium with the Firefox Webdriver to test different events on my Website.

One event leads to a HTTP authentication dialog.
Is there a way to set selenium to always press cancel or to reach a timeout so I don’t hang around and get back the control of the driver?

johnsmithv2 Default Asked on February 25, 2015 in Selenium WebDriver.
Add Comment
4 Answers
FirefoxProfile profile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(profile);
WebDriverWait wait = new WebDriverWait(driver, 10);
 driver.get("http://demo.tanmaysarkar.com/authentication/");  //First reach to the page.

Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword("username", "password"));
Professor Answered on February 26, 2015.
Add Comment

Your Answer

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