Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create session. An unknown server-side error occurred while processing the command. Original error: Cannot read property 'match' of undefined #725

Open
YASWANTHCS20 opened this issue Aug 1, 2024 · 6 comments
Labels

Comments

@YASWANTHCS20
Copy link

YASWANTHCS20 commented Aug 1, 2024

While starting a session in flutter driver i get this error message given in the image below also my app gets started and within seconds it is closed
issue

The appium log is:

--> POST /wd/hub/session
[HTTP] {"capabilities":{"alwaysMatch":{"platformName":"Android","appium:automationName":"Flutter","appium:deviceName":"emulator-5554","appium:app":"C:/4.2.1.apk","appium:ensureWebviewsHavePages":true,"appium:nativeWebScreenshot":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"Android","appium:automationName":"Flutter","appium:deviceName":"emulator-5554","appium:app":"C:/4.2.1.apk","appium:ensureWebviewsHavePages":true,"appium:nativeWebScreenshot":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true}}
[W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"Android","appium:automationName":"Flutter","appium:deviceName":"emulator-5554","appium:app":"C:/4.2.1.apk","appium:ensureWebviewsHavePages":true,"appium:nativeWebScreenshot":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true},null,{"alwaysMatch":{"platformName":"Android","appium:automationName":"Flutter","appium:deviceName":"emulator-5554","appium:app":"C:/4.2.1.apk","appium:ensureWebviewsHavePages":true,"appium:nativeWebScreenshot":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true},"firstMatch":[{}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1722498875044 (13:24:35 GMT+0530 (India Standard Time))
[Appium] Appium v1.22.3 creating new FlutterDriver (v0.0.32) session
[Appium] There are no active sessions for cleanup
[Appium] Applying relaxed security to 'FlutterDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver] "alwaysMatch": {
[BaseDriver] "platformName": "Android",
[BaseDriver] "appium:automationName": "Flutter",
[BaseDriver] "appium:deviceName": "emulator-5554",
[BaseDriver] "appium:app": "C:/4.2.1.apk",
[BaseDriver] "appium:ensureWebviewsHavePages": true,
[BaseDriver] "appium:nativeWebScreenshot": true,
[BaseDriver] "appium:newCommandTimeout": 3600,
[BaseDriver] "appium:connectHardwareKeyboard": true
[BaseDriver] },
[BaseDriver] "firstMatch": [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] app
[BaseDriver] ensureWebviewsHavePages
[BaseDriver] nativeWebScreenshot
[BaseDriver] connectHardwareKeyboard
[BaseDriver] Session created with session id: 9128e462-5a6a-47a1-8de1-e7ffd0d97fe2
[FlutterDriver] Starting an Android proxy session
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver] "alwaysMatch": {
[BaseDriver] "platformName": "Android",
[BaseDriver] "appium:automationName": "Flutter",
[BaseDriver] "appium:deviceName": "emulator-5554",
[BaseDriver] "appium:app": "C:/4.2.1.apk",
[BaseDriver] "appium:ensureWebviewsHavePages": true,
[BaseDriver] "appium:nativeWebScreenshot": true,
[BaseDriver] "appium:newCommandTimeout": 3600,
[BaseDriver] "appium:connectHardwareKeyboard": true
[BaseDriver] },
[BaseDriver] "firstMatch": [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] connectHardwareKeyboard
[BaseDriver] Session created with session id: faf31b77-91b8-4266-a8da-802aba642883
[BaseDriver] Using local app 'C:/4.2.1.apk'
[UiAutomator2] Checking whether app is actually present
[ADB] Using 'adb.exe' from 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 start-server'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices
[ADB] Connected devices: [{"udid":"emulator-5554","state":"device"}]
[AndroidDriver] Using device: emulator-5554
[ADB] Using 'adb.exe' from 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 start-server'
[ADB] Setting device id to emulator-5554
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 34
[ADB] Getting device platform version
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 14
[ADB] Device API level: 34
[UiAutomator2] Relaxing hidden api policy
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'settings put global hidden_api_policy_pre_p_apps 1;settings put global hidden_api_policy_p_apps 1;settings put global hidden_api_policy 1''
[AndroidDriver] Parsing package and activity from app manifest
[ADB] Package name: 'com.konamigaming.konetic.v421'
[ADB] Main activity name: 'com.konamigaming.konetic.v421.MainActivity'
[AndroidDriver] Parsed package and activity are: com.konamigaming.konetic.v421/com.konamigaming.konetic.v421.MainActivity
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 wait-for-device'
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('3.4.0' >= '3.4.0')
[ADB] There is no need to install/upgrade 'C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)'
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[Logcat] Starting logs capture with command: C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 logcat -v threadtime
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to local port 8202
[ADB] Forwarding system: 8202 to device: 6790
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 forward tcp:8202 tcp:6790'
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[ADB] 'io.appium.uiautomator2.server' is installed
[ADB] Getting package info for 'io.appium.uiautomator2.server'
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server'
[ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.27.0' >= '4.27.0')
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.27.0.apk
[ADB] Using the previously cached signature entry for 'appium-uiautomator2-server-v4.27.0.apk'
[ADB] sha256 hash did match for 'appium-uiautomator2-server-v4.27.0.apk'
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server.test'
[ADB] 'io.appium.uiautomator2.server.test' is installed
[ADB] Checking app cert for C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
[ADB] Using the previously cached signature entry for 'appium-uiautomator2-server-debug-androidTest.apk'
[ADB] sha256 hash did match for 'appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Server packages are not going to be (re)installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm list instrumentation'
[UiAutomator2] Instrumentation target 'io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner' is available
[ADB] Adding packages ["io.appium.settings","io.appium.uiautomator2.server","io.appium.uiautomator2.server.test"] to Doze whitelist
[ADB] Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server.test",";"]]
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;'

[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package com.konamigaming.konetic.v421'
[ADB] 'com.konamigaming.konetic.v421' is installed
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop com.konamigaming.konetic.v421'
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm clear com.konamigaming.konetic.v421'
[AndroidDriver] Performed fast reset on the installed 'com.konamigaming.konetic.v421' application (stop and clear)
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (socket hang up)
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] Starting UIAutomator2 server 4.27.0
[UiAutomator2] Using UIAutomator2 server from 'C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.27.0.apk' and test from 'C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online...
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","am","instrument","-w","-e","disableAnalytics",true,"io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] socket hang up
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8202/wd/hub/status] with no body
[WD Proxy] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
[UiAutomator2] The initialization of the instrumentation process took 3218ms
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8202/wd/hub/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"Flutter","deviceName":"emulator-5554","app":"C:/4.2.1.apk","ensureWebviewsHavePages":true,"nativeWebScreenshot":true,"newCommandTimeout":3600,"connectHardwareKeyboard":true},"platformName":"Android","automationName":"Flutter","deviceName":"emulator-5554","app":"C:/4.2.1.apk","ensureWebviewsHavePages":true,"nativeWebScreenshot":true,"newCommandTimeout":3600,"connectHardwareKeyboard":true,"deviceUDID":"emulator-5554","appPackage":"com.konamigaming.konetic.v421"}],"alwaysMatch":{}}}
[WD Proxy] Got response with status 200: {"sessionId":"76155e18-4262-40da-8b40-d86addc74cb2","value":{"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"Android","automationName":"Flutter","deviceName":"emulator-5554","app":"C:/4.2.1.apk","ensureWebviewsHavePages":true,"nativeWebScreenshot":true,"newCommandTimeout":3600,"connectHardwareKeyboard":true},"platformName":"Android","automationName":"Flutter","deviceName":"emulator-5554","app":"C:/4.2.1.apk","ensureWebviewsHavePages":true,"nativeWebScreenshot":true,"newCommandTimeout":3600,"connectHardwareKeyboard":true,"deviceUDID":"emulator-5554","appPackage":"com.konamigaming.konetic.v421"}],"alwaysMatch":{}},"sessionId":"76155e18-4262-40da-8b40-d86addc74cb2"}}
[WD Proxy] Determined the downstream protocol as 'W3C'
[WD Proxy] Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8202/wd/hub/session/76155e18-4262-40da-8b40-d86addc74cb2/appium/device/info] with no body
[WD Proxy] Got response with status 200: {"sessionId":"76155e18-4262-40da-8b40-d86addc74cb2","value":{"androidId":"f820f2cec91c782f","apiVersion":"34","bluetooth":{"state":"ON"},"brand":"google","carrierName":"T-Mobile","displayDensity":560,"locale":"en_US","manufacturer":"Google","model":"sdk_gphone64_x86_64","networks":[{"capabilities":{"SSID":null,"linkDownBandwidthKbps":30000,"linkUpstreamBandwidthKbps":12000,"networkCapabilities":"NET_CAPABILITY_NOT_METERED,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_VALIDATED,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_FOREGROUND,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED","signalStrength":-50,"transportTypes":"TRANSPORT_WIFI"},"detailedState":"CONNECTED","extraInfo":"","isAvailable":true,"isConnected":true,"isFailover":false,"isRoaming":false,"state":"CONNECTED","subtype":-1,"subtypeName":"","type":1,"typeName":"WIFI"},{"capabilities":{"SSID":null,"linkDownBandwidthKbps":4300,"linkUpstreamBandwidthKbps":1800,"networkCapabil...
[ADB] Running 'C:\Users\ITZ\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys window'
[AndroidDriver] Screen already unlocked, doing nothing

[Instrumentation] .
[Instrumentation] Time: 5.229
[Instrumentation]
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0
[FlutterDriver] Deleting Flutter Driver session
[BaseDriver] Event 'newSessionStarted' logged at 1722498884877 (13:24:44 GMT+0530 (India Standard Time))
[W3C] Encountered internal error running command: TypeError: Cannot read property 'match' of undefined
[W3C] at Object.exports.processLogToGetobservatory (C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-flutter-driver\build\driver\lib\sessions\observatory.js:118:9)
[W3C] at Object.exports.getObservatoryWsUri (C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-flutter-driver\lib\sessions\android.ts:39:21)
[W3C] at Object.exports.startAndroidSession (C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-flutter-driver\lib\sessions\android.ts:26:30)
[W3C] at runMicrotasks ()
[W3C] at processTicksAndRejections (internal/process/task_queues.js:97:5)
[W3C] at FlutterDriver.exports.createSession (C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\node_modules\appium-flutter-driver\lib\sessions\session.ts:21:47)
[W3C] at AppiumDriver.createSession (C:\Users\ITZ\Downloads\Appium Server GUI\resources\app\node_modules\appium\lib\appium.js:387:35)
[HTTP] <-- POST /wd/hub/session 500 9839 ms - 685

looks like some 500 internal server. How to fix this

my appium version is : 2.11.2
np version : 10.8.1
flutter driver versoin is: [email protected]

@KazuCocoa
Copy link
Member

[Appium] Appium v1.22.3 creating new FlutterDriver (v0.0.32) session

Please use the latest version first. The latest is Appium 2 basis and flutter driver v2.9.0.
https://github.com/appium/appium-flutter-driver?tab=readme-ov-file#installation

@YASWANTHCS20
Copy link
Author

Done!
But I cant find Appium Server GUI(appium desktop) with version 2.9.0. where can I install that or can u give me any other alternatives

@KazuCocoa
Copy link
Member

@KazuCocoa
Copy link
Member

The flutter context itself does not support the GUI inspector though.

@YASWANTHCS20
Copy link
Author

Hi KazuCocoa,

Thank you for your guidance.
I understand from your response that the Flutter context does not fully support the GUI inspector. Could you please confirm if this means that when using either the flutter driver or the flutter integration driver, Appium Inspector will not be able to find all Flutter-based or flutter specific elements? If yes, is there any alternative to the inspector that can help retrieve all the web elements in a Flutter application?

@KazuCocoa
Copy link
Member

This repository does not address flutter integration driver. Please ask the flutter integration driver repository directly about the driver's behavior.
As https://github.com/appium/appium-flutter-driver?tab=readme-ov-file#note , this driver provides getRenderTree command to get the page source in flutter context. It is what the Flutter framework itself returns via their flutter_driver lib. You could inspect them via this driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants