AppiumTestDistribution / appium-wait-plugin

Plugin to automatically manage all element waits and enables to write wait-free appium tests.
MIT License
60 stars 10 forks source link

iOS TypeError: Cannot read properties of undefined (reading 'jwproxy') #80

Closed itkhanz closed 1 year ago

itkhanz commented 1 year ago

Hi, I was working with appium-wait-plugin for past few days and it was working fine but today to my surprise it stopped working. I even restarted the appium server and simulator with fullReset but it did not solve the issue. Further i also ran the following commands as suggested on some forums to clear any other sessions running.

adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
adb uninstall io.appium.unlock
adb uninstall io.appium.settings

But trying all of these did not solve the issue. If I run my script without the wait plugin, then it works successfully. I have the following environment setup:

Java Client Test Code for UIKitCatalogApp:

By activityIndicators = AppiumBy.accessibilityId("Activity Indicators");
driver.findElement(activityIndicators).click();

i get the following error at findElement call: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot read properties of undefined (reading 'jwproxy')

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot read properties of undefined (reading 'jwproxy')
Build info: version: '4.9.1', revision: 'eb2032df7f'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.16', java.version: '11.0.2'
Driver info: io.appium.java_client.ios.IOSDriver
Command: [e377915a-b4f4-4cce-a62f-4a151408e927, findElement {using=accessibility id, value=Activity Indicators}]
Capabilities {appium:app: /Users/xxxx/dev/appium/Appi..., appium:autoAcceptAlerts: true, appium:automationName: XCUITest, appium:bundleId: com.example.apple-samplecod..., appium:databaseEnabled: false, appium:deviceName: iPhone 14, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: false, appium:newCommandTimeout: 180, appium:takesScreenshot: true, appium:udid: 6B4B083D-5F01-4B6D-88D1-175..., appium:webStorageEnabled: false, platformName: IOS}
Session ID: e377915a-b4f4-4cce-a62f-4a151408e927

    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)
    at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)
    at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:193)
    at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    at org.openqa.selenium.remote.ElementLocation$ElementFinder$2.findElement(ElementLocation.java:162)
    at org.openqa.selenium.remote.ElementLocation.findElement(ElementLocation.java:66)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
    at com.itkhanz.practice.drivercommands.ios.IOSAppInteractions.test_terminateApp(IOSAppInteractions.java:40)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
    at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:664)
    at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:227)
    at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
    at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:957)
    at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:200)
    at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148)
    at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
    at org.testng.TestRunner.privateRun(TestRunner.java:848)
    at org.testng.TestRunner.run(TestRunner.java:621)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:437)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:397)
    at org.testng.SuiteRunner.run(SuiteRunner.java:336)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1280)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1200)
    at org.testng.TestNG.runSuites(TestNG.java:1114)
    at org.testng.TestNG.run(TestNG.java:1082)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105)

Here are the appium server logs. I am also attaching the logs. appiumlogs.txt

