question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:32 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
luonglnecommented, Mar 2, 2015

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.

1reaction
imurchiecommented, Aug 20, 2014

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Touch Accommodations with your iPhone, iPad, iPod ...
Touch Accommodations changes how the screen on your device responds to taps, swipes, and other gestures.
Read more >
Touch Perform
'Touch Perform' works similarly to the other singular touch interactions, except that this allows you to chain together more than one touch action...
Read more >
9 Audio-Based Feedback Techniques for Teaching ...
tasks for single-stroke, multistroke, and multitouch gestures using the ... and multifinger tap, double tap, tap and hold, and directional drag and swipes....
Read more >
Designing for Touch
This is an sample chapter from Josh Clark's book Designing for Touch. 2015, A Book Apart. Chapter 4: Gestures. Cover: Designing for Touch...
Read more >
Using Touch Events - Web APIs | MDN
A multi-touch interaction starts when a finger (or stylus) first touches the contact surface. Other fingers may subsequently touch the surface ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found