0 votes
in Selenium by
How to scroll down a page using JavaScript?

1 Answer

0 votes
by

scrollBy() method is used to scroll down the webpage

General syntax:

executeScript("window.scrollBy(x-pixels,y-pixels)");

First, create a JavaScript object

   JavascriptExecutor js = (JavascriptExecutor) driver;

Launch the desired application

   driver.get(“https://www.amazon.com”);

Scroll down to the desired location

   js.executeScript("window.scrollBy(0,1000)"); 

The window is not scrolled vertically by 1000 pixels

Related questions

0 votes
asked Aug 22, 2019 in Selenium by john ganales
0 votes
asked Aug 22, 2019 in Selenium by john ganales
...