appium / appium-flutter-driver

Appium Flutter Driver is a test automation tool for Flutter apps on multiple platforms/OSes. Appium Flutter Driver is part of the Appium mobile test automation tool maintained by community
MIT License
461 stars 184 forks source link

Appium Flutter not working for iOS device (TypeError: Cannot read property 'match' of undefined) #211

Closed surendra-savita-30060677 closed 2 years ago

surendra-savita-30060677 commented 2 years ago

While running Java unit code in Android device, its working fine.But in case of iOS its not working, always getting below exception:

Encountered internal error running command: TypeError: Cannot read property 'match' of undefined**** [debug] [W3C] at Object.exports.processLogToGetobservatory (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/build/driver/lib/sessions/observatory.js:118:9) [debug] [W3C] at Object.exports.getObservatoryWsUri (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/ios.ts:77:21) [debug] [W3C] at Object.exports.startIOSSession (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/ios.ts:31:30) [debug] [W3C] at runMicrotasks () [debug] [W3C] at processTicksAndRejections (internal/process/task_queues.js:95:5) [debug] [W3C] at FlutterDriver.exports.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/session.ts:15:47) [debug] [W3C] at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:387:35)

IDE : Eclipse Programming language : Java appium-flutter-driver - 0.0.33 Appium Version : 1.21 Code : DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platformVersion", "15.1"); capabilities.setCapability("retryBackoffTime", "500"); capabilities.setCapability("maxRetryCount", "20"); capabilities.setCapability("deviceName", "iPhone 12 Pro"); capabilities.setCapability("noReset", true); capabilities.setCapability("udid", "00008101-001A6564XXXXX"); capabilities.setCapability("app", "path of ipa"); capabilities.setCapability("automationName", "flutter");

Could you please resolve above issue........... or did i miss something......

KazuCocoa commented 2 years ago

Please attach the full appium log to see the detail.

Possibly https://github.com/appium-userland/appium-flutter-driver/issues/115 is related.

surendra-savita-30060677 commented 2 years ago

