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.

LongPress doesn't work in Appium

See original GitHub issue

Just test the LongPress feature in Appium Mode…

        IWebElement element2 = fmyDriver.FindElement(By.Id("showcase_button"));
        TouchAction a2 = new TouchAction(fmyDriver);
        a2.LongPress(element2).Release();
        fmyDriver.PerformTouchAction(a2);

Error From Server:

info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“de123576-8235-4add-a3a1-08ef73adc694”} info: <-- POST /wd/hub/session/de123576-8235-4add-a3a1-08ef73adc694/element 200 4114.449 ms - 87 {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“de123576-8235-4add-a3a1-08ef73adc694”} info: --> POST /wd/hub/session/de123576-8235-4add-a3a1-08ef73adc694/touch/perform {“actions”:[{“action”:“longpress”,“options”:{“element”:“1”}},{“action”:“release”}]} info: [debug] Pushing command to appium work queue: [“element:getLocation”,{“elementId”:“1”}] info: [debug] Pushing command to appium work queue: [“element:getSize”,{“elementId”:“1”}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“1”}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“y”:1636,“x”:20},“status”:0} info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getSize”,“params”:{“elementId”:“1”}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: getSize info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“height”:132,“width”:265},“status”:0} error: Unhandled error: TypeError: Cannot read property ‘x’ of null at D:\Android\Appium\node_modules\appium\lib\devices\android\android-controller.js:1108:34 at Function..each..forEach (D:\Android\Appium\node_modules\appium\node_modules\underscore\underscore.js:153:9) at D:\Android\Appium\node_modules\appium\lib\devices\android\android-controller.js:1105:7 at D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:154:25 at [object Object].<anonymous> (D:\Android\Appium\node_modules\appium\lib\devices\android\android-controller.js:1096:7) at iterate (D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13) at D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25 at [object Object].<anonymous> (D:\Android\Appium\node_modules\appium\lib\devices\android\android-controller.js:1096:7) at iterate (D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13) at Object.async.eachSeries (D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:162:9) at [object Object].androidController.parseTouch (D:\Android\Appium\node_modules\appium\lib\devices\android\android-controller.js:1038:9) at [object Object].<anonymous> (D:\Android\Appium\node_modules\appium\lib\devices\android\android-controller.js:1020:12) at D:\Android\Appium\node_modules\appium\lib\devices\android\android-controller.js:954:13 at D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:251:17 at done (D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:132:19) at D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:32:16 at D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21 at Object.callback (D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:572:34) at next (D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:798:43) at D:\Android\Appium\node_modules\appium\node_modules\async\lib\async.js:32:16 at [object Object].exports.respond (D:\Android\Appium\node_modules\appium\lib\devices\common.js:28:9) at [object Object].<anonymous> (D:\Android\Appium\node_modules\appium\lib\devices\android\android.js:507:16) at [object Object].<anonymous> (D:\Android\Appium\node_modules\appium\lib\devices\android\uiautomator.js:95:9) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7) at readableAddChunk (_stream_readable.js:146:16) at Socket.Readable.push (_stream_readable.js:110:10) at TCP.onread (net.js:523:20) context: [POST /wd/hub/session {“desiredCapabilities”:{“app”:“D:\Android\APKSource\HPScan.apk”,“appPackage”:“com.hp.hpscanandcapture”,“appActivity”:“com.hp.hpscanandcapture.RootActivity”,“automationName”:“appium”,“platformName”:] info: <-- POST /wd/hub/session/de123576-8235-4add-a3a1-08ef73adc694/touch/perform - - ms - -

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
LayMuiTohcommented, Oct 31, 2018

I got it work, the doc link example https://appium.readthedocs.io/en/stable/en/commands/interactions/touch/long-press/ need an update

let el = await driver.elementByAccessibilityId(‘HoldToTalk’); let action = new wd.TouchAction(driver); action.longPress({el}); await action.perform(); await action.release();

0reactions
LayMuiTohcommented, Oct 31, 2018

I am using wd.js and getting this error: TypeError: Cannot read property ‘performTouchAction’ of undefined

  48 |     let action = new wd.TouchAction();
  49 |     action.longPress({el});
> 50 |     await action.perform(); 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Appium doesn't long press - Support
I am trying to long press in Java Appium, doesn't work Here is my code import java.net.MalformedURLException; import java.util.concurrent.
Read more >
How to do a long press on element in appium-android?
1 Answer 1 · First locate your element · Pass the x and y coordinates of the element in press WebElement ele =...
Read more >
Long Press and Release in Appium
Working solution with: Python 3.x, Appium 1.22.3-4, Mac M1. Long press on iOS can be achieve using snippet.
Read more >
How to Long Press Element in Appium - YouTube
Part 8 | Long Press | Appium Gestures | How to Long Press Element in Appium | Appium Java |. 471 views ·...
Read more >
longPress on Element not pressing on proper coordinates - ...
Strangely if I long press directly on coordinates, everything works properly. It doesn't seem a Java Client issue, because same version works ......
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