How to handle selenium test failed org.openqa.selenium.unhandledalertexception

You can use

DesiredCapabilities browser = DesiredCapabilities.firefox();
browser.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
You can use UnexpectedAlertBehaviour.ACCEPT or UnexpectedAlertBehaviour.DISMISS
Same can be done for other drivers.

Or if specific alert you can do
driver.switchTo().alert().accept();
driver.switchTo().alert().dismiss();

No comments:

Post a Comment