-1

I'd like to do a while loop so my test waits until a given control appears, then click it or send text to it. This way I can get rid of extraneous waits and such and make the test more bullet proof. Not sure how to code this in java/selenium.

Any examples would be appreciated. Thanks in advance.

    if (providerNo != null) {
        WebElement foo = driver.findElement(By.name("providerNumber"));
        foo.sendKeys(providerNo);
    }
Peter Cook
  • 157
  • 1
  • 7

1 Answers1

0

Hi please do it like below

WebElement element = (new WebDriverWait(driver, 30))
   .until(ExpectedConditions.elementToBeClickable(By.name("q")));
Rajnish Kumar
  • 2,828
  • 5
  • 25
  • 39