-3

I have below java code to find a element list. how to implement a implicit wait for it. (without using Thread.sleep(XXX)) ?

List<WebElement> datasetList = webDriver.findElements(elementListLocator);
Guy
  • 46,488
  • 10
  • 44
  • 88
Piyum Rangana
  • 71
  • 1
  • 9
  • Did you search? https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#implicit-waits – Guy Jun 04 '19 at 04:52
  • 2
    What have you tried so far? Have you searched documentation or with Google/Bing/etc, and if so what have you searched? I searched for the phrase `seleium webdriver implicit wait java` and received a lot of useful looking links describing how to achieve this. – Jamie Taylor Jun 04 '19 at 04:54

1 Answers1

1

Implicit wait work at WebDriver level.

Explicit wait work at WebElement level.

If it is just for visibility of list of web elements, you could try something like this :

WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds)
wait.until(ExpectedConditions.visibilityOfAllElements(List<WebElement> elements)); 

You can just pass the datasetList reference in place of elements, that'd do the job.

cruisepandey
  • 28,520
  • 6
  • 20
  • 38