Answers for "The syntax of ScrollBy() methods"

0

The syntax of ScrollBy() methods

js.executeScript("arguments[0].scrollIntoView();",Element );
Posted by: Guest on June-07-2021
0

The syntax of ScrollBy() methods

executeScript("window.scrollBy(x-pixels,y-pixels)");
Posted by: Guest on June-07-2021
0

The syntax of ScrollBy() methods

js.executeScript("window.scrollTo(0, document.body.scrollHeight)");
Posted by: Guest on June-07-2021
0

The syntax of ScrollBy() methods

public class ScrollByVisibleElement {

    WebDriver driver;
    @Test
    public void ByVisibleElement() {
       WebDriverManager.chromedriver.setup();
        driver = new ChromeDriver();
        JavascriptExecutor js = (JavascriptExecutor) driver;		
        driver.get("URL");      		
        WebElement Element = driver.findElement(locator);

        //This will scroll the page till the element is found		
        js.executeScript("arguments[0].scrollIntoView();", Element);
    }
}
Posted by: Guest on June-07-2021

Browse Popular Code Answers by Language