Selenium Webdriver, scrolling inside a div popup

后端 未结 1 1791
逝去的感伤
逝去的感伤 2021-01-01 00:14

There is a pop that is displayed which has a content that large that will have to scroll to view it completely. Is there was to scroll the content within the div that is sho

1条回答
  •  抹茶落季
    2021-01-01 00:41

    // Initialize Javascript executor
    JavascriptExecutor js = (JavascriptExecutor) driver;
    
    // Scroll inside web element vertically (e.g. 100 pixel)
    js.executeScript("arguments[0].scrollTop = arguments[1];",driver.findElement(By.id("")), 100);
    

    This should help to scroll within DIV element.

    0 讨论(0)
提交回复
热议问题