startX = 188
startY = 86
endX = 94
endY = 86
xOffset = endX - startX // result: -94
yOffset = endY - startY // result: 0
With swipe
driver.swipe(startX, startY, xOffset, yOffset, 800);
will move the element to left.(Works just fine)
Please see Server log for swipe
But with TouchAction
like below:
new TouchAction(driver).press(startX, startY).waitAction(800).moveTo(xOffset, yOffset).release().perform();
will only do long press.
Please see Server log for TouchAction
Compare the server logs from driver.swipe and TouchAction you can see:
In driver.swipe:
{"fromX":188,"fromY":86,"toX":-94,"toY":0,"duration":0.8}
But in the TouchAction will post like:
{"fromX":188,"fromY":86,"toX":94,"toY":0,"duration":0.8}
which toX is positive instead of negative in TouchAction
Could anyone help to explain what is the reason that cause the different output please? And how to fix it? Thanks