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

[iOS][Flutter 3.16.5][XCode 15.2] App crashing after calling TakesScreenshot #651

Open
hainguyenh opened this issue Jan 23, 2024 · 1 comment

Comments

@hainguyenh
Copy link

hainguyenh commented Jan 23, 2024

Flutter app information:
Flutter (Channel stable, 3.16.5, on macOS 13.6.1 22G313 darwin-arm64, locale en-VN) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.1) [✓] IntelliJ IDEA Ultimate Edition (version 2023.3.2) [✓] VS Code (version 1.85.2)

Appium doctor

WARN AppiumDoctor [Deprecated] Please use appium-doctor installed with "npm install @appium/doctor --location=global" info AppiumDoctor Appium Doctor v.1.16.2 info AppiumDoctor ### Diagnostic for necessary dependencies starting ### info AppiumDoctor ✔ The Node.js binary was found at: /usr/local/bin/node info AppiumDoctor ✔ Node version is 18.16.1 info AppiumDoctor ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer info AppiumDoctor ✔ Xcode Command Line Tools are installed in: /Applications/Xcode.app/Contents/Developer info AppiumDoctor ✔ DevToolsSecurity is enabled. info AppiumDoctor ✔ The Authorization DB is set up properly. WARN AppiumDoctor ✖ Carthage was NOT found! info AppiumDoctor ✔ HOME is set to: /Users/hn info AppiumDoctor ✔ ANDROID_HOME is set to: /Users/hn/Library/Android/sdk info AppiumDoctor ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home info AppiumDoctor Checking adb, android, emulator, apkanalyzer info AppiumDoctor 'adb' is in /Users/hn/Library/Android/sdk/platform-tools/adb info AppiumDoctor 'android' is in /Users/hn/Library/Android/sdk/tools/android info AppiumDoctor 'emulator' is in /Users/hn/Library/Android/sdk/emulator/emulator info AppiumDoctor 'apkanalyzer' is in /Users/hn/Library/Android/sdk/cmdline-tools/latest/bin/apkanalyzer info AppiumDoctor ✔ adb, android, emulator, apkanalyzer exist: /Users/hn/Library/Android/sdk info AppiumDoctor ✔ 'bin' subfolder exists under '/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home' info AppiumDoctor ### Diagnostic for necessary dependencies completed, one fix needed. ### info AppiumDoctor info AppiumDoctor ### Diagnostic for optional dependencies starting ### WARN AppiumDoctor ✖ opencv4nodejs cannot be found. WARN AppiumDoctor ✖ ffmpeg cannot be found WARN AppiumDoctor ✖ mjpeg-consumer cannot be found. WARN AppiumDoctor ✖ set-simulator-location is not installed WARN AppiumDoctor ✖ idb and idb_companion are not installed WARN AppiumDoctor ✖ applesimutils cannot be found WARN AppiumDoctor ✖ ios-deploy cannot be found WARN AppiumDoctor ✖ bundletool.jar cannot be found WARN AppiumDoctor ✖ gst-launch-1.0 and/or gst-inspect-1.0 cannot be found info AppiumDoctor ### Diagnostic for optional dependencies completed, 9 fixes possible. ### info AppiumDoctor info AppiumDoctor ### Manual Fixes Needed ### info AppiumDoctor The configuration cannot be automatically fixed, please do the following first: WARN AppiumDoctor ➜ [For lower than Appium 1.20.0] Please install Carthage. Visit https://github.com/Carthage/Carthage#installing-carthage for more information. info AppiumDoctor info AppiumDoctor ### Optional Manual Fixes ### info AppiumDoctor The configuration can install optionally. Please do the following manually: WARN AppiumDoctor ➜ Why opencv4nodejs is needed and how to install it: http://appium.io/docs/en/writing-running-appium/image-comparison/ WARN AppiumDoctor ➜ ffmpeg is needed to record screen features. Please read https://www.ffmpeg.org/ to install it WARN AppiumDoctor ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with 'npm i -g mjpeg-consumer'. WARN AppiumDoctor ➜ set-simulator-location is needed to set location for Simulator. Please read https://github.com/lyft/set-simulator-location to install it WARN AppiumDoctor ➜ Why idb is needed and how to install it: https://github.com/appium/appium-idb WARN AppiumDoctor ➜ Why applesimutils is needed and how to install it: http://appium.io/docs/en/drivers/ios-xcuitest/ WARN AppiumDoctor ➜ ios-deploy is used as a fallback command to install iOS applications to real device. Please read https://github.com/ios-control/ios-deploy/ to install it WARN AppiumDoctor ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it WARN AppiumDoctor ➜ gst-launch-1.0 and gst-inspect-1.0 are used to stream the screen of the device under test. Please read https://appium.io/docs/en/writing-running-appium/android/android-screen-streaming/ to install them and for more details

