How to swipe in Appium 1.6.4-beta?

Swipe just does not work for me at all in v 1.6.4-beta, java client 5.0.0-BETA4, iOS 10 real device.

I am using the following options to swipe but get the same error:
Option 1: driver.swipe(startX, startY, endX, endY, 1000);
Option 2: new TouchAction((MobileDriver) appiumDriver).press(startX, startY).waitAction(100)
.moveTo(endX - startX, endY - startY).release().perform();
Option 3: Using mobile: swipe

but am getting this
Error:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unhandled endpoint: /session/7D5284A9-D24F-4166-A995-BF4A2AD42D2C/wda/dragfromtoforduration – http://localhost:8100/ with parameters {
wildcards = (
“session/7D5284A9-D24F-4166-A995-BF4A2AD42D2C/wda/dragfromtoforduration”
);
}

Log:
[debug] [JSONWP Proxy] Proxying [POST /wda/dragfromtoforduration] to [POST http://localhost:8100/session/7D5284A9-D24F-4166-A995-BF4A2AD42D2C/wda/dragfromtoforduration] with body: {“fromX”:153,“fromY”:512,“toX”:768,“toY”:512,“duration”:1}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:“Unhandled endpoint: /session/7D5284A9-D24F-4166-A995-BF4A2AD42D2C/wda/dragfromtoforduration – http://localhost:8100/ with parameters {\n wildcards = (\n “session/7D5284A9-D24F-4166-A995-BF4A2AD42D2C/wda/dragfromtoforduration”\n );\n}”,“sessionId”:“7D5284A9-D24F-4166-A995-BF4A2AD42D2C”,“status”:1}
[HTTP] <-- POST /wd/hub/session/39b9a9c5-8e73-480b-8b9e-47fdff886fd7/touch/perform 500 14 ms - 424

@dr12782 please file a ticket under https://github.com/appium/appium

Even I’m facing same issue but more tickets on same problem can increase the priority to get it fixed sooner :slight_smile:

1.6.4-beta, Simulator - zero problem e.g. with:

point_1 = view1.getCenter();
point_2 = view2.getCenter();
((IOSDriver) driver).swipe(point_1.getX(), point_1.getY(), point_2.getX(), point_2.getY(), 1000);

I don’t think that opening more tickets for the same issue will get a fix sooner, it will only clutter the list of issues and make everything slower. I’d say adding a comment to the existing issue with more details on how to re-create the issue would be best.

Are you guys on iOS or Android? I am still able to swipe in 1.6.4 using the at-some-point deprecated .swipe() command that Aleksei mentions.

I’m trying to swipe on iOS Simulator but it’s not full swipe but partial swipe

I tried it on a real iOS device and not a simulator.
@Aleksei, I had tried the driver.swipe(x,y,x,y,time) option too and got the same above mentioned error.
@Brian_Watson, did it work for you on a real iOS device?

Anything to do with this.
Could help you @dr12782
https://github.com/appium/appium/issues/6257

So I have not tried on a real iOS device yet. But just tried running one of my tests that does a swipe of a table view grid. The machine has Appium 1.6.4-beta, iPad simulator running iOS 10.2, java-client-5.0.0.BETA4 and it worked for me. Here is the “scroll” method I created for my generic AutoControl class which represents a control or element on a page…

public void scroll(int startPercent, int endPercent, int duration) {
    Rectangle rect = getRect();

    int starty = rect.y + (int) (rect.height * (startPercent * .01));
    int endy = rect.y + (int) (rect.height * (endPercent * .01));
    int startx = rect.x + (rect.width / 2);

    swipe(startx, starty, startx, endy, 3000);
}
private void swipe(int startx, int starty, int endx, int endy, int duration) {
    log.info("    [Swipe] From: (" + startx + ", " + starty +")  To: (" + endx + ", " + endy + ")");
    appiumDriver.swipe(startx, starty, endx, endy, duration);
}

The output in the Appium log shows…

2017-03-13 22:41:07:685 - [HTTP] --> POST /wd/hub/session/abe107e8-cde1-4b2b-a118-c730832f00bd/touch/perform {"actions":[{"action":"press","options":{"x":210,"y":847}},{"action":"wait","options":{"ms":3000}},{"action":"moveTo","options":{"x":0,"y":-89}},{"action":"release","options":{}}]}
2017-03-13 22:41:22:907 - [HTTP] <-- POST /wd/hub/session/abe107e8-cde1-4b2b-a118-c730832f00bd/touch/perform 200 15222 ms - 74

And my table view rows correctly scroll for me. Oddly, it seems to take 15 seconds to do the swipe looking at the logged timestamps. But I only specified a wait time of 3 seconds. So not sure why it’s so slow.

@dr12782
real device - did not try. mine config latest appium 1.6.4 and java client 5.0.0-BETA4

Solved the issue. It works perfectly fine now.
Thanks to @bgalperin who had commented in this link

Steps:

  1. npm uninstall -g appium
  2. npm install -g [email protected]
  3. Open WebDriverAgent project in Xcode and clean it
  4. Make sure this project is properly signed by your development team
  5. Run test (it will automatically rebuild WDA)

I tried both Option#1 and Option#2 (mentioned in the first thread) and it worked fine.

Thanks @Brian_Watson, @Aleksei, @Mayuresh_Shirodkar and @VikramVI for your time and suggestions.

Thanks @dr12782 for confirmation and detailed steps to fix. This will definitely helps others as well.

Regards,
Vikram

This is still an issue for me.

I am using appium1.6.4-beta, the latest xcuitest driver, and I am running this on an iPhone 7 plus.

I am trying to swipe and it is taking around 3-5 minutes to get it to swipe.

[HTTP] --> POST /wd/hub/session/4518571d-c2be-4e62-992b-3805df9c0c5f/touch/perform {“sessionId”:“4518571d-c2be-4e62-992b-3805df9c0c5f”,“actions”:[{“action”:“press”,“options”:{“y”:10,“x”:10,“element”:“D05272EF-D7DC-4882-8350-A5FCAB65E133”}},{“action”:“wait”,“options”:{“ms”:500}},{“action”:“moveTo”,“options”:{“y”:10,“x”:10,“element”:“075C8A70-D6FC-4249-B9E9-7A1FF8951A61”}},{“action”:“release”,“options”:{}}]}
[debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{“action”:“press”,“options”:{“y”:10,“x”:10,“element”:“D05272EF-D7DC-4882-8350-A5FCAB65E133”}},{“action”:“wait”,“options”:{“ms”:500}},{“action”:“moveTo”,“options”:{“y”:10,“x”:10,“element”:“075C8A70-D6FC-4249-B9E9-7A1FF8951A61”}},{“action”:“release”,“options”:{}}],“4518571d-c2be-4e62-992b-3805df9c0c5f”]
[debug] [XCUITest] Executing command ‘performTouch’
[debug] [XCUITest] Received the following touch action: press(options={“y”:10,“x”:10,“element”:“D05272EF-D7DC-4882-8350-A5FCAB65E133”})-wait(options={“ms”:500})-moveTo(options={“y”:10,“x”:10,“element”:“075C8A70-D6FC-4249-B9E9-7A1FF8951A61”})-release(options={})
[debug] [XCUITest] Found matching gesture: drag
[debug] [XCUITest] Setting custom timeout to 450000 ms for “getElementRect” command
[debug] [JSONWP Proxy] Proxying [GET /element/D05272EF-D7DC-4882-8350-A5FCAB65E133/rect] to [GET http://localhost:8100/session/A34F7D40-6A84-4D1B-B05A-B1D10E16D60B/element/D05272EF-D7DC-4882-8350-A5FCAB65E133/rect] with no body
[debug] [JSONWP Proxy] Got response with status 200: “{\n “value” : {\n “y” : 263,\n “x” : 145,\n “width” : 124,\n “height” : 124\n },\n “sessionId” : “A34F7D40-6A84-4D1B-B05A-B1D10E16D60B”,\n “status” : 0\n}”
[debug] [XCUITest] Setting custom timeout to 450000 ms for “getElementRect” command
[debug] [JSONWP Proxy] Proxying [GET /element/075C8A70-D6FC-4249-B9E9-7A1FF8951A61/rect] to [GET http://localhost:8100/session/A34F7D40-6A84-4D1B-B05A-B1D10E16D60B/element/075C8A70-D6FC-4249-B9E9-7A1FF8951A61/rect] with no body
[debug] [JSONWP Proxy] Got response with status 200: “{\n “value” : {\n “y” : 687,\n “x” : 0,\n “width” : 414,\n “height” : 50\n },\n “sessionId” : “A34F7D40-6A84-4D1B-B05A-B1D10E16D60B”,\n “status” : 0\n}”
[debug] [XCUITest] Setting custom timeout to 450000 ms for “undefined” command
[debug] [JSONWP Proxy] Proxying [POST /wda/dragfromtoforduration] to [POST http://localhost:8100/session/A34F7D40-6A84-4D1B-B05A-B1D10E16D60B/wda/dragfromtoforduration] with body: {“fromX”:155,“fromY”:273,“toX”:10,“toY”:697,“duration”:0.5}

It just sits here for a couple of minutes, does the action, and then sits for another couple of minutes… I added the 45000 to try to tell wda to return sooner but it is not doing anything.

I have cleaned the WebDriverAgent and rebuilt the debug build but it did not make it faster.

Any thoughts would really be appreciated.

Which version of the Java client are you using? Can you try once with the latest version and see?

I am actually using the python client, so this question may not apply to this thread.

watch it!!