该如何解决报错问题?,附上源代码: 作者: joykao 时间: 2016-11-1 16:30
用这个吧,可以自己再封装下,比如像本人博客里写的这样
//巧用scroll bar
/**
* This method is used to scroll the page scroll bar to the top position
*/
public static void scrollTop() {
((JavascriptExecutor) driver).executeScript("jQuery(document).scrollTop(0)");
}
/**
* This method is used to scroll the page scroll bar to the bottom position
*/
public static void scrollBottom() {
((JavascriptExecutor) driver)
.executeScript("jQuery(document).scrollTop(jQuery(document).height())");
}
/**
* 用于特殊操作控制浏览器scroll bar位置
*/
public static void scrollDown(int i) {
String a = "jQuery(document).scrollTop(" + i + ")";
((JavascriptExecutor) driver).executeScript(a);
}