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

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

Open
sai9133 opened this issue Aug 13, 2024 · 1 comment
Labels

Comments

@sai9133
Copy link

sai9133 commented Aug 13, 2024

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!

@KazuCocoa
Copy link
Member

Could you share the full Appium server log?

Usually this driver scans the observatory port in the settings and configures the port-forwarding internally.

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