问题
how to handle IE set up in selenium click image for alert popup
![](https://www.eimg.top/images/2020/03/21/28d92477a9440870e4d9a7685a86c91b.png)
回答1:
You can try to accept the alert via selenium. The following Java method should accept the alert and let you move on with your life.
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
}
}
You'll want to add import org.openqa.selenium.Alert;
to your imports too.
来源:https://stackoverflow.com/questions/55179189/how-to-handle-ie-setup-popup-in-selenium