哈哈 好巧 我也在腾飞创新园。
三年是个分水岭了,能做什么不能做什么很清楚了
hook 成功了没?来个微信抢红包~~~
#155 楼 @seveniruby 好的 我在看看,thx
有几个问题请教下:
两种方法 你可以试试
根据方向来滑动
public static void scroll(String direction) {
js = (JavascriptExecutor) driver();
HashMap<String, String> scrollObject = new HashMap<String, String>();
scrollObject.put("direction", direction);
js.executeScript("mobile: scroll", scrollObject);
}
根据坐标来滑动
public static void swipe(Double startX, Double startY, Double endX,
Double endY, Double duration, int repeat) {
js = (JavascriptExecutor) driver();
HashMap<String, Double> swipeObj = new HashMap<String, Double>();
swipeObj.put("startX", startX);
swipeObj.put("startY", startY);
swipeObj.put("endX", endX);
swipeObj.put("endY", endY);
swipeObj.put("duration", duration);
// 拖动
for (int i = 0; i < repeat; i++) {
try {
js.executeScript("mobile: swipe", swipeObj);
} catch (WebDriverException ex) {
saveScreenShot();
log.logException(ex);
}
}
}