How to verify whether an WebElement is displayed in the viewport using WebDriver?
java, scrollbar, selenium, visibility, webdriver
Solution
@Vel Ganesh - I dont know if this can be verified using selenium. But can be definitely done using Sikuli. You can check sikuli.org for details. Sikuli has a Java API and so can be integrated with WebDriver code as well.
Problem
Consider the following scenario, - The webpage is displayed along with a vertical scroll bar - Scroll bar is present at the bottom - WebElement 'Test' is present at the top of the page and is now not visible in the current view port. Functionality to be verified: Clicking 'Goto Top' link in the bottom of the page should scroll the page such that the WebElement 'Test' gets displayed within the view port. Please let me know how to verify whether an element is displayed in the current view port or not using WebDriver. Note: element.isDisplayed will always be true in the above case as the function checks the whole page rather than checking the current view port only.