如何在 Selenium 中处理 IE 设置弹出窗口
How To Handle IE Setup Popup in Selenium
如何处理在 selenium 中设置的 IE 单击图像以弹出警报
您可以尝试通过 selenium 接受警报。以下 Java 方法应接受警报并让您继续生活。
public void checkAlert()
{
try
{
// Wait for the alert to show
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.alertIsPresent());
driver.switchTo().alert().accept();
}
catch (Exception e)
{
//exception handling
}
}
您也需要将 import org.openqa.selenium.Alert;
添加到您的导入中。
如何处理在 selenium 中设置的 IE 单击图像以弹出警报
您可以尝试通过 selenium 接受警报。以下 Java 方法应接受警报并让您继续生活。
public void checkAlert()
{
try
{
// Wait for the alert to show
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.alertIsPresent());
driver.switchTo().alert().accept();
}
catch (Exception e)
{
//exception handling
}
}
您也需要将 import org.openqa.selenium.Alert;
添加到您的导入中。