Monday, May 4, 2015

Scroll Operations using Javascript Executor in Selenium WebDriver

  1. ScrollIntoView
  2. ScrollTo
  3. ScrollBy

scrollIntoView() method scrolls the element's parent container such that the element on which scrollIntoView() is called is visible to the user.

WebElement footer = driver.findElement(By.cssSelector("#footerContainer"));
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].scrollIntoView()", footer);

No comments:

Post a Comment

Selenium 3 vs Selenium 4