mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/GeneralHelper.java
public static WebElement scrollElementIntoView(final By by)
    {
        WebDriver driver = WebDriverFactory.retrieveWebDriver();
        new FluentWait<WebDriver>(driver)
            .withTimeout(30, TimeUnit.SECONDS)
            .pollingEvery(1, TimeUnit.SECONDS)
            .ignoring(WebDriverException.class) // sometimes arguments[0] is not found so allow retries
            .until(new ExpectedCondition<Boolean>()
            {
                @Override
                public Boolean apply(WebDriver driver)
                {
                    ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", 
                            driver.findElement(by));
                    return true;
                }
            });

        // click to keep the element in view
        final WebElement webElement = driver.findElement(by);
        safeClick(webElement);

        // get element again as the DOM might have updated after the click
        return driver.findElement(by);
    }
/**
     * Scroll the given element into view and click the element to keep it in view.
     * 
     * @param by
     *      selector for the element to find
     * @return
     *      element to scroll to after it has been scrolled to (after DOM update)
     */
Scroll the given element into view and click the element to keep it in view.

@param by
selector for the element to find
@return
element to scroll to after it has been scrolled to (after DOM update)
Scroll the given element into view and click the element to keep it in view . @param by selector for the element to find @return element to scroll to after it has been scrolled to ( after DOM update )
public static WebElement scrollElementIntoView(final By by)
    {
        WebDriver driver = WebDriverFactory.retrieveWebDriver();
        new FluentWait<WebDriver>(driver)
            .withTimeout(30, TimeUnit.SECONDS)
            .pollingEvery(1, TimeUnit.SECONDS)
            .ignoring(WebDriverException.class) 
            .until(new ExpectedCondition<Boolean>()
            {
                @Override
                public Boolean apply(WebDriver driver)
                {
                    ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", 
                            driver.findElement(by));
                    return true;
                }
            });
        final WebElement webElement = driver.findElement(by);
        safeClick(webElement);
        return driver.findElement(by);
    }
public static WebElement scrollElementIntoView ( final By by ) { WebDriver driver = WebDriverFactory . retrieveWebDriver ( ) ; new FluentWait < WebDriver > ( driver ) . withTimeout ( 30 , TimeUnit . SECONDS ) . pollingEvery ( 1 , TimeUnit . SECONDS ) . ignoring ( WebDriverException . class ) . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { ( ( JavascriptExecutor ) driver ) . executeScript ( "arguments[0].scrollIntoView(true);" , driver . findElement ( by ) ) ; return true ; } } ) ; final WebElement webElement = driver . findElement ( by ) ; safeClick ( webElement ) ; return driver . findElement ( by ) ; }
Scroll the given element into view and click the element to keep it in view.
Scroll the given element into view and click the element to keep it in view .
// sometimes arguments[0] is not found so allow retries // click to keep the element in view // get element again as the DOM might have updated after the click