2

Is there a way to control the rate you scroll down in Java?

public static void scrollPage(WebDriver driver) {
    JavascriptExecutor executor = (JavascriptExecutor) driver;
    executor.executeScript("window.scrollTo(0, document.body.scrollHeight);");
}

This is what I have currently but this scrolls to the bottom automatically.

ML.
  • 589
  • 1
  • 9
  • 33

1 Answers1

0

You can divide the scrollHeight by 100 and use a loop to scroll step by step with small delays between the steps.

D.R.
  • 20,268
  • 21
  • 102
  • 205