scroll in java selenium code example
Example: scroll down selenium java
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class ScrollByPixel {
WebDriver driver;
@Test
public void ByPixel() {
System.setProperty("webdriver.chrome.driver", "E://Selenium//Selenium_Jars//chromedriver.exe");
driver = new ChromeDriver();
JavascriptExecutor js = (JavascriptExecutor) driver;
driver.get("http://demo.guru99.com/test/guru99home/");
driver.manage().window().maximize();
js.executeScript("window.scrollBy(0,1000)");
}
}