[info] [HTTP] Waiting until the server is closed [info] [HTTP] Received server close event [info] [Appium] Welcome to Appium v1.21.0 [info] [Appium] Non-default server args: [info] [Appium] address: 127.0.0.1 [info] [Appium] relaxedSecurityEnabled: true [info] [Appium] allowInsecure: { [info] [Appium] } [info] [Appium] denyInsecure: { [info] [Appium] } [info] [Appium] Appium REST http interface listener started on 127.0.0.1:4723[info] [HTTP] --> POST /wd/hub/session [info] [HTTP] {"desiredCapabilities":{"agentPathx":"usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj","app":"/Users/xxxxxxxxxx/Downloads/hello_world.ipa","automationName":"flutter","bootstrapPath":"/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent","deviceName":"iPhone 12 Pro","includeSafariInWebviews":true,"platformName":"iOS","platformVersion":"15.1","udid":"00008101-001A6XXXXXXXXXX","xcodeOrgId":"2XXXXXXXXX","xcodeSigninId":"iPhone Developer","newCommandTimeout":0,"connectHardwareKeyboard":true}} [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"agentPathx":"usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj","app":"/Users/XXXXXXXXXX/Downloads/hello_world.ipa","automationName":"flutter","bootstrapPath":"/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent","deviceName":"iPhone 12 Pro","includeSafariInWebviews":true,"platformName":"iOS","platformVersion":"15.1","udid":"00008101-001A65640C2A001E","xcodeOrgId":"XXXXXXXXX","xcodeSigninId":"iPhone Developer","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null] [debug] [BaseDriver] Event 'newSessionRequested' logged at 1639022792366 (09:36:32 GMT+0530 (India Standard Time)) [info] [Appium] Appium v1.21.0 creating new FlutterDriver (v0.0.28) session [info] [Appium] Applying relaxed security to 'FlutterDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure [debug] [BaseDriver] Creating session with MJSONWP desired capabilities: { [debug] [BaseDriver] "agentPathx": "usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj", [debug] [BaseDriver] "app": "/Users/surendrakumarsavita/Downloads/hello_world.ipa", [debug] [BaseDriver] "automationName": "flutter", [debug] [BaseDriver] "bootstrapPath": "/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent", [debug] [BaseDriver] "deviceName": "iPhone 12 Pro", [debug] [BaseDriver] "includeSafariInWebviews": true, [debug] [BaseDriver] "platformName": "iOS", [debug] [BaseDriver] "platformVersion": "15.1", [debug] [BaseDriver] "udid": "00008101-001AXXXXXXXXXXX", [debug] [BaseDriver] "xcodeOrgId": "2S54AFLBFB", [debug] [BaseDriver] "xcodeSigninId": "iPhone Developer", [debug] [BaseDriver] "newCommandTimeout": 0, [debug] [BaseDriver] "connectHardwareKeyboard": true [debug] [BaseDriver] } [warn] [BaseDriver] The following capabilities were provided, but are not recognized by Appium: [warn] [BaseDriver] agentPathx [warn] [BaseDriver] bootstrapPath [warn] [BaseDriver] includeSafariInWebviews [warn] [BaseDriver] xcodeOrgId [warn] [BaseDriver] xcodeSigninId [warn] [BaseDriver] connectHardwareKeyboard [info] [BaseDriver] Session created with session id: a39a0de8-7480-42bb-af8d-f8137198b52a [info] [FlutterDriver] Starting an IOS proxy session [debug] [BaseDriver] Creating session with MJSONWP desired capabilities: { [debug] [BaseDriver] "agentPathx": "usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj", [debug] [BaseDriver] "app": "/Users/XXXXXXXXXXXX/Downloads/hello_world.ipa", [debug] [BaseDriver] "automationName": "flutter", [debug] [BaseDriver] "bootstrapPath": "/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent", [debug] [BaseDriver] "deviceName": "iPhone 12 Pro", [debug] [BaseDriver] "includeSafariInWebviews": true, [debug] [BaseDriver] "platformName": "iOS", [debug] [BaseDriver] "platformVersion": "15.1", [debug] [BaseDriver] "udid": "00008101-001A6564XXXXXXXXX", [debug] [BaseDriver] "xcodeOrgId": "2S54AFLBFB", [debug] [BaseDriver] "xcodeSigninId": "iPhone Developer", [debug] [BaseDriver] "newCommandTimeout": 0, [debug] [BaseDriver] "connectHardwareKeyboard": true [debug] [BaseDriver] } [warn] [BaseDriver] The following capabilities were provided, but are not recognized by Appium: [warn] [BaseDriver] agentPathx [warn] [BaseDriver] xcodeSigninId [info] [BaseDriver] Session created with session id: 6bcb3c7a-5016-4669-9f39-43616b0ebfed [debug] [XCUITest] Current user: 'XXXXXXX' [debug] [XCUITest] Available devices: 00008101-001A65640C2XXXXXX [debug] [XCUITest] Creating iDevice object with udid '00008101-001A65640XXXXXXXX' [info] [XCUITest] Determining device to run tests on: udid: '00008101-001A65640XXXXX', real device: true [debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1639022792409 (09:36:32 GMT+0530 (India Standard Time)) [info] [BaseDriver] Using local app '/Users/XXXXXXXXX/Downloads/hello_world.ipa' [info] [BaseDriver] Will reuse previously cached application at '/var/folders/g7/684gknm13hsdk_gr_vq68t540000gp/T/2021117-90747-1f68hi.8hmgc/Runner.app' [debug] [BaseDriver] Event 'appConfigured' logged at 1639022792452 (09:36:32 GMT+0530 (India Standard Time)) [debug] [XCUITest] Checking whether app '/var/folders/g7/684gknm13hsdk_gr_vq68t540000gp/T/2021117-90747-1f68hi.8hmgc/Runner.app' is actually present on file system [debug] [XCUITest] App is present [debug] [iOS] Getting bundle ID from app '/var/folders/g7/684gknm13hsdk_gr_vq68t540000gp/T/2021117-90747-1f68hi.8hmgc/Runner.app': 'com.XXXXX.testApp' [debug] [BaseDriver] Event 'resetStarted' logged at 1639022792452 (09:36:32 GMT+0530 (India Standard Time)) [debug] [XCUITest] Reset: running ios real device reset flow [debug] [BaseDriver] Event 'resetComplete' logged at 1639022792452 (09:36:32 GMT+0530 (India Standard Time)) [info] [WebDriverAgent] Using WDA path: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent' [info] [WebDriverAgent] Using WDA agent: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'[debug] [XCUITest] Crash reports root '/Users/XXXXXXXXXXXX/Library/Logs/CrashReporter/MobileDevice/iPhone 12 Pro Max' does not exist. Got nothing to gather. [debug] [BaseDriver] Event 'logCaptureStarted' logged at 1639022792681 (09:36:32 GMT+0530 (India Standard Time)) [info] [XCUITest] Setting up real device [debug] [XCUITest] Verifying application platform [debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneOS"][debug] [XCUITest] Reset requested. Removing app with id 'com.AdaniKell.superApp' from the device[debug] [XCUITest] Installing '/var/folders/g7/684gknm13hsdk_gr_vq68t540000gp/T/2021117-90747-1f68hi.8hmgc/Runner.app' on device with UUID '00008101-001A65640C2A001E'...[debug] [Support] Traversed 14 directories and 60 files in 1768ms [debug] [XCUITest] Pushed the app files successfully after 1900ms[info] [XCUITest] App installation succeeded after 2393ms [debug] [XCUITest] The app has been installed successfully. [debug] [BaseDriver] Event 'appInstalled' logged at 1639022795877 (09:36:35 GMT+0530 (India Standard Time))[debug] [WebDriverAgent] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found [info] [DevCon Factory] Requesting connection for device 00008101-001A6564XXXXXX on local port 8100, device port 8100 [debug] [DevCon Factory] Cached connections count: 1 [info] [DevCon Factory] Found cached connections on port #8100: ["00008101-001A6564XXXXXXX:8100"] [warn] [DevCon Factory] Port #8100 is busy. Did you quit the previous driver session(s) properly? [info] [DevCon Factory] Trying to release the port [info] [DevCon Factory] Releasing the listener for '00008101-001A65640CXXXXXXXX:8100' [debug] [iProxy@00008101:8100] Closing the connection [info] [iProxy@00008101:8100] The connection has been closed [info] [DevCon Factory] Port #8100 has been successfully released after 2ms [info] [DevCon Factory] Successfully requested the connection for 00008101-001A65640XXXXXXX:8100[debug] [WebDriverAgent] Parsed BUILD_DIR configuration value: '/Users/XXXXXXXXXXX/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products' [debug] [WebDriverAgent] Got derived data root: '/Users/XXXXXXXXXX/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu' [debug] [XCUITest] Starting WebDriverAgent initialization with the synchronization key '/Users/XXXXXXXXXX/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu' [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":"15.0","version":"15.1"},"ios":{"ip":"169.254.197.XX"},"ready":true,"build":{"upgradedAt":"1632042036000","time":"Dec 8 2021 16:05:34","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":"DAC50D82-4E1A-415C-8A11-XXXXXXXXXX"} [debug] [WebDriverAgent] Upgrade timestamp of the currently bundled WDA: 1632042036000 [debug] [WebDriverAgent] Upgrade timestamp of the WDA on the device: 1632042036000 [info] [WebDriverAgent] 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] [XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval [debug] [XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities [debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1639022798224 (09:36:38 GMT+0530 (India Standard Time)) [info] [WebDriverAgent] 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":"15.0","version":"15.1"},"ios":{"ip":"169.254.197.66"},"ready":true,"build":{"upgradedAt":"1632042036000","time":"Dec 8 2021 16:05:34","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":"DAC50D82-4E1A-415C-8A11-4C673427A820"} [debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1639022798232 (09:36:38 GMT+0530 (India Standard Time)) [debug] [XCUITest] Sending createSession command to WDA [debug] [WD Proxy] Matched '/session' to command name 'createSession' [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"bundleId":"com.XXXXXXXX.testApp","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true}],"alwaysMatch":{}}}[debug] [WD Proxy] Got response with status 200: {"value":{"sessionId":"9A75694F-49EA-437F-97CF-99C335996D9A","capabilities":{"device":"iphone","browserName":"hello_world","sdkVersion":"15.1","CFBundleIdentifier":"com.XXXXXX.testApp"}},"sessionId":"9A75694F-49EA-437F-97CF-99XXXXXXXXX"} [info] [WD Proxy] Determined the downstream protocol as 'W3C' [debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1639022799788 (09:36:39 GMT+0530 (India Standard Time)) [debug] [BaseDriver] Event 'wdaStarted' logged at 1639022799788 (09:36:39 GMT+0530 (India Standard Time)) [info] [XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior. [debug] [BaseDriver] Event 'orientationSet' logged at 1639022799788 (09:36:39 GMT+0530 (India Standard 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 [debug] [FlutterDriver] Deleting Flutter Driver session [debug] [BaseDriver] Event 'newSessionStarted' logged at 1639022799827 (09:36:39 GMT+0530 (India Standard Time)) [debug] [MJSONWP] Encountered internal error running command: TypeError: Cannot read property 'match' of undefined [debug] [MJSONWP] at Object.exports.processLogToGetobservatory (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-flutter-driver/build/driver/lib/sessions/observatory.js:118:9) [debug] [MJSONWP] at Object.exports.getObservatoryWsUri (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/ios.ts:31:21) [debug] [MJSONWP] at Object.exports.startIOSSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/ios.ts:23:34) [debug] [MJSONWP] at runMicrotasks () [debug] [MJSONWP] at processTicksAndRejections (internal/process/task_queues.js:85:5) [debug] [MJSONWP] at FlutterDriver.exports.createSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/session.ts:15:47) [debug] [MJSONWP] at AppiumDriver.createSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/lib/appium.js:387:35) [info] [HTTP] <-- POST /wd/hub/session 500 7465 ms - 178 [info] [HTTP]  [info] [HTTP] --> DELETE /wd/hub/session [info] [HTTP] {} [debug] [HTTP] No route found for /wd/hub/session [info] [HTTP] <-- DELETE /wd/hub/session 404 9 ms - 211 [info] [HTTP] 

