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

Hello,
I tried the following code but I’m not sure about the correct order of the coe lines.
Is it correct this way:


FirefoxProfile profile = new FirefoxProfile();

WebDriver driver = new FirefoxDriver(profile);
WebDriverWait wait = new WebDriverWait(driver, 10);

Alert alert = wait.until(ExpectedConditions.alertIsPresent());

alert.authenticateUsing(new UserAndPassword("username", "password"));
driver.get("http://demo.tanmaysarkar.com/authentication/");

Thanks
John

Default Answered on February 26, 2015.
Add Comment

Your Answer

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