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:
while running appium inspector im getting this error
enter image description here
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
Desired Capabilities:
{
“platformName”: “Android”,
“appium:deviceName”: “emulator-5554”,
“appium:app”: “C:/Users/ITZ/Desktop/Build/4.2.1(16)-debug.apk”,
“appium:automationName”: “Flutter”,
“appium:flutterPort”: 3000,
“appium:forceAppLaunch”: true
}
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!
Gagan Sai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.