I'm trying to get page content which is dynamically loaded after you get to the end of the page but after use sendKeys(Keys.END) page content seems to be the same.
Any chance to handle it and get new reloaded source? I'm using PhantomJS in Java.
The basic idea is to explicitly wait for a presence or visibility of an element loaded dynamically - then, call the getPageSource() method.
For example, if there is a div with a "additionalContent" class dynamically loaded, here is how you can wait for it to appear:
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div.additionalContent")));
// get the page source
System.out.println(driver.getPageSource());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With