Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created January 30, 2024 16:13
Show Gist options
  • Select an option

  • Save SarahElson/a07d6b51f1dcf5b70aaf3f7d041ae8e3 to your computer and use it in GitHub Desktop.

Select an option

Save SarahElson/a07d6b51f1dcf5b70aaf3f7d041ae8e3 to your computer and use it in GitHub Desktop.
How To Scroll Down in Selenium WebDriver
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