LongPress doesn't work in Appium
See original GitHub issueJust 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:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
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();
I am using wd.js and getting this error: TypeError: Cannot read property ‘performTouchAction’ of undefined