KazuCocoa commented 2 years ago

Could you try out appium 1.22? (flutter driver is 0.0.32)

jamesvanhorn commented 2 years ago

I found a workaround by uninstall the app manually between launches. The call to driver.quit() (im in java) was not actually closing the app. After I close and uninstall manually, I saw in my console the message that FlutterDriver had closed the connection.

Next app startup / session worked fine then. Not sure how to fix though, as I can't do anything aside from calling driver.quit(). This also held true for android for me.

dvyAb commented 2 years ago

Hello,

Do you have any news for the error ? [(TypeError: Cannot read property 'match' of undefined)](https://github.com/appium-userland/appium-flutter-driver/issues/211#. I have the same error when I physically connect the phone to the computer, I use Appium 1.22.2, iOS 15.3.1 and Xcode 13.2.1

thanks.

@KazuCocoa

KazuCocoa commented 2 years ago

https://github.com/appium-userland/appium-flutter-driver/issues/115 might be related for ios real devices if you still have an issue. It has more restrictions in iOS 14+ by Flutter.

agpdl commented 2 years ago

Is there a workaround for this issue? its a blocker for anyone running iOS 14+ (Almost all iPhones now...)

KazuCocoa commented 2 years ago

profile app as https://github.com/appium-userland/appium-flutter-driver/issues/115 ?