How can I fill Username and Password fields in alert? When I click a link, another window opens with alert authentication. I'm not able to switch to the alert. I get Timeout Exceptions. I used this code:
// two windows on browser
Set<String> window = driver.getwindowhandles();
Iterator index = window.ierator();
String Parentwindow = index.next();
String Childwindow = index.next();
driver.switchto().window(Childwindow);
// popup on child window
Alert alert = driver.switchto().alert();
alert.sendkeys("username");
alert.sendkeys("password");