How To Handle IE Setup Popup in Selenium

放肆的年华 提交于 2019-12-11 19:06:17

问题


how to handle IE set up in selenium click image for alert popup


回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!