How to scroll down using Selenium WebDriver with Java

后端 未结 4 1342
夕颜
夕颜 2020-12-14 10:17

I want to scroll down my web page and i m using this code to scroll page but it is not working

public ViewBasketSentToMePageObject viewSlideShare() throws I         


        
4条回答
  •  温柔的废话
    2020-12-14 11:06

    For scroll down:

    WebDriver driver = new FirefoxDriver();
    JavascriptExecutor jse = (JavascriptExecutor)driver;
    jse.executeScript("scroll(0, 250);");
    

    or, you can do as follows:

    jse.executeScript("window.scrollBy(0,250)", "");
    

提交回复
热议问题