I am creating a test project where when clicking on a button system pops-up a window where I need to click OK but unable to do using the following code:
@Test
public void testAddNewUserMakeSuperUser() throws Exception {
driver.get("https://webqa.searshc.com/ssod/Admin/createUser.html");
driver.findElement(By.id("saveUserDetails")).click();
Alert alert = driver.switchTo().alert();
System.out.println(alert.getText());
alert.accept();
}
I have used
executeScript = ((JavascriptExecutor) driver).executeScript("window.confirm = function(msg) { return true; }");
also... but I am unable to run this.