[Flutter] Unable to Capture Objects

hello,

We are setting up Flutter Environment on the Katalon Studio. We followed all the steps and guidelines but we are facing the following error. If somebody can help us with this please.

org.openqa.selenium.WebDriverException: Cannot read properties of undefined (reading ‘screenshot’)

Build info: version: ‘4.34.0’, revision: ‘707dcb4246*’

System info: os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘17.0.14’

Driver info: io.appium.java_client.android.AndroidDriver

Command: [525bf06c-1d51-4d14-b6be-495722879bf9, screenshot {}]

Capabilities {appium:address: 0.0.0.0, appium:allowCors: false, appium:allowInsecure: [], appium:app: C:\Users\Johann.SANTOS\Down…, appium:autoGrantPermissions: true, appium:automationName: Flutter, appium:basePath: /wd/hub, appium:callbackPort: 4723, appium:debugLogSpacing: false, appium:denyInsecure: [], appium:deviceId: 53ac049b, appium:deviceName: OnePlus CPH2573 (Android 16), appium:driver: {xcuitest: {wdaLocalPort: 8100}}, appium:driversImportChunkSize: 3, appium:extraArgs: [], appium:fastReset: false, appium:fullReset: false, appium:keepAliveTimeout: 600, appium:localTimezone: false, appium:logFormat: text, appium:logNoColors: false, appium:logTimestamp: false, appium:loglevel: info, appium:longStacktrace: false, appium:newCommandTimeout: 1800, appium:noPermsCheck: false, appium:noReset: true, appium:platformVersion: 16, appium:pluginsImportChunkSize: 7, appium:port: 55165, appium:relaxedSecurityEnabled: false, appium:requestTimeout: 3600, appium:sessionOverride: false, appium:shutdownTimeout: 5000, appium:skipUninstall: true, appium:strictCaps: false, appium:subcommand: server, appium:systemPort: 55207, appium:tmpDir: C:\Users\JOHANN~1.SAN\AppDa…, appium:udid: 53ac049b, appium:useDrivers: [], appium:usePlugins: [], platformName: ANDROID}

Session ID: 525bf06c-1d51-4d14-b6be-495722879bf9

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)

at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167)

at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:138)

at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:50)

at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:215)

at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:244)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:544)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:617)

at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:235)

at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:333)

at io.appium.java_client.AppiumDriver.getScreenshotAs(AppiumDriver.java:244)

at com.kms.katalon.composer.mobile.objectspy.dialog.MobileInspectorController.captureScreenshot(MobileInspectorController.java:378)

at com.kms.katalon.composer.mobile.recorder.components.MobileRecorderDialog$5.captureImage(MobileRecorderDialog.java:902)

at com.kms.katalon.composer.mobile.recorder.components.MobileRecorderDialog$5.run(MobileRecorderDialog.java:829)

at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:124)
1 Like

Hi @johann.santos

We understand that you have configured a Flutter mobile application for recording purposes.

Could you please provide screenshots and a step-by-step guide of the configuration process you followed?

Additionally, navigate to Project Settings > Desired Caps > Mobile > Android and take a screenshot for us.

If there are any desired capabilities related to the screenshot setup within the project settings, kindly help us by removing them and attempt the process again.

Thanks!

Hi @support.squad,

Thank you for your response. Here is the screenshot of the request. For the steps, I followed this resource link: Flutter App Test Automation: How to Test Flutter Apps With Katalon

1 Like

hi @johann.santos

first thing to check:
your Flutter app must have the appium-flutter-driver enabled

if the app isn’t built with Flutter Driver support, Katalon/Appium won’t be able to see anything from the UI, and errors like the screenshot one you’re getting are expected

once that’s enabled, set your desired capabilities to use Flutter automation, for example:

  • automationName: Flutter

that said, even with appium-flutter-driver working, there’s an important limitation to be aware of:

Katalon Studio’s Object Spy / Recorder still doesn’t work well with Flutter apps

Flutter doesn’t expose native UI elements, and Katalon relies heavily on screenshots and standard Appium locators when capturing objects. that’s why you’re seeing:
Cannot read properties of undefined (reading 'screenshot')

what usually works instead

  • skip Object Spy
  • use script-based automation
  • interact with widgets using Flutter ValueKey or Appium Flutter Driver commands (via executeScript("flutter: ..."))
  • many teams don’t use Object Repository at all for Flutter tests

hope that clears things up.

Hi @depapp,

