如下,升级 appium 到 1.3.4, 用下面的方法滑动屏幕失败。该如何处理?请大神指教。
public static void swipeScreen(Double startX, Double startY, Double endX,
Double endY, Double duration, int repeat, AppiumDriver driver) {
JavascriptExecutor 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);
System.out.println("滑动屏幕成功");
} catch (WebDriverException ex) {
System.out.println("滑动屏幕失败");
}
}
}