I am trying to get the number of rows in a page that is completely dynamic. I have the below code to do so. But it is scrolling to a certain extent and fetching only a partial count of the elements. Cannot locate any element at the bottom of the page as it is a dynamic one. How can I resolve this issue?
List<WebElement> elements = driver.findElements(By.xpath(NoOfAssets));
Actions a = new Actions(driver);
a.moveToElement(elements.get(elements.size() - 1)).clickAndHold().moveByOffset(0, 1000000000).release().perform();
int noOfAssets = elements.size();
System.out.println(noOfAssets);
It is returning 40 rows only. But there are more rows actually. I want to drag the cursor till the bottom of the page as and when the rows get loaded and then get the size.