Appium driver list
`✔ Listing available drivers

  • [email protected] [installed (npm)]
  • [email protected] [installed (npm)]
  • uiautomator2 [not installed]
  • mac2 [not installed]
  • espresso [not installed]
  • safari [not installed]
  • gecko [not installed]
  • chromium [not installed]`

We're using securedViewPlugin to revent capture screenshot, but I belive I already comment it as below:

`import 'dart:convert';
import 'dart:core';
import 'dart:io';

import 'package:flutter/services.dart';

class SecureViewPlugin {
static const MethodChannel platform = MethodChannel('org.SecureView');

static Future makeSecureView() async {
try {
//TODO: auto team need to capture screenshot
// await platform.invokeMethod('makeSecureView');
} catch (e) {
print(e);
}
}

static Future removeBlurEffect() async {
try {
await platform.invokeMethod('removeSecureView');
} on PlatformException catch (e) {
print("Error: ${e.message}");
}
}
}`

Java Code

`DesiredCapabilities capabilities =new DesiredCapabilities();
capabilities.setCapability("app","/Users/Shared/temp/app/4.13/app.ipa");
capabilities.setCapability("autoAcceptAlerts","true");
capabilities.setCapability("autoGrantPermissions","true");
capabilities.setCapability("automationName","Flutter");
capabilities.setCapability("fullReset","true");
capabilities.setCapability("noReset","false");
capabilities.setCapability("udid","00008110-000E19E91483401E"); // real device
capabilities.setCapability("platformName","iOS"); /// ios version 16.6.1
RemoteWebDriver driver = new IOSDriver(new URL("http://127.0.0.1:6006"),capabilities);

     ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);`

// After call this capture screenshot, the app in iPhone was crash but WDA still running. When I checked log on appium

Appium log:

