1 定义isAlertPresent()供调用;
public boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException Ex) {
return false;
}
}
2 处理弹出的alert;
while (new Sgzzsjps_Action(driver).isAlertPresent()){
driver.switchTo().alert().accept();
Thread.sleep(3000);
}