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.
  • 539
  • 1
  • 7
  • 30

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.
  • 17,368
  • 19
  • 70
  • 158