Does anyone know how I can Scroll in Selenium Webdriver in JAVA

Asked

Viewed 2,564 times

0

Code:

WebElement emailsecundario = driver.findElement(By.id("RecoveryEmailAddress"));
emailsecundario.sendKeys(" [email protected]");        

WebElement gravar = driver.findElement(By.id("submitbutton"));
gravar.click();

Does anyone know how I can Scroll on Selenium Webdriver in Java?

  • Explain what you need to do, I believe you have a better solution.

1 answer

1

Scrolling down:

WebDriver driver = new FirefoxDriver();
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("scrollBy(0,250)", "");

Scrolling Upwards:

jse.executeScript("scroll(0, -250);");

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.