How to handle authentication popup with Selenium WebDriver using Java
The Alert Method, authenticateUsing()
lets you skip the Http Basic Authentication box.
WebDriverWait wait = new WebDriverWait(driver, 10); Alert alert = wait.until(ExpectedConditions.alertIsPresent()); alert.authenticateUsing(new UserAndPassword(username, password));
As of Selenium 3.4 it is still in beta
Right now implementation is only done for
InternetExplorerDriver
Don't use firefox profile and try below code:
driver.get("http://UserName:Password@Example.com");
If you're implementing it in IE browser, there are certain things which you need to do.
In case your authentication server requires username with domain like "domainuser" you need to add double slash /
to the url:
//localdomain\user:password@example.com
Try following solution and let me know in case of any issues:
driver.get('https://example.com/')driver.switchTo().alert().sendKeys("username" + Keys.TAB + "password");driver.switchTo().alert().accept();
This is working fine for me