-
-
Notifications
You must be signed in to change notification settings - Fork 768
Description
with official version of Appium swipe method does not work.
have Android 4.4.2 phone
Example of not working code (made different duration but not working if same also):
((AppiumDriver) driver).swipe(point.x+size.getWidth(),point.y+size.getHeight()/2,
point.x,point.y+size.getHeight()/2,2000);
Working code as workaround:
((JavascriptExecutor) driver).executeScript("mobile: swipe", new HashMap<String, Double>() {{
put("touchCount", (double) 1);
put("startX", (double) gridViewContainer.get(0).getLocation().getX() +
gridViewContainer.get(0).getSize().width);
put("startY", (double) gridViewContainer.get(0).getLocation().getY() +
gridViewContainer.get(0).getSize().height / 2);
put("endX", (double) gridViewContainer.get(0).getLocation().getX());
put("endY", (double) gridViewContainer.get(0).getLocation().getY()
+ gridViewContainer.get(0).getSize().height / 2);
put("duration", 1.0);
}});
Appium logs:
Not working code logs:
2014-05-21T08:36:18.763Z - info: Pushing command to appium work queue: ["swipe",{"startX":1012,"startY":893,"endX":67,"endY":893,"steps":56}]
2014-05-21T08:36:18.763Z - debug: Request received with params: {"actions":[{"action":"press","options":{"y":893,"x":1012}},{"action":"wait","options":{"ms":2000}},{"action":"moveTo","options":{"y":893,"x":67}},{"action":"release","options":{}}]}
2014-05-21T08:36:18.767Z - info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"swipe","params":{"startX":1012,"startY":893,"endX":67,"endY":893,"steps":56}}
2014-05-21T08:36:18.767Z - info: [BOOTSTRAP] [info] Got command of type ACTION
2014-05-21T08:36:18.767Z - info: [BOOTSTRAP] [debug] Got command action: swipe
2014-05-21T08:36:18.769Z - info: [BOOTSTRAP] [info] Swiping from [x=1012.0, y=893.0] to [x=67.0, y=893.0] with steps: 56
2014-05-21T08:36:20.016Z - info: [BOOTSTRAP] [info] Returning result: {"value":true,"status":0}
2014-05-21T08:36:20.017Z - info: Responding to client with success: {"status":0,"value":true,"sessionId":"68a6b5a7-0739-4851-bee2-b00afec82625"}
Working code logs:
2014-05-21T08:36:24.174Z - info: Pushing command to appium work queue: ["swipe",{"startX":1012,"startY":893,"endX":67,"endY":893,"steps":28}]
2014-05-21T08:36:24.173Z - debug: Request received with params: {"args":[{"duration":1,"startX":1012,"touchCount":1,"startY":893,"endX":67,"endY":893}],"script":"mobile: swipe"}
2014-05-21T08:36:24.178Z - info: [BOOTSTRAP] [info] Got data from client: {"cmd":"action","action":"swipe","params":{"startX":1012,"startY":893,"endX":67,"endY":893,"steps":28}}
2014-05-21T08:36:24.179Z - info: [BOOTSTRAP] [info] Got command of type ACTION
2014-05-21T08:36:24.180Z - info: [BOOTSTRAP] [debug] Got command action: swipe
2014-05-21T08:36:24.187Z - info: [BOOTSTRAP] [info] Swiping from [x=1012.0, y=893.0] to [x=67.0, y=893.0] with steps: 28
2014-05-21T08:36:24.916Z - info: [BOOTSTRAP] [info] Returning result: {"value":true,"status":0}
2014-05-21T08:36:24.916Z - info: Responding to client with success: {"status":0,"value":true,"sessionId":"68a6b5a7-0739-4851-bee2-b00afec82625"}
POST /wd/hub/session/68a6b5a7-0739-4851-bee2-b00afec82625/execute 200 744ms - 89b