答案 0 :(得分:5)
我已经通过这种方式解决了它:
// Create instance of Javascript executor
JavascriptExecutor je = (JavascriptExecutor) driver;
//Identify the WebElement which will appear after scrolling down
WebElement element = driver.findElement(By.tagName("...."));
// now execute query which actually will scroll until that element is not appeared on page.
je.executeScript("arguments[0].scrollIntoView(true);",element);
答案 1 :(得分:2)
请尝试以下代码。
browser.executeScript('window.scrollTo(0,0);').then(function () {
page.saveButton.click();
})
希望这会有所帮助。 :)