Thursday, 9 June 2022

How To Scroll Down in Selenium Webdriver Java | How To Scroll Webpage in Selenium

                  In this post, we will see How To Scroll Down in Selenium Webdriver Java | How To Scroll Webpage in Selenium 


Program Code

import org.openqa.selenium.JavascriptExecutor;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;


public class Scroll {


public static void main(String[] args) throws InterruptedException {

System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver_win32\\chromedriver.exe");

WebDriver driver=new ChromeDriver();

driver.get("https://mdbootstrap.com/docs/b4/jquery/tables/scroll/");

driver.manage().window().maximize();

JavascriptExecutor js=(JavascriptExecutor)driver;

Thread.sleep(2000);

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


}


}  


Watch following video:


Watch on YouTube: https://www.youtube.com/watch?v=yeDCVTq2CR4


No comments:

Post a Comment