How to scroll tables using selenium WebDriver and Java | Selenium Practice



Hello Dear Friends,

I hope you are doing Good.!!

In this tutorial we are going to see a very interesting topic and this is How to scroll tables using selenium WebDriver and Java | Selenium Practice.

To Scroll Down: 

import org.openqa.selenium.JavascriptExecutor;

WebDriver driver = new ChromeDriver();

JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("scroll(0, 500)"); //y value '250' can be changed


To Scroll Up:

JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("scroll(500, 0)"); //x value '500' can be changed

To Scroll Bottom of the Page:

JavascriptExecutor js = (JavascriptExecutor)driver;

js.executeScript("window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight))");


Please visit on our other platforms: 👇

Comments

Popular Post

MCQ questions for graphics class method in Java

Session 2 TestNG Framework | How to create TestNG Project In Eclipse IDE | With Selenium Test Cases

Print Hello World In Different Programming Languages | Boost Coding Skill | Developer Life

How to run Selenium script when system is locked?

Read Any Type Of JSON File in JAVA | Simple Introduction And Demo Of JavaScript Object Notation