Firefox alert box not detected with Selenium WebDriver

后端 未结 2 1544
一生所求
一生所求 2021-01-28 14:07

ERROR net.serenitybdd.core.Serenity - No alert is present (WARNING: The server did not provide any stacktrace information)

I get this erro

2条回答
  •  清酒与你
    2021-01-28 14:18

    A little more elegant solution :

    WebDriverWait wait = new WebDriverWait(driver, timeout);
    wait.until(ExpectedConditions.alertIsPresent());
    

    Use the WebDriverWait, every time you have dynamic element that are not present when the page is done loading, like alert, popupwindow, modal popup, hiden element which turn visible,.

提交回复
热议问题