【发布时间】:2016-08-20 03:30:08
【问题描述】:
我正在使用 Java 和 Selenium 编写测试。我的 Chrome 浏览器 版本是 52.0,我的 selenium 驱动程序是 2.53。我的目标网页上有一个按钮,单击该按钮后会显示警报。我一直用:
try{ wait.until(ExpectedConditions.elementToBeClickable(By.xpath("blabla"))).click();
Thread.sleep(1000);
wait.until(ExpectedConditions.alertIsPresent());
driverChrome.switchTo().alert().accept();
}
catch(Exception e){
e.printStackTrace();
}
处理警报,但是从今天早上开始,当测试单击按钮时,警报会弹出,但紧接着它会抛出:
org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status
from unexpected alert open
(Session info: chrome=52.0.2743.116)
(Driver info: chromedriver=2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 33 milliseconds
它甚至没有到达第二和第三行! 第一行抛出错误
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("blabla"))).click();
【问题讨论】:
标签: java selenium selenium-webdriver selenium-chromedriver