appium -p 6006 [Appium] Welcome to Appium v2.4.1 [Appium] Non-default server args: [Appium] { [Appium] port: 6006 [Appium] } [Appium] The autodetected Appium home path: /Users/hn/.appium [Appium] Attempting to load driver xcuitest... [Appium] Attempting to load driver flutter... [Appium] Requiring driver at /Users/hn/.appium/node_modules/appium-flutter-driver/build/lib/driver.js [Appium] Requiring driver at /Users/hn/.appium/node_modules/appium-xcuitest-driver/build/index.js [Appium] FlutterDriver has been successfully loaded in 1.993s [Appium] XCUITestDriver has been successfully loaded in 1.994s [Appium] Appium REST http interface listener started on http://0.0.0.0:6006 [Appium] You can provide the following URLs in your client code to connect to this server: [Appium] http://127.0.0.1:6006/ (only accessible from the same host) [Appium] http://192.168.1.17:6006/ [Appium] http://169.254.227.171:6006/ [Appium] Available drivers: [Appium] - [email protected] (automationName 'XCUITest') [Appium] - [email protected] (automationName 'Flutter') [Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use. [HTTP] Request idempotency key: 7fdf0fdd-f361-4e1c-945c-f7186467adf3 [HTTP] --> POST /session [HTTP] {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:app":"/Users/Shared/temp/app/4.13/app.ipa","appium:autoAcceptAlerts":"true","appium:autoGrantPermissions":"true","appium:automationName":"Flutter","appium:fullReset":"true","appium:noReset":"false","appium:udid":"00008110-000E19E91483401E","platformName":"ios"}}} [AppiumDriver@7835] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"appium:app":"/Users/Shared/temp/app/4.13/app.ipa","appium:autoAcceptAlerts":"true","appium:autoGrantPermissions":"true","appium:automationName":"Flutter","appium:fullReset":"true","appium:noReset":"false","appium:udid":"00008110-000E19E91483401E","platformName":"ios"}}] [AppiumDriver@7835] Event 'newSessionRequested' logged at 1705980330294 (10:25:30 GMT+0700 (Indochina Time)) [Appium] Attempting to find matching driver for automationName 'Flutter' and platformName 'ios' [Appium] The 'flutter' driver was installed and matched caps. [Appium] Will require it at /Users/hn/.appium/node_modules/appium-flutter-driver [Appium] Requiring driver at /Users/hn/.appium/node_modules/appium-flutter-driver/build/lib/driver.js [AppiumDriver@7835] Appium v2.4.1 creating new FlutterDriver (v2.3.0) session [AppiumDriver@7835] Checking BaseDriver versions for Appium and FlutterDriver [AppiumDriver@7835] Appium's BaseDriver version is 9.5.0 [AppiumDriver@7835] FlutterDriver's BaseDriver version is 9.5.0 [FlutterDriver@fe2f] Creating session with W3C capabilities: { [FlutterDriver@fe2f] "alwaysMatch": { [FlutterDriver@fe2f] "platformName": "ios", [FlutterDriver@fe2f] "appium:app": "/Users/Shared/temp/app/4.13/app.ipa", [FlutterDriver@fe2f] "appium:autoAcceptAlerts": "true", [FlutterDriver@fe2f] "appium:autoGrantPermissions": "true", [FlutterDriver@fe2f] "appium:automationName": "Flutter", [FlutterDriver@fe2f] "appium:fullReset": "true", [FlutterDriver@fe2f] "appium:noReset": "false", [FlutterDriver@fe2f] "appium:udid": "00008110-000E19E91483401E" [FlutterDriver@fe2f] }, [FlutterDriver@fe2f] "firstMatch": [ [FlutterDriver@fe2f] {} [FlutterDriver@fe2f] ] [FlutterDriver@fe2f] } [FlutterDriver@fe2f] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior [FlutterDriver@fe2f] Capability 'fullReset' changed from string to boolean. This may cause unexpected behavior [FlutterDriver@fe2f] The following provided capabilities were not recognized by this driver: [FlutterDriver@fe2f] autoAcceptAlerts [FlutterDriver@fe2f] autoGrantPermissions [FlutterDriver@fe2f (976708ae)] Session created with session id: 976708ae-7d8f-4efa-b392-c04013460d51 [FlutterDriver] Starting an IOS proxy session [XCUITestDriver@0d6d] Creating session with W3C capabilities: { [XCUITestDriver@0d6d] "alwaysMatch": { [XCUITestDriver@0d6d] "platformName": "ios", [XCUITestDriver@0d6d] "appium:app": "/Users/Shared/temp/app/4.13/app.ipa", [XCUITestDriver@0d6d] "appium:autoAcceptAlerts": "true", [XCUITestDriver@0d6d] "appium:autoGrantPermissions": "true", [XCUITestDriver@0d6d] "appium:automationName": "Flutter", [XCUITestDriver@0d6d] "appium:fullReset": "true", [XCUITestDriver@0d6d] "appium:noReset": "false", [XCUITestDriver@0d6d] "appium:udid": "00008110-000E19E91483401E" [XCUITestDriver@0d6d] }, [XCUITestDriver@0d6d] "firstMatch": [ [XCUITestDriver@0d6d] {} [XCUITestDriver@0d6d] ] [XCUITestDriver@0d6d] } [XCUITestDriver@0d6d] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior [XCUITestDriver@0d6d] Capability 'fullReset' changed from string to boolean. This may cause unexpected behavior [XCUITestDriver@0d6d] Capability 'autoAcceptAlerts' changed from string to boolean. This may cause unexpected behavior [XCUITestDriver@0d6d] The following provided capabilities were not recognized by this driver: [XCUITestDriver@0d6d] autoGrantPermissions [XCUITestDriver@0d6d] 'platformVersion' capability ('undefined') is not a valid version number. Consider fixing it or be ready to experience an inconsistent driver behavior. [XCUITestDriver@0d6d (3302fa1f)] Session created with session id: 3302fa1f-d3b5-45d1-8c7d-7da5443d8b39 [XCUITest] Current user: 'hn' [XCUITestDriver@0d6d (3302fa1f)] Available devices: 00008110-000E19E91483401E [XCUITest] Creating iDevice object with udid '00008110-000E19E91483401E' [XCUITestDriver@0d6d (3302fa1f)] Determining device to run tests on: udid: '00008110-000E19E91483401E', real device: true [XCUITestDriver@0d6d (3302fa1f)] No platformVersion specified. Using device version: '16.6.1' [XCUITestDriver@0d6d (3302fa1f)] Normalized platformVersion capability value '16.6.1' to '16.6' [XCUITestDriver@0d6d (3302fa1f)] Event 'xcodeDetailsRetrieved' logged at 1705980330406 (10:25:30 GMT+0700 (Indochina Time)) [BaseDriver] Using local app '/Users/Shared/temp/app/4.13/app.ipa' [Support] Found 'unzip' at '/usr/bin/unzip' [XCUITestDriver@0d6d (3302fa1f)] Found 1 bundle in 'app.ipa': Payload/Runner.app [XCUITestDriver@0d6d (3302fa1f)] 'Payload/Runner.app' is the resulting application bundle selected from '/Users/Shared/temp/app/4.13/app.ipa' [XCUITestDriver@0d6d (3302fa1f)] Event 'appConfigured' logged at 1705980332159 (10:25:32 GMT+0700 (Indochina Time)) [XCUITest] Checking whether app '/var/folders/9g/kjd6n24x62s1p3ryfbdg75zh0000gn/T/2024023-39592-18pas1b.7nr2/Runner.app' is actually present on file system [XCUITest] App is present [XCUITest] Getting bundle ID from app '/var/folders/9g/kjd6n24x62s1p3ryfbdg75zh0000gn/T/2024023-39592-18pas1b.7nr2/Runner.app': 'xxx.uat' [XCUITestDriver@0d6d (3302fa1f)] Event 'resetStarted' logged at 1705980332161 (10:25:32 GMT+0700 (Indochina Time)) [XCUITest] Reset: running ios real device reset flow [XCUITest] Reset: fullReset requested. Will try to uninstall the app 'xxx.uat'. [XCUITest] Reset: removed 'xxx.uat' [XCUITestDriver@0d6d (3302fa1f)] Event 'resetComplete' logged at 1705980332603 (10:25:32 GMT+0700 (Indochina Time)) [XCUITestDriver@0d6d (3302fa1f)] Using WDA path: '/Users/hn/.appium/node_modules/appium-flutter-driver/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent' [XCUITestDriver@0d6d (3302fa1f)] Using WDA agent: '/Users/hn/.appium/node_modules/appium-flutter-driver/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj' [XCUITest] Crash reports root '/Users/hn/Library/Logs/CrashReporter/MobileDevice/Thao-auto-iphone14' does not exist. Got nothing to gather. [XCUITestDriver@0d6d (3302fa1f)] Event 'logCaptureStarted' logged at 1705980332772 (10:25:32 GMT+0700 (Indochina Time)) [XCUITestDriver@0d6d (3302fa1f)] Setting up real device [XCUITest] Verifying application platform [XCUITest] CFBundleSupportedPlatforms: ["iPhoneOS"] [XCUITestDriver@0d6d (3302fa1f)] App 'xxx.uat' is not installed yet or it has an offload and cannot be detected, which might keep the local data. [XCUITest] Installing '/var/folders/9g/kjd6n24x62s1p3ryfbdg75zh0000gn/T/2024023-39592-18pas1b.7nr2/Runner.app' on device with UUID '00008110-000E19E91483401E'... [XCUITest] Using 'serial' app deployment strategy. You could change it by providing another value to the 'appInstallStrategy' capability [XCUITest] Getting bundle ID from app '/var/folders/9g/kjd6n24x62s1p3ryfbdg75zh0000gn/T/2024023-39592-18pas1b.7nr2/Runner.app': 'xxx.uat' [XCUITest] Successfully scanned the tree structure of '/var/folders/9g/kjd6n24x62s1p3ryfbdg75zh0000gn/T/2024023-39592-18pas1b.7nr2/Runner.app' [XCUITest] Got 262 folders and 2232 files to push [XCUITest] Successfully created the remote folder structure (263 items) [XCUITest] Proceeding to serial files push [XCUITestDriver@0d6d (3302fa1f)] Parsed BUILD_DIR configuration value: '/Users/hn/Library/Developer/Xcode/DerivedData/WebDriverAgent-fpwnncpgyzowydgzvifebystswud/Build/Products' [XCUITestDriver@0d6d (3302fa1f)] Got derived data root: '/Users/hn/Library/Developer/Xcode/DerivedData/WebDriverAgent-fpwnncpgyzowydgzvifebystswud' [XCUITest] Successfully pushed 262 folders and 2232 files within 23722ms [XCUITest] A new application installation is going to be performed [XCUITest] App installation succeeded after 25979ms [XCUITest] The app has been installed successfully. [XCUITestDriver@0d6d (3302fa1f)] Event 'appInstalled' logged at 1705980358909 (10:25:58 GMT+0700 (Indochina Time)) [XCUITestDriver@0d6d (3302fa1f)] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found [DevCon Factory] Requesting connection for device 00008110-000E19E91483401E on local port 8100, device port 8100 [DevCon Factory] Cached connections count: 0 [DevCon Factory] Successfully requested the connection for 00008110-000E19E91483401E:8100 [XCUITestDriver@0d6d (3302fa1f)] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver' [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body [WD Proxy] Got response with status 200: {"value":{"build":{"upgradedAt":"1705388677335","time":"Jan 23 2024 10:25:04","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iOS","sdkVersion":"17.0","version":"16.6.1"},"device":"iphone","ios":{"ip":"169.254.108.183"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":null} [XCUITestDriver@0d6d (3302fa1f)] Upgrade timestamp of the currently bundled WDA: 1705388677335 [XCUITestDriver@0d6d (3302fa1f)] Upgrade timestamp of the WDA on the device: 1705388677335 [XCUITestDriver@0d6d (3302fa1f)] 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. [XCUITestDriver@0d6d (3302fa1f)] Trying to start WebDriverAgent 1 times with 10000ms interval [XCUITestDriver@0d6d (3302fa1f)] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities [XCUITestDriver@0d6d (3302fa1f)] Event 'wdaStartAttempted' logged at 1705980358996 (10:25:58 GMT+0700 (Indochina Time)) [XCUITestDriver@0d6d (3302fa1f)] Using provided WebdriverAgent at 'http://127.0.0.1:8100/' [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body [WD Proxy] Got response with status 200: {"value":{"build":{"upgradedAt":"1705388677335","time":"Jan 23 2024 10:25:04","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iOS","sdkVersion":"17.0","version":"16.6.1"},"device":"iphone","ios":{"ip":"169.254.108.183"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":null} [XCUITestDriver@0d6d (3302fa1f)] Event 'wdaSessionAttempted' logged at 1705980359004 (10:25:59 GMT+0700 (Indochina Time)) [XCUITestDriver@0d6d (3302fa1f)] Sending createSession command to WDA [XCUITestDriver@0d6d (3302fa1f)] Matched '/session' to command name 'createSession' [XCUITestDriver@0d6d (3302fa1f)] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"bundleId":"xxx.uat","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true,"forceAppLaunch":true,"useNativeCachingStrategy":true,"forceSimulatorSoftwareKeyboardPresence":true,"defaultAlertAction":"accept"}],"alwaysMatch":{}}} [XCUITestDriver@0d6d (3302fa1f)] Got response with status 200: {"value":{"sessionId":"9A9E9AA4-D7F6-4C14-8B96-5F5F3C045DE2","capabilities":{"sdkVersion":"16.6.1","device":"iphone"}},"sessionId":"9A9E9AA4-D7F6-4C14-8B96-5F5F3C045DE2"} [XCUITestDriver@0d6d (3302fa1f)] Determined the downstream protocol as 'W3C' [XCUITestDriver@0d6d (3302fa1f)] Event 'wdaSessionStarted' logged at 1705980366321 (10:26:06 GMT+0700 (Indochina Time)) [XCUITestDriver@0d6d (3302fa1f)] Event 'wdaStarted' logged at 1705980366322 (10:26:06 GMT+0700 (Indochina Time)) [BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it [BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it [FlutterDriver] Establishing a connection to the Dart Observatory. Will retry 10 times with 3000ms delay between retries. These values could be customized by changing 'maxRetryCount' and 'retryBackoffTime' capabilities. [FlutterDriver] Attempt #1 of 10 [FlutterDriver] Running on iOS real device [FlutterDriver] Forwarding the remote port 57076 to the local port 57076 [FlutterDriver] Connecting to Dart Observatory: ws://127.0.0.1:57076/cTu-D32yGe4=/ws [FlutterDriver] Listing all isolates: [{"type":"@Isolate","id":"isolates/7444797517461435","name":"main","number":"7444797517461435","isSystemIsolate":false,"isolateGroupId":"isolateGroups/1374338329727905"}] [AppiumDriver@7835] New FlutterDriver session created successfully, session 976708ae-7d8f-4efa-b392-c04013460d51 added to master session list [AppiumDriver@7835] Event 'newSessionStarted' logged at 1705980366420 (10:26:06 GMT+0700 (Indochina Time)) [FlutterDriver@fe2f (976708ae)] Cached the protocol value 'W3C' for the new session 976708ae-7d8f-4efa-b392-c04013460d51 [FlutterDriver@fe2f (976708ae)] Responding to client with driver.createSession() result: {"capabilities":{"subcommand":"server","address":"0.0.0.0","port":6006,"extraArgs":[],"allowCors":false,"allowInsecure":[],"basePath":"","callbackPort":4723,"debugLogSpacing":false,"denyInsecure":[],"keepAliveTimeout":600,"localTimezone":false,"loglevel":"debug","logNoColors":false,"logTimestamp":false,"pluginsImportChunkSize":7,"driversImportChunkSize":3,"longStacktrace":false,"noPermsCheck":false,"relaxedSecurityEnabled":false,"sessionOverride":false,"strictCaps":false,"useDrivers":[],"usePlugins":[],"driver":{"xcuitest":{"wdaLocalPort":8100}},"tmpDir":"/var/folders/9g/kjd6n24x62s1p3ryfbdg75zh0000gn/T","platformName":"ios","app":"/Users/Shared/temp/app/4.13/app.ipa","autoAcceptAlerts":"true","autoGrantPermissions":"true","automationName":"Flutter","fullReset":true,"noReset":false,"udid":"00008110-000E19E91483401E","fastReset":false,"skipUninstall":false}} [HTTP] <-- POST /session 200 36130 ms - 930 [HTTP] [HTTP] --> GET /session/976708ae-7d8f-4efa-b392-c04013460d51/screenshot [HTTP] {} [FlutterDriver@fe2f (976708ae)] Calling AppiumDriver.getScreenshot() with args: ["976708ae-7d8f-4efa-b392-c04013460d51"] [FlutterDriver] Executing Flutter driver command 'getScreenshot'=>>>>>>> it hang here

NOTE:
Android work as expected with this app

@hainguyenh hainguyenh changed the title [iOS][Flutter 3.16.5] App crashing after calling TakesScreenshot [iOS][Flutter 3.16.5][XCode 15.2] App crashing after calling TakesScreenshot Jan 23, 2024
@KazuCocoa
Copy link
Member

Appium flutter driver proxies the screenshot request to the flutter/dart as

const response = await this.socket!.call(`_flutter.screenshot`) as any;

Thus, the root cause is possibly https://api.flutter.dev/flutter/flutter_driver/FlutterDriver/screenshot.html (Dart/Flutter side). Nothing can help as this driver for this behavior.

As this driver, it could define a method that takes a screenshot like flutter: takeScreenshot to get screenshot via UIA2/XCUITest driver instead of the Flutter's API.

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

No branches or pull requests

2 participants