Swipe/press-moveTo are only pressing (ios)

I am trying to swipe an element in list from right to left (so that delete button is shown) but it keeps on clicking the element. I’ve triede:
new TouchAction(driver).swipe(middleX, middleY, -100, 0, 100);
new TouchAction(driver).press(middleX, middleY).waitAction(100).moveTo(-100, 0).release().perform();

@deedora77 depending on your platform you need to swipe differently. difference is in moveTo - it is relative or absolute. check - Swipe/Scroll best practice with Java-Client 5

if it not help provide little more info - iOS/Android? What are in appium logs? your appium server version, java-client version…

It’s for ios and I am using Appium v1.6.5. java client 2.1.0. Here are logs for using .swipe
79. line is start of swiping.
Problem is that swiping up/down works fine, but left/right doesn’t.

@deedora77 it will not work:

{"fromX":187,"fromY":101,"toX":87,"toY":101,"duration":0.1}[debug] 

try to increase from edge left/right - not from center.

{"fromX":370,"fromY":101,"toX":70,"toY":101,"duration":0.1}
Still clicking. It changes color on the click, I can see that, and then it doesn’t move. Though the same function works on switch button.

Please update your java client to latest, then try to remove the duration on waitTime:

new TouchAction(driver).press(startPoint, anchor).waitAction(Duration.ofMillis(0)).moveTo(endPoint - startPoint, 0).release().perform();

I’ve updated to 4.1.2 and it’s still not working.

Any time I’ve experienced this was because my coordinates were not correct. Possibly not useful to you, but a friendly reminder to check/think about them again.

1 Like

For me swipe up is also not working with appium 1.6.5 on iOS10.I tried with java client 5.0.0Beta9
Below is the code I tried.
Dimension size = driver.manage().window().getSize();
int startx = size.getWidth() / 2;
int starty = (int) (size.getHeight() * 0.8);
int endy = (int) (size.getHeight() * 0.2);
driver.swipe(startx, starty, startx, endy, 1000);

The same code used to work on appium 1.5.3 with iOS9.

@deedora77 can you please let me know how swipe up is working for you

new TouchAction(driver).press(startX, startY).waitAction(1000).moveTo(0, startY-endY).release().perform();
Should work. Appium documentation says that moveTo coordinates are relative to the current position.

Dragging from 100,100 to 200,200 can be achieved by:
.press(100,100) // Start at 100,100
.moveTo(100,100) // Increase X & Y by 100 each, ending up at 200,200

I can’t get swipe to swipe up.

I got the solution.
The below code is working fine on appium 1.6.5 with 4.0.0 java client.
Dimension size = driver.manage().window().getSize();
int startx = size.getWidth() / 2;
int starty = (int) (size.getHeight() * 0.8);
int endy = (int) (size.getHeight() * 0.2);
driver.swipe(startx, starty, startx, endy, 1000);