findElements
method returns a list of web elements matching the passed locator while findElement
method will always return a single web element.
Also in many cases you are applying findElement
and findElements
methods on already fully loaded page. In this case findElements
will return you a list of All the web elements matching the passed locator.
However in order to get all the matching elements in loading page you can't effectively use findElements
with implicit wait.
Expected conditions implementing explicit wait should be used instead.
In case you know the exact amount of elements matching the passed locator presented on that page you can use this method:
wait.until(ExpectedConditions.numberOfElementsToBe(element, expectedElementsAmount))
And in case you know that it should be at least some known amount of elements you can use this method:
wait.until(ExpectedConditions.numberOfElementsToBeMoreThan(element, expectedElementsAmount))