xxxx@w4deumsy9000289 ~ % appium --use-drivers=xcuitest --use-plugins=element-wait 
[Appium] Attempting to load plugin element-wait...
[debug] [Appium] Requiring plugin at /Users/xxxx/.appium/node_modules/appium-wait-plugin
[Appium] Welcome to Appium v2.0.0-beta.71 (REV 552db40622bb7a82d9c6d67d2d6bcf3694b47e30)
[Appium] Non-default server args:
[Appium] {
[Appium]   useDrivers: [
[Appium]     'xcuitest'
[Appium]   ],
[Appium]   usePlugins: [
[Appium]     'element-wait'
[Appium]   ]
[Appium] }
[Appium] Attempting to load driver xcuitest...
[debug] [Appium] Requiring driver at /Users/xxxx/.appium/node_modules/appium-xcuitest-driver
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] Available drivers:
[Appium]   - uiautomator2@2.25.2 (automationName 'UiAutomator2')
[Appium]   - xcuitest@4.30.2 (automationName 'XCUITest')
[Appium]   - espresso@2.23.1 (automationName 'Espresso')
[Appium]   - safari@3.3.3 (automationName 'Safari')
[Appium]   - gecko@1.1.9 (automationName 'Gecko')
[Appium]   - chromium@1.1.18 (automationName 'Chromium')
[Appium] Available plugins:
[Appium]   - element-wait@1.5.0 (ACTIVE)
[Appium]   - gestures@2.1.0
[debug] [HTTP] Request idempotency key: 00c5e8e1-0d1a-4a58-ba40-3e2208ec4cc1
[HTTP] --> POST /session
[HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:app":"/Users/xxxx/dev/appium/Appium-OC/src/main/resources/apps/UIKitCatalog-iphonesimulator.app","appium:autoAcceptAlerts":true,"appium:automationName":"XCUITest","appium:bundleId":"com.example.apple-samplecode.UICatalog","appium:deviceName":"iPhone 14","appium:newCommandTimeout":180,"appium:udid":"6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F","platformName":"IOS"}}}
[debug] [AppiumDriver@aaa2] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"appium:app":"/Users/xxxx/dev/appium/Appium-OC/src/main/resources/apps/UIKitCatalog-iphonesimulator.app","appium:autoAcceptAlerts":true,"appium:automationName":"XCUITest","appium:bundleId":"com.example.apple-samplecode.UICatalog","appium:deviceName":"iPhone 14","appium:newCommandTimeout":180,"appium:udid":"6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F","platformName":"IOS"}}]
[AppiumDriver@aaa2] Plugins which can handle cmd 'createSession': element-wait
[AppiumDriver@aaa2] Plugin element-wait is now handling cmd 'createSession'
[AppiumDriver@aaa2] Executing default handling behavior for command 'createSession'
[debug] [AppiumDriver@aaa2] Event 'newSessionRequested' logged at 1687245918116 (09:25:18 GMT+0200 (Central European Summer Time))
[Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'IOS'
[Appium] The 'xcuitest' driver was installed and matched caps.
[Appium] Will require it at /Users/xxxx/.appium/node_modules/appium-xcuitest-driver
[debug] [Appium] Requiring driver at /Users/xxxx/.appium/node_modules/appium-xcuitest-driver
[AppiumDriver@aaa2] Appium v2.0.0-beta.71 creating new XCUITestDriver (v4.30.2) session
[AppiumDriver@aaa2] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@aaa2] Appium's BaseDriver version is 9.3.10
[AppiumDriver@aaa2] XCUITestDriver's BaseDriver version is 9.3.10
[debug] [XCUITestDriver@4bd3] Creating session with W3C capabilities: {
[debug] [XCUITestDriver@4bd3]   "alwaysMatch": {
[debug] [XCUITestDriver@4bd3]     "platformName": "IOS",
[debug] [XCUITestDriver@4bd3]     "appium:app": "/Users/xxxx/dev/appium/Appium-OC/src/main/resources/apps/UIKitCatalog-iphonesimulator.app",
[debug] [XCUITestDriver@4bd3]     "appium:autoAcceptAlerts": true,
[debug] [XCUITestDriver@4bd3]     "appium:automationName": "XCUITest",
[debug] [XCUITestDriver@4bd3]     "appium:bundleId": "com.example.apple-samplecode.UICatalog",
[debug] [XCUITestDriver@4bd3]     "appium:deviceName": "iPhone 14",
[debug] [XCUITestDriver@4bd3]     "appium:newCommandTimeout": 180,
[debug] [XCUITestDriver@4bd3]     "appium:udid": "6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F"
[debug] [XCUITestDriver@4bd3]   },
[debug] [XCUITestDriver@4bd3]   "firstMatch": [
[debug] [XCUITestDriver@4bd3]     {}
[debug] [XCUITestDriver@4bd3]   ]
[debug] [XCUITestDriver@4bd3] }
[XCUITestDriver@4bd3] 'platformVersion' capability ('undefined') is not a valid version number. Consider fixing it or be ready to experience an inconsistent driver behavior.
[XCUITestDriver@4bd3 (e377915a)] Session created with session id: e377915a-b4f4-4cce-a62f-4a151408e927
[debug] [XCUITest] Current user: 'xxxx'
[debug] [XCUITestDriver@4bd3 (e377915a)] Available devices: 
[debug] [XCUITestDriver@4bd3 (e377915a)] No real device with udid '6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F'. Looking for simulator
[iOSSim] Constructing iOS simulator for Xcode version 14.3 with udid '6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F'
[XCUITestDriver@4bd3 (e377915a)] Determining device to run tests on: udid: '6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F', real device: false
[XCUITestDriver@4bd3 (e377915a)] No platformVersion specified. Using device version: '16.4'
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'xcodeDetailsRetrieved' logged at 1687245918839 (09:25:18 GMT+0200 (Central European Summer Time))
[BaseDriver] Using local app '/Users/xxxx/dev/appium/Appium-OC/src/main/resources/apps/UIKitCatalog-iphonesimulator.app'
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'appConfigured' logged at 1687245918841 (09:25:18 GMT+0200 (Central European Summer Time))
[debug] [XCUITest] Checking whether app '/Users/xxxx/dev/appium/Appium-OC/src/main/resources/apps/UIKitCatalog-iphonesimulator.app' is actually present on file system
[debug] [XCUITest] App is present
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'resetStarted' logged at 1687245918842 (09:25:18 GMT+0200 (Central European Summer Time))
[debug] [simctl] Error running 'terminate': An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3):
Simulator device returned an error for the requested operation.
found nothing to terminate
Underlying error (domain=NSPOSIXErrorDomain, code=3):
    The operation couldn’t be completed. found nothing to terminate
    found nothing to terminate
