appium: Using iOS multitouch actions with double tap interprets commands with coordinates incorrectly

I tried doing a double tap with the multi actions but i get no response.
Initially I tried to do a

            new TouchAction(driver)
                .Tap(point.X, point.Y, count: 2)
                .Perform()

I wasn’t sure if it was tapping it too fast or too slow, since the outcome wasn’t doing anything. I changed the test code to the following:

            new TouchAction(driver)
                .Press(point.X, point.Y)
                .Wait(200)
                .Release()
                .Wait(500)
                .Press(point.X, point.Y)
                .Wait(200)
                .Release()
                .Wait(500)
                .Perform();

The x coordinates is 160, and the y is 284.

However in the log it shows:

debug: Appium request initiated at /wd/hub/session/55c88d68-ea9a-4ce9-b078-87d7b909c107/touch/perform
debug: Request received with params: {"actions":[{"action":"press","options":{"x":160,"y":284}},{"action":"wait","options":{"ms":200}},{"action":"release"},{"action":"wait","options":{"ms":500}},{"action":"press","options":{"x":160,"y":284}},{"action":"wait","options":{"ms":200}},{"action":"release"},{"action":"wait","options":{"ms":500}}]}
debug: Pushing command to appium work queue: "target.touch([{\"touch\":[{\"x\":160,\"y\":284}],\"time\":0.2},{\"touch\":[{\"x\":160,\"y\":284}],\"time\":0.4},{\"touch\":[{\"x\":160,\"y\":284}],\"time\":0.6000000000000001},{\"touch\":[{\"x\":160,\"y\":284}],\"time\":1.1},{\"touch\":[{\"x\":320,\"y\":568}],\"time\":1.3},{\"touch\":[{\"x\":320,\"y\":568}],\"time\":1.5},{\"touch\":[{\"x\":320,\"y\":568}],\"time\":1.7},{\"touch\":[{\"x\":320,\"y\":568}],\"time\":2.2}])"
debug: Sending command to instruments: target.touch([{"touch":[{"x":160,"y":284}],"time":0.2},{"touch":[{"x":160,"y":284}],"time":0.4},{"touch":[{"x":160,"y":284}],"time":0.6000000000000001},{"touch":[{"x":160,"y":284}],"time":1.1},{"touch":[{"x":320,"y":568}],"time":1.3},{"touch":[{"x":320,"y":568}],"time":1.5},{"touch":[{"x":320,"y":568}],"time":1.7},{"touch":[{"x":320,"y":568}],"time":2.2}])
debug: Sending command to instruments: target.touch([{"touch":[{"x":160,"y":284}],"time":0.2},{"touch":[{"x":160,"y":284}],"time":0.4},{"touch":[{"x":160,"y":284}],"time":0.6000000000000001},{"touch":[{"x":160,"y":284}],"time":1.1},{"touch":[{"x":320,"y":568}],"time":1.3},{"touch":[{"x":320,"y":568}],"time":1.5},{"touch":[{"x":320,"y":568}],"time":1.7},{"touch":[{"x":320,"y":568}],"time":2.2}])


info: --> POST /wd/hub/session/55c88d68-ea9a-4ce9-b078-87d7b909c107/touch/perform {"actions":[{"action":"press","options":{"x":160,"y":284}},{"action":"wait","options":{"ms":200}},{"action":"release"},{"action":"wait","options":{"ms":500}},{"action":"press","options":{"x":160,"y":284}},{"action":"wait","options":{"ms":200}},{"action":"release"},{"action":"wait","options":{"ms":500}}]}


debug: [INST] 2014-08-18 23:55:38 +0000 Debug: Got new command 71 from instruments: target.touch([{"touch":[{"x":160,"y":284}],"time":0.2},{"touch":[{"x":160,"y":284}],"time":0.4},{"touch":[{"x":160,"y":284}],"time":0.6000000000000001},{"touch":[{"x":160,"y":284}],"time":1.1},{"touch":[{"x":320,"y":568}],"time":1.3},{"touch":[{"x":320,"y":568}],"time":1.5},{"touch":[{"x":320,"y":568}],"time":1.7},{"touch":[{"x":320,"y":568}],"time":2.2}])



debug: [INST] 2014-08-18 23:55:38 +0000 Debug: evaluating target.touch([{"touch":[{"x":160,"y":284}],"time":0.2},{"touch":[{"x":160,"y":284}],"time":0.4},{"touch":[{"x":160,"y":284}],"time":0.6000000000000001},{"touch":[{"x":160,"y":284}],"time":1.1},{"touch":[{"x":320,"y":568}],"time":1.3},{"touch":[{"x":320,"y":568}],"time":1.5},{"touch":[{"x":320,"y":568}],"time":1.7},{"touch":[{"x":320,"y":568}],"time":2.2}])



debug: [INST] 2014-08-18 23:55:38 +0000 Debug: target.touch(__NSCFArray)



debug: [INST] 2014-08-18 23:55:40 +0000 Debug: evaluation finished

