我正在一个应用程序上运行链接测试,其中一个链接会弹出一个登录弹出窗口。有办法检查吗?我尝试将其视为警报,但没有成功。
try
{
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = driver.switchTo().alert();
alert.accept();
reportAlertPresent = true;
}
On driver.switchTo().alert()
, a org.openqa.selenium.NoAlertPresentException
可以抛出,这是未经检查的(即RuntimeException
).
您可以捕获它并可能循环执行此操作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)