How to handle the login pop up window using Selenium Webdriver? I have attached the sample screen here. How can I enter/input Username and Password to this login pop up/alert window?
Thanks & Regards,
Use the approach where you send username and password in URL Request:
http://username:[email protected]
So just to make it more clear. The username is username
password is password
and the rest is usual URL of your test web
Works for me without needing any tweaks.
Sample Java code:
public static final String TEST_ENVIRONMENT = "the-site.com";
private WebDriver driver;
public void login(String uname, String pwd){
String URL = "http://" + uname + ":" + pwd + "@" + TEST_ENVIRONMENT;
driver.get(URL);
}
@Test
public void testLogin(){
driver = new FirefoxDriver();
login("Pavel", "UltraSecretPassword");
//Assert...
}