mardi 13 février 2018

Why is my scroll not happening?

I have a scroll method which works in most instances, but I have an instance where it is not scrolling.

This is the method:

public static void scrollPanelUp(WebElement element, WebDriver driver) {

    debug.print(thisClass + " scrolling up...");

    try {
        // Create instance of Javascript executor
        JavascriptExecutor je = (JavascriptExecutor) driver;
        // now execute query which actually will scroll until that element is appeared
        // on page.

        je.executeScript("arguments[0].scrollIntoView(true);", element);

        debug.print(thisClass + " scrolled up!");
    } catch (Exception e) {
        System.err.println(thisClass + " error in scrollPanelUp: " + e.getMessage());
        e.printStackTrace();
    }
}

Any ideas why it is not scrolling in this instance?

Aucun commentaire:

Enregistrer un commentaire