I'm writing automated tests for a website that uses pop-up authentication. I am able to provide the credentials by using the username:password@https://site.address.com
formula, but in that case the Chrome window's title bar simply shows data;:
and a blank page. After this, my tests will fail as the page is not really loaded and the elements can't be clicked.
If I don't provide credentials, then the title bar will show my URL, but I can't enter the credentials to enter the page, as the pop-up window has no elements I can refer to.
EDIT: when I try to send in the authentication data using driver.switchTo().alert()
then the execution basically stops and I have to press cancel.
controller.getNavigator().goToPage(loginSiteAddress);
System.out.println(userName);
System.out.println(password);
controller.getNavigator().authenticate(userName, password);
public void authenticate(String userName, String password) {
driver.switchTo().alert().sendKeys(userName + Keys.TAB + password);
driver.switchTo().alert().accept();
}
How can I make the 1st solution work?