Pope
Pope

Reputation: 97

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

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

MY CODE

Upvotes: 0

Views: 4238

Answers (3)

Jainish Kapadia
Jainish Kapadia

Reputation: 2611

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

Upvotes: 2

Lyle
Lyle

Reputation: 21

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

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

Upvotes: 1

akhilesh gulati
akhilesh gulati

Reputation: 128

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.

Upvotes: 0

Related Questions