selenium模拟键盘操作:
import org.openqa.selenium.interactions.Actions;
Actions action = new Actions(driver);
action.sendKeys(Keys.END).perform();//下拉到底部
action.sendKeys(Keys.HOME).perform();//上拉到顶部
action.sendKeys(Keys.PAGE_DOWN).perform();//向下滚动
action.sendKeys(Keys.PAGE_UP).perform();//向上滚动

本文介绍了使用Selenium进行网页自动化时如何通过模拟键盘操作来实现页面的上下滚动,包括滚动到页面底部、顶部及逐页滚动的方法。
6195

被折叠的 条评论
为什么被折叠?



