For this example let's look at the site pinterest:
When i make the initial login, there is a loading of pins. In order to get more pins i need to scroll to the end of the page, after there is a request made for more pins (Lot's of sites are working like that i suppose)
So i know how to do the scroll in selenium, but how do i wait for the request to end?
I mean, it's not waiting for certain element to appear, the kind of element (The pins) is already there but i am waiting for others to appear.
If i use expected condition with wait, it good for the first batch of pins, but those that add to them, how do i wait for them, example:
When pinterest first load->
WebDriverWait driverWait = new WebDriverWait(cd, 10, 1000);
element = driverWait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("thepins")));
Which is great for the initial loading, now i scroll to the bottom of the page
((JavascriptExecutor) cd).executeScript("window.scrollTo(0, document.body.scrollHeight)");
Now depends on the page, there is a loading to more pins(And sometimes not) i want to wait for them to load before i do another scroll.
What is the best approach to this situation?