Reputation: 99
I am trying to find out the no. of orders in the following picture using
//*[@id='past-orders-tab']/div[contains(@class,'physical')]
but it is returning zero using .size()
( storing in List[WebElement])
.When i picked one order using findelement()
,it is working fine. Here's the page source code
How to correct it?
Upvotes: 2
Views: 2102
Reputation: 23805
You should try using WebDriverWait
to wait until there is at least one element present on a web page as below :-
WebDriverWait wait = new WebDriverWait(driver, 10);
List<WebElement> ord = wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector("#past-orders-tab > div.physical")));
Upvotes: 1