I am using Selenium Webdriver to validate a specific site and upon going to the site, it prompts me to enter a username and password via a prompt window. i cannot right click it to inspect properties
I already tried the driver.switchTo().alert() and the Webdriver Wait but it still wont work. tried both on Chrome and firefox browsers
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","C:\\Users\\eclipse-workspace\\ChromeDemo\\geckodriver.exe");
WebDriver driver = new FirefoxDriver ();
//Go to Website
driver.get("enter site here");
//After entering the site, Prompt window appears
driver.switchTo().alert();
driver.findElement(By.name("User Name:")).sendKeys("nUsername");
driver.findElement(By.name("Password:")).sendKeys("nPassword");
I expect that the prompt window will be populated with the username and password but it doesn't
Alert alert = driver.switchTo().alert();
. This should contain some of the stuff you'd need to interact with the Alert – martijn palert.authenticateUsing(new UserAndPassword(username, password));
– ou_ryperd