我有一个警报显示2次的网站。 场景:
对于浏览器问题,有时是第二次警报,而不是显示,我通过catch
处理它
try {
driver.switchTo().alert();
driver.switchTo().alert().accept();
WebDriverWait wait = new WebDriverWait(driver, 30);
// Wait for Alert to be present
Alert myAlert = wait.until(ExpectedConditions.alertIsPresent());
myAlert.accept();
}
catch (org.openqa.selenium.NoAlertPresentException e){
driver.navigate().refresh();
}
catch (org.openqa.selenium.UnhandledAlertException e){
driver.navigate().refresh();
}
线程中的异常" main" org.openqa.selenium.UnhandledAlertException:意外警报打开:{警告文字:见控制台} (会话信息:chrome = 61.0.3163.100)
通过UnhandledAlertException管理此错误但不知何故它无法正常工作..任何人都建议我如何处理此