// final JavascriptExecutor js = (JavascriptExecutor) remoteWebDriver;
//
// final HashMap swipeObj = new HashMap();
// swipeObj.put("startX", 0.0);
// swipeObj.put("startY", 100.0);
// swipeObj.put("endX", 0.0);
// swipeObj.put("endY", 400.0);
// swipeObj.put("duration", 1.0);
// // 拖动
// for (int i = 0; i < 2; i++) {
// js.executeScript("mobile: swipe", swipeObj);
//
// }
// TimeUnit.SECONDS.sleep(20);

final JavascriptExecutor js = (JavascriptExecutor) remoteWebDriver;
final Map scrollObject = new HashMap();
scrollObject.put("direction", "down");
System.out.println("Scroll object:" + scrollObject.size());
for (int i = 0; i < 1; i++) {
js.executeScript("mobile: scroll", scrollObject);
}


↙↙↙阅读原文可查看相关链接,并与作者交流