I am using Selenium WebDriver to automate my browser tests. My browser header is floating and is always present irrespective of the browser scroll.
<You can scroll to the necessary location using javascript You need to use the scrollTo method rather than the scrollBy method for it to work.
public void scrollToElement(By by) {
Locatable element = (Locatable) selenium.findElement(by);
Point p= element.getCoordinates().getLocationOnScreen();
JavascriptExecutor js = (JavascriptExecutor) selenium;
js.executeScript("window.scrollTo(" + p.getX() + "," + (p.getY()+150) + ");");
}
Simple use the
.sendKeys(Keys.PAGE_DOWN);
when your element was visible, just click on it, by .click(element).perform();
for me work something like this:
clicker = new Actions(driver);
clicker.sendKeys(Keys.PAGE_DOWN);
Thread.sleep(1000);
clicker.click(button).perform();
Thread.sleep(1000);