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

帅比萌擦擦* 提交于 2019-12-20 07:45:16

问题


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


回答1:


WebDriver wait = new WebDriver(Driver, Seconds);
boolean status; 

status = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(""))) != null;




回答2:


Try this below code.

WebDriverWait wait = new WebDriverWait(driver, 15);          //add Explicit Wait
wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("Your xpath"))));

driver.findElement(By.xpath("Your xpath")).click();   //After Explicit Wait Click on WebElement



回答3:


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.


来源:https://stackoverflow.com/questions/42243344/how-to-add-explicit-wait-in-drop-down-in-selenium-which-is-dependent-on-another

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