Created
January 30, 2024 16:13
-
-
Save SarahElson/a07d6b51f1dcf5b70aaf3f7d041ae8e3 to your computer and use it in GitHub Desktop.
How To Scroll Down in Selenium WebDriver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package test; | |
| import org.openqa.selenium.Dimension; | |
| import org.testng.annotations.Test; | |
| public class ScrollToHorizontalRight extends BaseTest{ | |
| @Test | |
| public void testScrollToHorizontalRight() | |
| { | |
| //launch the website | |
| driver.get("https://www.lambdatest.com"); | |
| //decrease the size of window to show both scroll bars | |
| driver.manage().window().setSize(new Dimension(450,630)); | |
| //scroll to the right | |
| js.executeScript("window.scrollBy(6000,0)"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment