java-client: touchAction: longPress, moveTo, waitAction, release - doesn't work

Description

I need to implement following gesture. Press on some element on the screen, move it to another element, waiting for 5 seconds and release it.

Trying to use below touchAction: TouchAction touchAction = new TouchAction((AndroidDriver) driver); touchAction.longPress(FirstElement).moveTo(TwoElement.getCenter().x, TwoElement.getCenter().y).waitAction(Duration.ofMillis(15000)).release().perform(); But it doesn’t work. Nothing happens on the screen.

Environment

  • java client build version: 5.0.0-BETA9
  • Appium server: 1.7.1
  • Desktop OS/version used to run Appium if necessary: macOS 10.13.3
  • Mobile platform/version under test: Nexus 5X API 24, 7.0
  • Real device or emulator/simulator: emulator

Details

If I use below touch action: touchAction.longPress(FirstElement, Duration.ofMillis(15000)).moveTo(TwoElement.getCenter().x, TwoElement.getCenter().y).release().perform();

I see that required element is moving on the page, but it doesn’t wait before releasing.

Code To Reproduce Issue

TouchAction touchAction = new TouchAction((AndroidDriver) driver); touchAction.longPress(FirstElement).moveTo(TwoElement.getCenter().x, TwoElement.getCenter().y).waitAction(Duration.ofMillis(15000)).release().perform();

Link to Appium logs

https://gist.github.com/aozolin/86f7bba13f6951a5a0cf671a5c131485

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

In case anyone else has a similar problem and can’t find a working solution, check out this post on SO.

@Garreth210 You are missing the waitAction.

new TouchAction(driver).press(ElementOption.element(element1))
.waitAction(WaitOptions.waitOptions(Duration.ofSeconds(3))).moveTo(ElementOption.element(element2)).release().perform();    
  

Facing the same issue with latest java-client 6.1.0. TouchAction not working with AppiumDriver(driver). I am working on webview elements. Advise the way around this if you have any…

As latest java-client has deprecated use of most of Actions class implemented function, looking for a solution…