这是使用“从此处进行显式等待”对我有用的WebDriver:高级用法
public void checkalert() { try { WebDriverWait wait = new WebDriverWait(driver, 2); wait.until(ExpectedConditions.alertIsPresent()); alert alert = driver.switchTo().alert(); alert.accept(); } catch (Exception e) { //exception handling }}