Appium Flutter Driver is Installed, the problem I am having is I cannot continue on recording the test automation on the recorder.

1 Like

Are you able inspect the elements/object manually instead of recorder?

1 Like

You’re encountering a WebDriverException during screenshot capture in Katalon Studio’s Mobile Inspector/Recorder when testing a Flutter application. The error “Cannot read properties of undefined (reading ‘screenshot’)” indicates that Appium’s Flutter Driver is unable to execute the screenshot command, which is a known limitation with Flutter testing in Katalon Studio.

Key Issue: According to the official Katalon community forum, Katalon Studio’s Object Spy/Recorder has limited compatibility with Flutter applications. The screenshot functionality specifically fails because Flutter elements may not be properly exposed to Appium’s screenshot mechanism.

Recommended Solutions

1. Update to Latest Versions (Primary Fix)

  • Upgrade Katalon Studio to the latest version
  • Update Appium to the latest version
  • Ensure UIAutomator2 driver is current

This resolves many compatibility issues between Appium, Flutter Driver, and Katalon.

2. Disable FLAG_SECURE in Your Flutter App

If your Flutter app has FLAG_SECURE enabled, it prevents screenshot capture:

// In your Android app's MainActivity or relevant activity
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);

This is a common cause of screenshot failures in Android testing.

3. Verify Appium Flutter Driver Installation

Ensure the Appium Flutter Driver is properly installed:

appium driver install flutter

4. Check for Screen Overlay Restrictions

  • Disable any “Screen Overlay Detected” restrictions on your test device
  • Ensure no system overlays are blocking automation

5. Workaround: Use Manual Test Recording

Since the Object Spy/Recorder has limitations with Flutter:

  • Record test steps manually without relying on the Inspector
  • Use XPath or accessibility IDs to identify Flutter elements
  • Write test scripts directly instead of using the recorder

6. Reinstall Appium (If Issues Persist)

npm uninstall -g appium
npm install -g appium
appium driver install flutter

Key Considerations

Flutter Testing Limitations:

  • Katalon Studio provides partial support for Flutter apps
  • The Object Spy/Recorder works best when Flutter elements are rendered as native app elements
  • Pure Flutter-rendered UI elements may not be capturable by the standard screenshot mechanism

Alternative Approach:
If you continue experiencing issues, consider:

  • Using Appium directly with Flutter Driver (bypassing Katalon’s Recorder)
  • Writing test scripts programmatically using Katalon’s API
  • Testing the Flutter app’s native Android/iOS layers instead of Flutter-specific elements

References

1 Like

Hi @johann.santos,

From the stack trace, this error happens when Katalon’s Mobile Recorder/Object Spy tries to capture a screenshot, but the Appium Flutter stack throws an internal error (Cannot read properties of undefined (reading 'screenshot')). This is usually related to version incompatibility between Katalon Studio, Appium, and the Flutter driver, or using a device/OS that is not fully supported yet.

A few things to double-check:

First, please confirm which Katalon Studio version you are using. If you are not on the latest, we strongly recommend upgrading to Katalon Studio 10.4.3. There have been multiple enhancements and fixes after 10.3.0 for mobile and Flutter testing, including better support for Chinese phone models (e.g. OnePlus, Xiaomi, Oppo, Vivo).

Second, note that your device is running Android 16. At the moment, Katalon officially supports Android versions up to **Android 15 (**Supported environments for Katalon Studio and Katalon Runtime Engine (KRE) | Katalon Docs). While Android 16 may work in some cases, issues like screenshot capture or Object Spy failures can occur. To quickly validate your setup, please try the same steps on:

  • An Android 15 emulator, or

  • A physical device running Android 15

If that works, the issue is very likely related to Android 16 compatibility.

Third, please verify your Appium setup:

  • Appium Server: 2.11.1 or later

  • Appium Flutter Driver: 2.8.0

Mismatched or older driver versions are a common cause of this exact screenshot error.

If possible, please share:

  • Your exact Katalon Studio version

  • Appium version (appium -v)

  • Installed Flutter driver version (appium driver list --installed)

  • The Appium server log at the moment you click Record/Spy

As a temporary workaround, you can use an Android 15 emulator to capture objects and record steps, then execute the test on your physical device once the environment is confirmed stable.

Looking forward to your update so we can help you resolve this quickly.

1 Like

Hi @johann.santos,

How’re you doin? Have you got your issue resolved? If yes, feel free to share the solution for reference to others. If no, please help give us with more information so that we can better support. Thank you