question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
mw00168commented, Jul 12, 2018

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

2reactions
saikrishna321commented, Jul 1, 2018

@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();    
  
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use TouchAction for press + move + hold + release ...
I've tried to do below touch action, as it looks more appropriate for my case, but it doesn't work at all. touchAction.longPress(FirstElement, ...
Read more >
appium long press and than move element(drag and drop) is ...
TouchAction action = new TouchAction(driver); action. ... waitAction will wait to complete longPress action and then moveTo action will perform.
Read more >
How to Use Touch Actions in Appium: Swipe Tap Touch
How to Use Touch Actions in Appium such as swipe, tap, press, ... long seconds) { new TouchAction(driver) .press(element(element)) .
Read more >
How to perform tap and Long Press On Element | Appium Tap
This video will help to learn practically What is Appium touch actions class In latest Appium version How to perform tap and long...
Read more >
Part 6 - Appium Latest Tutorials - Mobile Gestures - Android ...
Part 6 - Appium Latest Tutorials - Mobile Gestures - Android Touch Action - Tap - Long Press.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found