In the log you can see {“touch”:[{“x”:320,“y”:568} which looks suspicious. where x = 320 = 160 x 2 and Y is 284 x 2.

In both cases, double tap does not work as intended.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 32 (12 by maintainers)

Most upvoted comments

I just tried this in Java, and it worked for me. Please try it out and update your result:

public void doubleTap(int x, int y)
{
    TouchAction touch = new TouchAction(device()).press(x, y).perform().release().press(0,0).perform();
}

NOTE: the second press is on x-coord = 0, and y-coord = 0, based on the comment by “imurchie” above.

Yes, since the second is an offset from the first, if you offset 0, 0, it is the same point.

For the second, I’m not sure what the issue is. Instruments often doesn’t return anything, which makes Appium print that message.

On Wed, Aug 20, 2014 at 3:26 PM, glorylo notifications@github.com wrote:

I don’t understand what you mean by 0,0 on second press. You mean press x,y at the same point then if i press 0,0 it would work? I want to be able to double tap the same location.

In any case, case 1 does not work consistently due to command executed w/ no response error. I don’t know if this is instruments messing up or is there other ways to get around this.

info: <-- GET /wd/hub/session/d38dcbf3-0d60-4281-ba91-c3d0e62e8f99/window/current/size 200 929.627 ms - 98 {“status”:0,“value”:{“width”:320,“height”:568},“sessionId”:“d38dcbf3-0d60-4281-ba91-c3d0e62e8f99”}

debug: Socket data being routed. debug: Got result from instruments: {“status”:0,“value”:{“width”:320,“height”:568}} debug: Responding to client with success: {“status”:0,“value”:{“width”:320,“height”:568},“sessionId”:“d38dcbf3-0d60-4281-ba91-c3d0e62e8f99”} debug: Appium request initiated at /wd/hub/session/d38dcbf3-0d60-4281-ba91-c3d0e62e8f99/touch/perform debug: Request received with params: {“actions”:[{“action”:“tap”,“options”:{“x”:160,“y”:284,“count”:2}}]} debug: Pushing command to appium work queue: “target.touch([{"touch":[{"x":160,"y":284}],"time":0.2}])” debug: Sending command to instruments: target.touch([{“touch”:[{“x”:160,“y”:284}],“time”:0.2}]) debug: Sending command to instruments: target.touch([{“touch”:[{“x”:160,“y”:284}],“time”:0.2}])

info: --> POST /wd/hub/session/d38dcbf3-0d60-4281-ba91-c3d0e62e8f99/touch/perform {“actions”:[{“action”:“tap”,“options”:{“x”:160,“y”:284,“count”:2}}]}

debug: [INST] 2014-08-20 22:23:11 +0000 Debug: Got new command 70 from instruments: target.touch([{“touch”:[{“x”:160,“y”:284}],“time”:0.2}])

debug: [INST] 2014-08-20 22:23:11 +0000 Debug: evaluating target.touch([{“touch”:[{“x”:160,“y”:284}],“time”:0.2}])

debug: [INST] 2014-08-20 22:23:11 +0000 Debug: target.touch(__NSCFArray)

debug: [INST] 2014-08-20 22:23:12 +0000 Debug: evaluation finished

debug: [INST] 2014-08-20 22:23:12 +0000 Debug: Command executed without response

debug: [INST] 2014-08-20 22:23:12 +0000 Debug: Result is not protocol compliant, wrapping

debug: [INST] 2014-08-20 22:23:12 +0000 Debug: Running system command #71: /Applications/Appium 1.2.0.app/Contents/Resources/node/bin/node /Applications/Appium 1.2.0.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:“”}…

debug: Socket data received (25 bytes)

info: <-- POST /wd/hub/session/d38dcbf3-0d60-4281-ba91-c3d0e62e8f99/touch/perform 200 2125.116 ms - 74 {“status”:0,“value”:“”,“sessionId”:“d38dcbf3-0d60-4281-ba91-c3d0e62e8f99”}

debug: Socket data being routed. debug: Got result from instruments: {“status”:0,“value”:“”} debug: Responding to client with success: {“status”:0,“value”:“”,“sessionId”:“d38dcbf3-0d60-4281-ba91-c3d0e62e8f99”}

debug: Appium request initiated at /wd/hub/session/d38dcbf3-0d60-4281-ba91-c3d0e62e8f99/element

info: --> POST /wd/hub/session/d38dcbf3-0d60-4281-ba91-c3d0e62e8f99/element {“using”:“xpath”,“value”:“//UIAScrollView[1]/UIAImage[1]”}

debug: Request received with params: {“using”:“xpath”,“value”:“//UIAScrollView[1]/UIAImage[1]”} debug: Pushing command to appium work queue: “au.mainApp().getTreeForXML()” debug: Sending command to instruments: au.mainApp().getTreeForXML() debug: Sending command to instruments: au.mainApp().getTreeForXML()

debug: [INST] 2014-08-20 22:23:13 +0000 Debug: Got new command 71 from instruments: au.mainApp().getTreeForXML()

debug: [INST] 2014-08-20 22:23:13 +0000 Debug: evaluating au.mainApp().getTreeForXML()

debug: [INST] 2014-08-20 22:23:13 +0000 Debug: evaluation finished

debug: [INST] 2014-08-20 22:23:13 +0000 Debug: Result is not protocol compliant, wrapping

debug: [INST] 2014-08-20 22:23:13 +0000 Debug: Running system command #72: /Applications/Appium 1.2.0.app/Contents/Resources/node/bin/node /Applications/Appium 1.2.0.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:0,“value”:{“UIAApplication”:{“@”:{“name”:“POF”,“label”:“POF”,“value”:null,"do…

debug: Socket data received (7155 bytes)

— Reply to this email directly or view it on GitHub https://github.com/appium/appium/issues/3420#issuecomment-52854002.

Yes, subsequent values are being treated as offsets from the original.

What is in the server log for the first case?