wait for “loading” icon to disappear from the page

前端 未结 3 1397
不知归路
不知归路 2021-01-21 14:47

we are doing automation for web application and most of the scenario getting loading icon will appear at center of the page .. we need to wait for dis appear to loading icon

3条回答
  •  逝去的感伤
    2021-01-21 15:27

    Explicit Wait should help:

    public static String waitForElementNotVisible(int timeOutInSeconds, WebDriver driver, String elementXPath) {
        if ((driver == null) || (elementXPath == null) || elementXPath.isEmpty()) {
    
            return "Wrong usage of WaitforElementNotVisible()";
        }
        try {
            (new WebDriverWait(driver, timeOutInSeconds)).until(ExpectedConditions.invisibilityOfElementLocated(By
                    .xpath(elementXPath)));
            return null;
        } catch (TimeoutException e) {
            return "Build your own errormessage...";
        }
    }
    

提交回复
热议问题