How to do dynamic scrolling on any webpage
import io.github.bonigarcia.wdm.WebDriverManager; import org.openqa.selenium.*; import org.testng.annotations. Test ; public class ScrollDownTestAnkurDemo { @Test public static void getDynamicScrollDownByAnkur() { WebDriver driver = WebDriverManager. chromedriver ().create(); driver.manage().window().maximize(); driver.get( "https://www.google.com" ); driver.findElement(By. name ( "q" )).sendKeys( "Facebook" + Keys. ENTER ); JavascriptExecutor js = (JavascriptExecutor) driver; //Get the actual whole WebPage Height Object height = js.executeScript( "return document.body.scrollHeight" ); String ht = height.toString(); System. out .println( "Page height is : " +ht); //Calculating the Number of Steps to scroll using 450 Pixel in each scroll float htInt = Integer. parseInt (ht); System. out .println( " The number of steps to scroll ...