Hey Pragati, authentication popups can be handled in 3 different ways:
- By passing user credentials in URL: Append your username and password with the URL. Syntax is: http://Username:Password@SiteURL; For eg:
-
By using AutoIT: Use AutoIT script to send username and password. For eg:
-
public static void login(String email, String password) throws Exception{
driver.get(URL);
WinWaitActivate("Authentication Required","")
Send("abha_r{TAB}myPassword{ENTER}")
Runtime.getRuntime().exec("C:\\Download\\AutoItFiles\\ExecutableFiles\\FirefoxBrowser.exe");
driver.findElement
loginpage.setEmail(email);
loginpage.setPassword(password);
loginpage.clickOnLogin();
}
-
By using Alerts in Selenium: We can use following lines of code to handle popup window using Alerts. For eg: