Hello, I am learning to use Appium for a project at work and am hoping to find out if anyone has found any amazing resources for debugging TouchActions. I am using the latest version (Appium v1.7.2), an Android Tablet and the python client. My project has an image that we are rotating and zooming in and out on with touch gestures. These gestures work fine when performed manually, but I haven’t been able to simulate the gestures with the TouchAction and MultiAction.
It would be useful to see something on the screen to indicate that the action actually occurred. There are no error messages and nothing seems to happen on screen. I have been using the Python runtime environment and have my driver and some buttons in a module (f) so I don’t have to retype.
>>> from appium.webdriver.common.touch_action import TouchAction
>>> TouchAction(f.DRIVER).press(x=150, y=150).move_to(x=0, y=350).release().perform()
<appium.webdriver.common.touch_action.TouchAction object at 0x016E48D0>
The Appium Server log looks like this:
[HTTP] --> POST /wd/hub/session/3bf561b0-63d9-46ad-8a13-e21056772dd7/touch/perform {"actions":[{"action":"press","options":{"x":150,"y":150}},{"action":"moveTo","options":{"x":0,"y":350}},{"action":"release","options":{}}],"sessionId":"3bf561b0-63d9-46ad-8a13-e21056772dd7"}
[MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{"x":150,"y":150}},{"action":"moveTo","options":{"x":0,"y":350}},{"action":"release","options":{}}],"3bf561b0-63d9-46ad-8a13-e21056772dd7"]
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:touchDown","params":{"x":150,"y":150}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:touchDown","params":{"x":150,"y":150}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: touchDown
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Display bounds: [0,0][1280,752]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Performing TouchDown using element? false x: 150, y: 150
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:touchMove","params":{"x":150,"y":500}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:touchMove","params":{"x":150,"y":500}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: touchMove
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Display bounds: [0,0][1280,752]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Performing TouchMove using element? false x: 150, y: 500
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:touchUp","params":{"x":150,"y":500}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:touchUp","params":{"x":150,"y":500}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: touchUp
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Display bounds: [0,0][1280,752]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Performing TouchUp using element? false x: 150, y: 500
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.performTouch() result: null
[HTTP] <-- POST /wd/hub/session/3bf561b0-63d9-46ad-8a13-e21056772dd7/touch/perform 200 84 ms - 76
So it looks like it should have done something. Maybe it has something to do with how fast the gesture happened. I have also tried using the Appium/ApiDemos-debug.apk to draw a smiley face. That works, but the actions happen really fast. Is there a way to slow it down?
It would be great if this worked. I have been looking to see if there are any restrictions or reasons why it doesn’t and have found nothing. Any help would be greatly appreciated.