how to add explicit wait in drop down in selenium which is dependent on another dropdown?

后端 未结 3 1729
滥情空心
滥情空心 2021-01-27 13:51

how to add explicit wait in drop down using selenium until it finds the text ?

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-27 14:38

    public boolean waitForElement( String element, int timeout) {
            WebDriverWait wait = new WebDriverWait(appiumDriver, timeout/1000);
            wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(element)));
            return true;
        }
    
    element is the xpath.
    
    and when you run this function it will wait for timeout(millisecond ) max for the element to appear .
    if the element comes early than it will break and return true which means element is present.
    

提交回复
热议问题