Created
January 23, 2017 12:13
-
-
Save santhoshv339/085531e6b10da6e67036ac018e3ff350 to your computer and use it in GitHub Desktop.
Scroll to a particular Element in view
This file contains 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
// Create instance of Javascript executor | |
JavascriptExecutor je = (JavascriptExecutor) driver; | |
//Identify the WebElement which will appear after scrolling down | |
WebElement element = driver.findElement(By.xpath("")); | |
// now execute query which actually will scroll until that element is not appeared on page. | |
je.executeScript("arguments[0].scrollIntoView(true);",element); //or | |
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment