Solution:
basically, this message shows selenium
is not able to handle alert or window popup or browser popup message
Use this code to handle this issue:
public void clickOKAlertAccept() throws InterruptedException {
// you can ignore
the step written in first try block. Also DRIVER I have defined for browser in
my code.
try{
Alert alert = DRIVER.switchTo().alert();
alert.accept();
} catch (Exception e) {
try {
if(e.toString().contains("org.openqa.selenium.UnhandledAlertException"))
{
Alert alert = DRIVER.switchTo().alert();
alert.accept();
}
} catch (NoAlertPresentException e1) {
e.printStackTrace();
}
}
}
It worked for me !!!
Happy Testing!!!
Comments
Post a Comment