Skip to content

Appium Inspector Fails to Connect to Flutter App Due to Dynamically Changing Dart Observatory URL #728

Open
@sai9133

Description

@sai9133

I'm using Appium Inspector to automate testing of a Flutter app on an Android emulator. However, I keep encountering an issue where the Dart Observatory URL dynamically changes each time I launch the app, causing the session to fail with the following error:

Darturl2

Error Failed to create session. An unknown server-side error occurred while processing the command. Original error: Cannot connect to the Dart Observatory URL ws://127.0.0.1:41145/JbqYpXh-u2E=/ws. Check the server log for more details

Context: Platform: Android Emulator Appium Version: 2.11.3 Flutter Version:3.24.0
capabilities2

What I’ve Tried: Port Forwarding: I've manually forwarded the dynamic Dart Observatory port to a static port using:

cmd :

adb forward tcp:3000 tcp:[DYNAMIC_PORT]

This works temporarily, but since the Dart VM service port changes every time the app restarts, I have to repeat this process constantly.

Setting a Static Port: I don't have access to the source code, so I'm unable to modify the Dart VM settings to use a static port.

My Questions: ->Is there a way to stabilize the Dart Observatory port without access to the app's source code? ->Can Appium be configured to automatically detect and handle the dynamic Dart VM port? A->re there alternative approaches or tools that might handle Flutter app testing more reliably in this scenario? ->Any guidance on how to consistently connect Appium to the Dart Observatory URL or alternative solutions would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions