0

I have list of web element, when I apply listName.size() function on list, it shows count as 1.
Where as in actual the count is not 1.

Below things I have tried -

  1. Tried applying implicit and explicit wait in order to load the long list of web elements properly.
  2. Tried wait.until(ExpectedConditions.visibilityOfElementLocated(listName));

java code :

List<WebElement> listName= driver.findElements(By.xpath("xpath"));
int count = listName.size();

I want the count exact as the number elements of list found by using xpath. Note: The xpath is valid and correct. Can locate the elements manually with that xpath.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Kavita Kulkarni
  • 193
  • 2
  • 4
  • 12

1 Answers1

0

If your usecase is to print the size() of the List matching a specific Locator Strategy instead of using visibilityOfElementLocated() you need to use either of the following solutions:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352