说明:滚动条也分为很多种。需根据具体情况来决定使用哪种方法。


一、最普通滚动条,手动拖动可以到页面任意位置 。 

  1. 滚动到指定元素的位置;


    WebElement target = driver.findElement(By.xpath(xPathExpression));((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView();", target);