I need to implement some complicated gesture. I need to press some element, move it to another element, hold 5 seconds(in this case some required context menu will be appeared), and release it.
TouchAction touchAction = new TouchAction((io.appium.java_client.android.AndroidDriver) driver);
touchAction.longPress(FirstElement, Duration.ofSeconds(15)).moveTo(endx,
endy).release().perform();
I’ve tried your one, but it works the same way as my one above.
And I need to do a wait action after move action and before a release. In the above example the wait action affects a move action only.
So I just see that element is moving faster or slowly, and no any waits before the release.
@aozolin give a try of idea to make third TINY move
new TouchAction((MobileDriver) driver).press(FirstElement).waitAction(Duration.ofMillis(duration)).moveTo(endx, endy).waitAction(Duration.ofMillis(duration)).release().perform();
// or
new TouchAction((MobileDriver) driver).press(FirstElement).waitAction(Duration.ofMillis(duration)).moveTo(endx, endy).waitAction(Duration.ofMillis(duration)).moveTo(minor_x, minor_y).release().perform();
@Aleksei, thank you. I’ve tried both options. The result is below:
When I use my code
TouchAction touchAction = new TouchAction((io.appium.java_client.android.AndroidDriver) driver);
touchAction.longPress(FirstElement, Duration.ofSeconds(15)).moveTo(endx,
endy).release().perform();
I see that fist element is pressed and it’s moving on the screen to another element, but it releases the hold without any waits, and context menu is not appeared.
When I use your options, for both the same behaviour - nothing just happens on the screen, no context menu appears at all.
A hacky way to make Appium hold after moving is:
Press el1 → Move to el2 → Keep move to el2 to hold with specific time → Move to el3 → Release & Perform