Curved swipe with press().moveTo().moveTo() not working on platformVersion 10.3

  • Appium 1.6.5
  • Programming language : Javascript
  • platformVersion: 10.3

Issue: Pressing + holding + moving an element along a circle is not working. Can someone take a look on my code.

Example code :

var caps = {
   platformName: 'iOS',
   platformVersion: '10.3',
   deviceName: 'iPhone 6s',
   app: webviewApp
}

async function main () {
  await driver.init(caps);

   await (new TouchAction(driver))
  .press({x: 200, y: 200})
  .moveTo({x: 5, y: 5})
  .moveTo({x: 7, y: 7})
  .moveTo({x: 5, y: 6})
  .release()
  .perform()

 await driver.quit();
 }

Absolute points are not supported int he latest versions for iOS, hence it needs to be relative points.
Refer this link. It should help you overcome your issue.

Hi,

thanks for the links. The sample code contains relative points. In the past it worked with UIAutomation and the corresponding versions 9.3 and below. But somehow it is not working with Xcuitest (iOS 10.3).

Can you check by adding waitAction() to the press.
like this:
press(screenWidth, screenHeight).waitAction(Duration.ofMillis(100))

thanks, for the fast reply.
I’ve got an error then: “TypeError: (intermediate value).press(…).waitAction is not a function”

My JavaScript-code is:

      await (new TouchAction(driver))
         .press({x: 200, y: 200})
         .waitAction(1000)
         .moveTo({x: 5, y: 5})
         .moveTo({x: 7, y: 7})
         .moveTo({x: 5, y: 6})
         .release()
         .perform()

i also tried it with wait(1000) instead of waitAction, then debug displays this information:

[debug] [XCUITest] Received the following touch action: press(options={"x":200,"y":200})-wait(options={"ms":1000})-moveTo(options={"x":5,"y":5})-moveTo(options={"x":7,"y":7})-moveTo(options={"x":5,"y":6})-release(options={})
[HTTP] <-- POST /wd/hub/session/8e6623db-7c99-447a-b050-67183fbadf37/touch/perform 501 4 ms - 702

Can you paste the entire log snippet for touch action command api?would be clear.

This is how i get my log:

[HTTP] --> POST /wd/hub/session/099e800b-8d64-4952-826f-975cb0474de3/touch/perform {"actions":[{"action":"press","options":{"x":187,"y":667}},{"action":"wait","options":{"ms":100}},{"action":"moveTo","options":{"x":0,"y":-534}},{"action":"release","options":{}}]}
[debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{"x":187,"y":667}},{"action":"wait","options":{"ms":100}},{"action":"moveTo","options":{"x":0,"y":-534}},{"action":"release","options":{}}],"099e800b-8d64-4952-826f-975cb0474de3"]
[debug] [XCUITest] Executing command 'performTouch'
[debug] [XCUITest] Received the following touch action: press(options={"x":187,"y":667})-wait(options={"ms":100})-moveTo(options={"x":0,"y":-534})-release(options={})
[debug] [XCUITest] Found matching gesture: drag
[debug] [JSONWP Proxy] Proxying [POST /wda/dragfromtoforduration] to [POST http://localhost:8100/session/C83B3E14-D653-4474-B774-70BC76ACD83B/wda/dragfromtoforduration] with body: {"fromX":187,"fromY":667,"toX":187,"toY":133,"duration":0.1}
[debug] [JSONWP Proxy] Got response with status 200: {"value":{},"sessionId":"C83B3E14-D653-4474-B774-70BC76ACD83B","status":0}
[debug] [MJSONWP] Responding to client with driver.performTouch() result: null
[HTTP] <-- POST /wd/hub/session/099e800b-8d64-4952-826f-975cb0474de3/touch/perform 200 3385 ms - 76

This is my log:

[Appium] New XCUITestDriver session created successfully, session 4ecff3ea-1c32-4497-98ad-36ee847e24e1 added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1504773736002 (10:42:16 GMT+0200 (CEST))
[debug] [MJSONWP] Responding to client with driver.createSession() result: {"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"deviceName":"iPhone 6s","platformName":"iOS","app":"/Users/Me/Desktop/automated/DrawPad.app","platformVersion":"10.3","udid":"XXX XXX XXX"}
[HTTP] <-- POST /wd/hub/session 200 17565 ms - 436
[HTTP] --> POST /wd/hub/session/4ecff3ea-1c32-4497-98ad-36ee847e24e1/touch/perform {"actions":[{"action":"press","options":{"x":200,"y":200}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":5,"y":5}},{"action":"moveTo","options":{"x":7,"y":7}},{"action":"moveTo","options":{"x":5,"y":6}},{"action":"release","options":{}}]}
[debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{"action":"press","options":{"x":200,"y":200}},{"action":"wait","options":{"ms":1000}},{"action":"moveTo","options":{"x":5,"y":5}},{"action":"moveTo","options":{"x":7,"y":7}},{"action":"moveTo","options":{"x":5,"y":6}},{"action":"release","options":{}}],"4ecff3ea-1c32-4497-98ad-36ee847e24e1"]
[debug] [XCUITest] Executing command 'performTouch'
[debug] [XCUITest] Received the following touch action: press(options={"x":200,"y":200})-wait(options={"ms":1000})-moveTo(options={"x":5,"y":5})-moveTo(options={"x":7,"y":7})-moveTo(options={"x":5,"y":6})-release(options={})
[HTTP] <-- POST /wd/hub/session/4ecff3ea-1c32-4497-98ad-36ee847e24e1/touch/perform 501 43 ms - 702

I don’t see much difference in the logs.
Can you tell me the java client version you are using? Also can you confirm that you run the above command in a Native context. I run it in a native context and works fine for me.

I’m using Javascript (Node.JS client).
On the last line of the log i’m getting an error with 501.

You have used only one moveTo() method. This is just a normal swipe.
[debug] [XCUITest] Received the following touch action: press(options={"x":187,"y":667})-wait(options={"ms":100})-moveTo(options={"x":0,"y":-534})-release(options={})

What i want to do is a curved swipe. Did you also tried with many moveTo() methods concatenated?

Hi,i also meet this problem with ios 10.3.
I can’t use press-wait-moveTo - moveTo-release to achieve gesture unlock.
can you solve this problem?
if so, could you tell me you suggestion? Thank you very much

http://appium.io/docs/en/writing-running-appium/ios/ios-xctest-mobile-gestures/index.html#mobile-dragFromToForDuration