[XCUITest] Reset: failed to terminate Simulator application with id "com.example.apple-samplecode.UICatalog"
[XCUITest] Not scrubbing third party app in anticipation of uninstall
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'resetComplete' logged at 1687245919088 (09:25:19 GMT+0200 (Central European Summer Time))
[XCUITestDriver@4bd3 (e377915a)] Using WDA path: '/Users/xxxx/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[XCUITestDriver@4bd3 (e377915a)] Using WDA agent: '/Users/xxxx/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[debug] [IOSSimulatorLog] Starting log capture for iOS Simulator with udid '6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F' using simctl
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'logCaptureStarted' logged at 1687245919777 (09:25:19 GMT+0200 (Central European Summer Time))
[XCUITestDriver@4bd3 (e377915a)] Setting up simulator
[debug] [iOSSim] Setting preferences of 6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F Simulator to {"ConnectHardwareKeyboard":false}
[debug] [iOSSim] Setting common Simulator preferences to {"RotateWindowWhenSignaledByGuest":true,"StartLastDeviceOnLaunch":false,"DetachOnWindowClose":false,"AttachBootedOnStart":true,"ConnectHardwareKeyboard":false,"PasteboardAutomaticSync":false}
[debug] [iOSSim] Updated 6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F Simulator preferences at '/Users/xxxx/Library/Preferences/com.apple.iphonesimulator.plist' with {"RotateWindowWhenSignaledByGuest":true,"StartLastDeviceOnLaunch":false,"DetachOnWindowClose":false,"AttachBootedOnStart":true,"ConnectHardwareKeyboard":false,"PasteboardAutomaticSync":false,"DevicePreferences":{"6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F":{"SimulatorExternalDisplay":2114,"ConnectHardwareKeyboard":false,"ChromeTint":"","SimulatorWindowGeometry":{"682D5D27-8B10-4399-8580-B9F64BDC400B":{"WindowCenter":"{1359.5, 532.5}","WindowScale":0.9977477477477478},"006487F4-269F-481B-BE46-0E12B79585EF":{"WindowCenter":"{1386.5, 544.5}","WindowScale":0.9977477477477478},"2E7ACCB9-37BE-49DE-93D6-4533F97CCEE3":{"WindowCenter":"{1638.5, 549.5}","WindowScale":0.9977477477477478},"2BA915AB-EE56-498D-990D-4C20E79F0734":{"WindowCenter":"{1386.5, 546.5}","WindowScale":0.9977477477477478}},"SimulatorWindowOrientation":"Portrait","SimulatorWindowRotationAngle":0}}}
[debug] [iOSSim] Got Simulator UI client PID: 55649
[iOSSim] Both Simulator with UDID '6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F' and the UI client are currently running
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'simStarted' logged at 1687245920600 (09:25:20 GMT+0200 (Central European Summer Time))
[debug] [XCUITest] Verifying application platform
[debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneSimulator"]
[XCUITestDriver@4bd3 (e377915a)] App 'com.example.apple-samplecode.UICatalog' is already installed
[debug] [XCUITest] Reset requested. Removing app with id 'com.example.apple-samplecode.UICatalog' from the device
[debug] [XCUITest] Installing '/Users/xxxx/dev/appium/Appium-OC/src/main/resources/apps/UIKitCatalog-iphonesimulator.app' on Simulator with UUID '6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F'...
[debug] [XCUITestDriver@4bd3 (e377915a)] Parsed BUILD_DIR configuration value: '/Users/xxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmloeqhuqbaydofbwmkqjkvbyjnx/Build/Products'
[debug] [XCUITestDriver@4bd3 (e377915a)] Got derived data root: '/Users/xxxx/Library/Developer/Xcode/DerivedData/WebDriverAgent-cmloeqhuqbaydofbwmkqjkvbyjnx'
[debug] [XCUITest] The app has been installed successfully.
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'appInstalled' logged at 1687245922840 (09:25:22 GMT+0200 (Central European Summer Time))
[debug] [XCUITestDriver@4bd3 (e377915a)] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[DevCon Factory] Requesting connection for device 6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F on local port 8100
[debug] [DevCon Factory] Cached connections count: 0
[DevCon Factory] Successfully requested the connection for 6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F:8100
[debug] [XCUITestDriver@4bd3 (e377915a)] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [WD Proxy] Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"16.4","version":"16.4"},"ios":{"simulatorVersion":"16.4","ip":"192.168.0.105"},"ready":true,"build":{"upgradedAt":"1685706987875","time":"Jun 20 2023 08:55:39","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":null}
[debug] [XCUITestDriver@4bd3 (e377915a)] Upgrade timestamp of the currently bundled WDA: 1685706987875
[debug] [XCUITestDriver@4bd3 (e377915a)] Upgrade timestamp of the WDA on the device: 1685706987875
[XCUITestDriver@4bd3 (e377915a)] Will reuse previously cached WDA instance at 'http://127.0.0.1:8100/' with 'com.facebook.WebDriverAgentRunner'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[debug] [XCUITestDriver@4bd3 (e377915a)] Trying to start WebDriverAgent 2 times with 10000ms interval
[debug] [XCUITestDriver@4bd3 (e377915a)] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'wdaStartAttempted' logged at 1687245923089 (09:25:23 GMT+0200 (Central European Summer Time))
[XCUITestDriver@4bd3 (e377915a)] Using provided WebdriverAgent at 'http://127.0.0.1:8100/'
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [WD Proxy] Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"16.4","version":"16.4"},"ios":{"simulatorVersion":"16.4","ip":"192.168.0.105"},"ready":true,"build":{"upgradedAt":"1685706987875","time":"Jun 20 2023 08:55:39","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":null}
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'wdaSessionAttempted' logged at 1687245923096 (09:25:23 GMT+0200 (Central European Summer Time))
[debug] [XCUITestDriver@4bd3 (e377915a)] Sending createSession command to WDA
[debug] [XCUITestDriver@4bd3 (e377915a)] Matched '/session' to command name 'createSession'
[debug] [XCUITestDriver@4bd3 (e377915a)] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"bundleId":"com.example.apple-samplecode.UICatalog","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true,"forceAppLaunch":true,"useNativeCachingStrategy":true,"forceSimulatorSoftwareKeyboardPresence":true,"defaultAlertAction":"accept"}],"alwaysMatch":{}}}
[debug] [XCUITestDriver@4bd3 (e377915a)] Got response with status 200: {"value":{"sessionId":"36641397-BF19-4B4B-AA7B-4FDE8D361CE0","capabilities":{"device":"iphone","browserName":"UIKitCatalog","sdkVersion":"16.4","CFBundleIdentifier":"com.example.apple-samplecode.UICatalog"}},"sessionId":"36641397-BF19-4B4B-AA7B-4FDE8D361CE0"}
[XCUITestDriver@4bd3 (e377915a)] Determined the downstream protocol as 'W3C'
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'wdaSessionStarted' logged at 1687245925227 (09:25:25 GMT+0200 (Central European Summer Time))
[debug] [XCUITestDriver@4bd3 (e377915a)] Event 'wdaStarted' logged at 1687245925227 (09:25:25 GMT+0200 (Central European Summer Time))
[debug] [BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[debug] [BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[AppiumDriver@aaa2] New XCUITestDriver session created successfully, session e377915a-b4f4-4cce-a62f-4a151408e927 added to master session list
[debug] [AppiumDriver@aaa2] Event 'newSessionStarted' logged at 1687245925229 (09:25:25 GMT+0200 (Central European Summer Time))
[AppiumDriver@aaa2] Promoting 1 sessionless plugins to be attached to session ID e377915a-b4f4-4cce-a62f-4a151408e927
[debug] [XCUITestDriver@4bd3 (e377915a)] Cached the protocol value 'W3C' for the new session e377915a-b4f4-4cce-a62f-4a151408e927
[debug] [XCUITestDriver@4bd3 (e377915a)] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"IOS","app":"/Users/xxxx/dev/appium/Appium-OC/src/main/resources/apps/UIKitCatalog-iphonesimulator.app","autoAcceptAlerts":true,"automationName":"XCUITest","bundleId":"com.example.apple-samplecode.UICatalog","deviceName":"iPhone 14","newCommandTimeout":180,"udid":"6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F"}}
[HTTP] <-- POST /session 200 7119 ms - 593
[HTTP] 
[HTTP] --> POST /session/e377915a-b4f4-4cce-a62f-4a151408e927/element
[HTTP] {"using":"accessibility id","value":"Activity Indicators"}
[debug] [XCUITestDriver@4bd3 (e377915a)] Calling AppiumDriver.findElement() with args: ["accessibility id","Activity Indicators","e377915a-b4f4-4cce-a62f-4a151408e927"]
[AppiumDriver@aaa2] Plugins which can handle cmd 'findElement': element-wait
[AppiumDriver@aaa2] Plugin element-wait is now handling cmd 'findElement'
[wait-plugin] Timeout properties not set for session e377915a-b4f4-4cce-a62f-4a151408e927, trying to set one
[wait-plugin] Timeout properties set for session e377915a-b4f4-4cce-a62f-4a151408e927 is {"timeout":10000,"intervalBetweenAttempts":500,"overrideTimeout":false} ms
[AppiumDriver@aaa2] Command 'findElement' was *not* handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command *was* handled by these: ["element-wait"].
[debug] [XCUITestDriver@4bd3 (e377915a)] Encountered internal error running command: TypeError: Cannot read properties of undefined (reading 'jwproxy')
[debug] [XCUITestDriver@4bd3 (e377915a)]     at sessionInfo (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:140:52)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:33:36
[debug] [XCUITestDriver@4bd3 (e377915a)]     at Generator.next (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:8:71
[debug] [XCUITestDriver@4bd3 (e377915a)]     at new Promise (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at __awaiter (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:4:12)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at find (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:22:12)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at WaitCommandPlugin.<anonymous> (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:41:38)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at Generator.next (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:8:71
[debug] [XCUITestDriver@4bd3 (e377915a)]     at new Promise (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at __awaiter (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:4:12)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at WaitCommandPlugin.findElement (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:39:16)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/lib/appium.js:734:35
[debug] [XCUITestDriver@4bd3 (e377915a)]     at AppiumDriver.executeWrappedCommand (/Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/lib/appium.js:774:22)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at AppiumDriver.executeCommand (/Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/lib/appium.js:696:28)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at asyncHandler (/Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:393:32)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/node_modules/@appium/base-driver/lib/protocol/protocol.js:518:15
[debug] [XCUITestDriver@4bd3 (e377915a)]     at Layer.handle [as handle_request] (/Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at next (/Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/node_modules/express/lib/router/route.js:144:13)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at Route.dispatch (/Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/node_modules/express/lib/router/route.js:114:3)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at Layer.handle [as handle_request] (/Users/xxxx/.nvm/versions/node/v18.16.0/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
[HTTP] <-- POST /session/e377915a-b4f4-4cce-a62f-4a151408e927/element 500 25 ms - 743
[HTTP] 
[HTTP] --> DELETE /session/e377915a-b4f4-4cce-a62f-4a151408e927
[HTTP] {}
[debug] [XCUITestDriver@4bd3 (e377915a)] Calling AppiumDriver.deleteSession() with args: ["e377915a-b4f4-4cce-a62f-4a151408e927"]
[AppiumDriver@aaa2] Plugins which can handle cmd 'deleteSession': element-wait
[AppiumDriver@aaa2] Plugin element-wait is now handling cmd 'deleteSession'
[AppiumDriver@aaa2] Executing default handling behavior for command 'deleteSession'
[debug] [AppiumDriver@aaa2] Event 'quitSessionRequested' logged at 1687245925464 (09:25:25 GMT+0200 (Central European Summer Time))
[AppiumDriver@aaa2] Removing session e377915a-b4f4-4cce-a62f-4a151408e927 from our master session list
[debug] [XCUITestDriver@4bd3 (e377915a)] Matched '/session/e377915a-b4f4-4cce-a62f-4a151408e927' to command name 'deleteSession'
[debug] [XCUITestDriver@4bd3 (e377915a)] Proxying [DELETE /session/e377915a-b4f4-4cce-a62f-4a151408e927] to [DELETE http://127.0.0.1:8100/session/36641397-BF19-4B4B-AA7B-4FDE8D361CE0] with no body
[debug] [XCUITestDriver@4bd3 (e377915a)] Got response with status 200: {"value":null,"sessionId":null}
[DevCon Factory] Releasing connections for 6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F device on any port number
[DevCon Factory] Found cached connections to release: ["6B4B083D-5F01-4B6D-88D1-175A4AFA3C4F:8100"]
[debug] [DevCon Factory] Cached connections count: 0
[debug] [XCUITestDriver@4bd3 (e377915a)] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [IOSSimulatorLog] Stopping iOS log capture
[debug] [AppiumDriver@aaa2] Event 'quitSessionFinished' logged at 1687245926526 (09:25:26 GMT+0200 (Central European Summer Time))
[debug] [AppiumDriver@aaa2] Received response: null
[debug] [AppiumDriver@aaa2] But deleting session, so not returning
[debug] [AppiumDriver@aaa2] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /session/e377915a-b4f4-4cce-a62f-4a151408e927 200 1063 ms - 14

What I have observed is that session is created successfully and app is launched but the script fails at the findElement because of the wait-plugin. Command 'findElement' was not handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command was handled by these: ["element-wait"]. Encountered internal error running command: TypeError: Cannot read properties of undefined (reading 'jwproxy')_

As you can see in the logs response that the error is caused because of the following reasons:

[debug] [XCUITestDriver@4bd3 (e377915a)] Calling AppiumDriver.findElement() with args: ["accessibility id","Activity Indicators","e377915a-b4f4-4cce-a62f-4a151408e927"]
[AppiumDriver@aaa2] Plugins which can handle cmd 'findElement': element-wait
[AppiumDriver@aaa2] Plugin element-wait is now handling cmd 'findElement'
[wait-plugin] Timeout properties not set for session e377915a-b4f4-4cce-a62f-4a151408e927, trying to set one
[wait-plugin] Timeout properties set for session e377915a-b4f4-4cce-a62f-4a151408e927 is {"timeout":10000,"intervalBetweenAttempts":500,"overrideTimeout":false} ms
[AppiumDriver@aaa2] Command 'findElement' was *not* handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command *was* handled by these: ["element-wait"].
[debug] [XCUITestDriver@4bd3 (e377915a)] Encountered internal error running command: TypeError: Cannot read properties of undefined (reading 'jwproxy')
[debug] [XCUITestDriver@4bd3 (e377915a)]     at sessionInfo (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:140:52)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:33:36
[debug] [XCUITestDriver@4bd3 (e377915a)]     at Generator.next (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:8:71
[debug] [XCUITestDriver@4bd3 (e377915a)]     at new Promise (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at __awaiter (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:4:12)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at find (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/element.js:22:12)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at WaitCommandPlugin.<anonymous> (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:41:38)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at Generator.next (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at /Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:8:71
[debug] [XCUITestDriver@4bd3 (e377915a)]     at new Promise (<anonymous>)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at __awaiter (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:4:12)
[debug] [XCUITestDriver@4bd3 (e377915a)]     at WaitCommandPlugin.findElement (/Users/xxxx/.appium/node_modules/appium-wait-plugin/lib/plugin.js:39:16)

Could you please look into this issue what may be causing this problem?

saikrishna321 commented 1 year ago

@itkhanz set the automationName as 'XCuiTest'

itkhanz commented 1 year ago

Thanks. Setting it to XCuiTest solved the issue. I thought the automationName capabilities are case-insensitive and earlier I had it set as XCUITEST (in Capital case)

return new XCUITestOptions()
                .setAutomationName("XCUITEST")         
                .setPlatformName("iOS")

In the documentation https://appium.github.io/appium-xcuitest-driver/4.32.5/capabilities/ , it also states that Values of automationName are compared case-insensitively.

itkhanz commented 1 year ago

Shouldn't this equality check be made case-insensitive in the source code of plugin?

https://github.com/AppiumTestDistribution/appium-wait-plugin/blob/641472a4e8d7c27ad021d42ccdf583d8f5c3dc0a/src/element.js#L111

saikrishna321 commented 1 year ago

@itkhanz Fixed in version 2.0.0. Please check the readMe. we have contract changes.