Created
July 13, 2016 12:20
-
-
Save henrrich/7a04f46558a0d4c6755d37e4018a684d to your computer and use it in GitHub Desktop.
Implementation of webdriver inViewPort method in javascript.
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
/** | |
* This method is a replacement to the inViewPort method from selenium webdriver API. | |
* It uses javascript to scroll. | |
* For parameter details, check the link below: | |
* @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView">Element.scrollIntoView()</a> | |
*/ | |
public void inViewPort(boolean alignToTop, WebElement element) { | |
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(" + alignToTop + ")", element); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment