Performing longpress function is throwing error as Original error: -[NSNull doubleValue]: unrecognized selector sent to instance 0x1011f4d80

Hi,

I tried to perform longpress action in iOS app…but getting the error as

intelliJ log:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: -[NSNull doubleValue]: unrecognized selector sent to instance 0x1011f4d80

(
0 CoreFoundation 0x0000000100fccd85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000100a40deb objc_exception_throw + 48
2 CoreFoundation 0x0000000100fd5d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000100f1bcfa forwarding + 970
4 CoreFoundation 0x0000000100f1b8a8 _CF_forwarding_prep_0 + 120
5 WebDriverAgentLib 0x000000010fb87ad9 +[FBElementCommands handleDragCoordinate:] + 729
6 WebDriverAgentLib 0x000000010fb69c73 -[FBRoute_TargetAction mountRequest:intoResponse:] + 179
7 WebDriverAgentLib 0x000000010fb61524 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 548
8 RoutingHTTPServer 0x000000010fc06c18 -[RoutingHTTPServer handleRoute:withRequest:response:] + 136
9 RoutingHTTPServer 0x000000010fc074fa __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 47
10 libdispatch.dylib 0x0000000103b403d7 _dispatch_client_callout + 8
11 libdispatch.dylib 0x0000000103b2be2f _dispatch_barrier_sync_f_slow_invoke + 65
12 libdispatch.dylib 0x0000000103b403d7 _dispatch_client_callout + 8
13 libdispatch.dylib 0x0000000103b2ae5d _dispatch_main_queue_callback_4CF + 714
14 CoreFoundation 0x0000000100f260f9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
15 CoreFoundation 0x0000000100ee7b99 _CFRunLoopRun + 2073
16 CoreFoundation 0x0000000100ee70f8 CFRunLoopRunSpecific + 488
17 Foundation 0x000000010062aa31 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 267
18 Foundation 0x00000001006bdfe1 -[NSRunLoop(NSRunLoop) run] + 74
19 WebDriverAgentLib 0x000000010fb60503 -[FBWebServer startServing] + 211
20 WebDriverAgentRunner 0x000000010cd98254 -[UITestingUITests testRunner] + 100
21 CoreFoundation 0x0000000100eb55cc invoking
+ 140
22 CoreFoundation 0x0000000100eb541e -[NSInvocation invoke] + 286
23 XCTest 0x00000001004b68e2 __24-[XCTestCase invokeTest]_block_invoke_2 + 491
24 XCTest 0x00000001004f4f62 -[XCTestContext performInScope:] + 190
25 XCTest 0x00000001004b66e4 -[XCTestCase invokeTest] + 254
26 XCTest 0x00000001004b6fb2 -[XCTestCase performTest:] + 565
27 XCTest 0x00000001004b4078 __27-[XCTestSuite performTest:]_block_invoke + 300
28 XCTest 0x00000001004b3c68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
29 XCTest 0x00000001004b3e4e -[XCTestSuite performTest:] + 214
30 XCTest 0x00000001004b4078 __27-[XCTestSuite performTest:]_block_invoke + 300
31 XCTest 0x00000001004b3c68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
32 XCTest 0x00000001004b3e4e -[XCTestSuite performTest:] + 214
33 XCTest 0x00000001004b4078 __27-[XCTestSuite performTest:]_block_invoke + 300
34 XCTest 0x00000001004b3c68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
35 XCTest 0x00000001004b3e4e -[XCTestSuite performTest:] + 214
36 XCTest 0x0000000100500a86 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
37 XCTest 0x00000001004c2f27 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 574
38 XCTest 0x0000000100500925 -[XCTTestRunSession runTestsAndReturnError:] + 281
39 XCTest 0x000000010049ea50 -[XCTestDriver runTestsAndReturnError:] + 254
40 XCTest 0x00000001004f886e _XCTestMain + 559
41 CoreFoundation 0x0000000100ef22ec CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12
42 CoreFoundation 0x0000000100ee7f75 __CFRunLoopDoBlocks + 341
43 CoreFoundation 0x0000000100ee76d2 __CFRunLoopRun + 850
44 CoreFoundation 0x0000000100ee70f8 CFRunLoopRunSpecific + 488
45 GraphicsServices 0x0000000103087ad2 GSEventRunModal + 161
46 UIKit 0x0000000101382f09 UIApplicationMain + 171
47 XCTRunner 0x000000010042388b XCTRunner + 6283
48 libdyld.dylib 0x0000000103b6f92d start + 1
49 ??? 0x0000000000000005 0x0 + 5
) (WARNING: The server did not provide any stacktrace information)

Appium log:
[HTTP] <-- POST /wd/hub/session/e5a42669-8de9-446f-9ea6-517cafff0c32/timeouts 200 2 ms - 76
[HTTP] --> POST /wd/hub/session/e5a42669-8de9-446f-9ea6-517cafff0c32/touch/perform {“actions”:[{“action”:“longPress”,“options”:{“element”:“84DA9A5E-4F41-4622-B85C-124AB98105B2”}},{“action”:“moveTo”,“options”:{“element”:“2DD4E656-BE1C-4D0D-8FDF-28FD76E87F1E”}},{“action”:“release”,“options”:{}}]}
[MJSONWP] Calling AppiumDriver.performTouch() with args: [[{“action”:“longPress”,“options”:{“element”:“84DA9A5E-4F41-4622-B85C-124AB98105B2”}},{“action”:“moveTo”,“options”:{“element”:“2DD4E656-BE1C-4D0D-8FDF-28FD76E87F1E”}},{“action”:“release”,“options”:{}}],“e5a42669-8de9-446f-9ea6-517cafff0c32”]
[XCUITest] Executing command ‘performTouch’
[XCUITest] Received the following touch action: longPress(options={“element”:“84DA9A5E-4F41-4622-B85C-124AB98105B2”})-moveTo(options={“element”:“2DD4E656-BE1C-4D0D-8FDF-28FD76E87F1E”})-release(options={})
[XCUITest] Found matching gesture: drag
[JSONWP Proxy] Proxying [GET /element/84DA9A5E-4F41-4622-B85C-124AB98105B2/rect] to [GET http://localhost:8100/session/372A3C74-42F6-4765-88CE-5134CA5C30A1/element/84DA9A5E-4F41-4622-B85C-124AB98105B2/rect] with no body
[JSONWP Proxy] Got response with status 200: “{\n “value” : {\n “y” : 226,\n “x” : 340,\n “width” : 413,\n “height” : 44\n },\n “sessionId” : “372A3C74-42F6-4765-88CE-5134CA5C30A1”,\n “status” : 0\n}”
[JSONWP Proxy] Proxying [POST /wda/dragfromtoforduration] to [POST http://localhost:8100/session/372A3C74-42F6-4765-88CE-5134CA5C30A1/wda/dragfromtoforduration] with body: {“fromX”:546.5,“fromY”:248,“toX”:0,“toY”:0,“duration”:null}
[JSONWP Proxy] Got response with status 200: {“value”:"-[NSNull doubleValue]: unrecognized selector sent to instance 0x1011f4d80\n\n(\n\t0 CoreFoundation 0x0000000100fccd85 __exceptionPreprocess + 165\n\t1 libobjc.A.dylib 0x0000000100a40deb objc_exception_throw + 48\n\t2 CoreFoundation 0x0000000100fd5d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205\n\t3 CoreFoundation 0x0000000100f1bcfa forwarding + 970\n\t4 CoreFoundation 0x0000000100f1b8a8 _CF_forwarding_prep_0 + 120\n\t5 WebDriverAgentLib 0x000000010fb87ad9 +[FBElementCommands handleDragCoordinate:] + 729\n\t6 WebDriverAgentLib 0x000000010fb69c73 -[FBRoute_TargetAction mountRequest:intoResponse:] + 179\n\t7 WebDriverAgentLib 0x000000010fb61524 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 548\n\t8 RoutingHTTPServer 0x000000010fc06c18 -[RoutingHTTPServer handleRoute:withRequest:resp…
[HTTP] <-- POST /wd/hub/session/e5a42669-8de9-446f-9ea6-517cafff0c32/touch/perform 500 160 ms - 5330
[HTTP] --> DELETE /wd/hub/session/e5a42669-8de9-446f-9ea6-517cafff0c32 {}
[MJSONWP] Calling AppiumDriver.deleteSession() with args: [“e5a42669-8de9-446f-9ea6-517cafff0c32”]
[BaseDriver] Event ‘quitSessionRequested’ logged at 1497872052696 (17:04:12 GMT+0530 (IST))
[JSONWP Proxy] Proxying [DELETE /session/e5a42669-8de9-446f-9ea6-517cafff0c32] to [DELETE http://localhost:8100/session/372A3C74-42F6-4765-88CE-5134CA5C30A1] with no body
[JSONWP Proxy] Got response with status 200: “{\n “value” : {\n\n },\n “sessionId” : “D27B640A-2DD8-4BBD-BF8D-27FAEC7F714B”,\n “status” : 0\n}”
[XCUITest] Shutting down sub-processes
[XCUITest] Shutting down xcodebuild process (pid 9144)
[XCUITest] xcodebuild exited with code ‘null’ and signal ‘SIGTERM’
[XCUITest] Found WDA derived data folder: ‘/Users/vijaygvb/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy’
[XCUITest] Setting ‘755’ permissions to ‘/Users/vijaygvb/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/Attachments’ folder
[XCUITest] Found WDA derived data folder: ‘/Users/vijaygvb/Library/Developer/Xcode/DerivedData/WebDriverAgent-folfazwwukpzfkegdblpnfuwlvfn’
[XCUITest] Setting ‘755’ permissions to ‘/Users/vijaygvb/Library/Developer/Xcode/DerivedData/WebDriverAgent-folfazwwukpzfkegdblpnfuwlvfn/Logs/Test/Attachments’ folder
[XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on.
[iOSLog] Stopping iOS log capture
[Appium] Removing session e5a42669-8de9-446f-9ea6-517cafff0c32 from our master session list
[BaseDriver] Event ‘quitSessionFinished’ logged at 1497872053062 (17:04:13 GMT+0530 (IST))
[MJSONWP] Received response: null
[MJSONWP] But deleting session, so not returning
[MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/e5a42669-8de9-446f-9ea6-517cafff0c32 200 366 ms - 76

What would be the mistake…?

you did not write your problematic the test code, appium version, client version, simulator/real device, iOS test version and so on… :slight_smile:

hope it is like/similar:

// java
new TouchAction((MobileDriver) driver).longPress(el).perform();

Oops sorry for missing it…:frowning:

My code used the page object model framework…
code snippet:
@iOSFindBy(xpath = “//XCUIElementTypeTable/XCUIElementTypeCell/XCUIElementTypeStaticText”)
public List editableSections;
TouchAction t = new TouchAction(driver);
t.longPress(editableSections.get(5)).moveTo(editableSections.get(7)).release().perform();

The following is my version of appium and details of device

[Appium] Welcome to Appium v1.6.5
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions {}
[MJSONWP] Calling AppiumDriver.getSessions() with args: []
[MJSONWP] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 5 ms - 40
[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“app”:"/Users/vijaygvb/Desktop/Automation/automation-testing/mobile/src/test/java/com/mcclatchyinteractive/mobility/apps/phoenix-reader.app",“automationName”:“XCUITest”,“device”:“ios”,“deviceName”:“iPad Air 2”,“platformName”:“iOS”,“platformVersion”:“9.3”,“realDeviceLogger”:"/usr/local/lib/node_modules/deviceconsole/deviceconsole",“xcodeConfigfile”:"/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Config.xcconfig",“newCommandTimeout”:0,“connectHardwareKeyboard”:true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:"/Users/vijaygvb/Desktop/Automation/automation-testing/mobile/src/test/java/com/mcclatchyinteractive/mobility/apps/phoenix-reader.app",“automationName”:“XCUITest”,“device”:“ios”,“deviceName”:“iPad Air 2”,“platformName”:“iOS”,“platformVersion”:“9.3”,“realDeviceLogger”:"/usr/local/lib/node_modules/deviceconsole/deviceconsole",“xcodeConfigfile”:"/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Config.xcconfig",“newCommandTimeout”:0,“connectHardwareKeyboard”:true},null,null]
[BaseDriver] Event ‘newSessionRequested’ logged at 1497873073182 (17:21:13 GMT+0530 (IST))
[Appium] Creating new XCUITestDriver (v2.30.0) session
[Appium] Capabilities:
[Appium] app: ‘/Users/vijaygvb/Desktop/Automation/automation-testing/mobile/src/test/java/com/mcclatchyinteractive/mobility/apps/phoenix-reader.app’
[Appium] automationName: ‘XCUITest’
[Appium] device: ‘ios’
[Appium] deviceName: ‘iPad Air 2’
[Appium] platformName: ‘iOS’
[Appium] platformVersion: ‘9.3’
[Appium] realDeviceLogger: ‘/usr/local/lib/node_modules/deviceconsole/deviceconsole’
[Appium] xcodeConfigfile: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Config.xcconfig’
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[XCUITest] XCUITestDriver version: 2.30.0

try another way:

t.press(editableSections.get(5)).waitAction(Duration.ofSeconds(2)).moveTo(editableSections.get(7)).release().perform();

also make sure that “editableSections.get(5)” + “editableSections.get(7)” are available.

okay @Aleksei thank you…I could get the values inside it …Let me try the other way which you said

Now getting error like its not supported…

code snippet:
t.longPress(editableSections.get(5)).waitAction(2000).moveTo(editableSections.get(7)).waitAction(2000).release().perform();

error:
org.openqa.selenium.WebDriverException: Support for longPress(options={“element”:“B5966CF8-FF78-40AE-98CB-C2602DA1A138”})-wait(options={“ms”:2000})-moveTo(options={“element”:“870E9808-C227-4EF9-9765-CEA50C58FAE5”})-wait(options={“ms”:2000})-release(options={}) gesture is not implemented. Try to use “mobile: *” interface to workaround the issue. Only these gestures are supported:
doubleTap: doubletap
tap(options={“count”:2})
tap: tap
tap-release
press-release
longPress: longpress
longpress-release
press-wait-release
drag: press-wait-moveTo-release
longpress-moveTo-release
scroll: press-moveTo-release

i gave another code :slight_smile:

Hey thanks @Aleksei Long press alone is working but how to move it to a different place? sorry to bother you…please help me…

hey i got the answer its working now…

code snippet:

t.press(editableSections.get(5)).waitAction(2000).moveTo(editableSections.get(7)).release().perform();

@Aleksei Thank you