Closed
Description
Hi, Can someone help to solve this issue?
- I set the flutter driver in my project like this.
dev_dependencies:
flutter_driver:
sdk: flutter
...
- And I also add a code line
enableFlutterDriverExtension();
in thevoid main()
Future<void> main() async {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
enableFlutterDriverExtension();
...
- And I installed the appium v2.12.2 with some drivers.
andrew@andrewui-MacBookPro ~ % appium -v
2.12.2
andrew@andrewui-MacBookPro ~ % appium driver list
✔ Listing available drivers
- flutter@2.10.0 [installed (npm)]
- flutter-integration@1.1.3 [installed (npm)]
- uiautomator2@3.9.1 [installed (npm)]
- xcuitest [not installed]
- espresso [not installed]
- mac2 [not installed]
- windows [not installed]
- safari [not installed]
- gecko [not installed]
- chromium [not installed]
But, when I run a my test code, I got a "Cannot connect to the Dart Observatory URL" error and I couldn't solve it..
Doctor
SKIP_ANDROID=1 appium driver doctor flutter
Running 5 doctor checks for the "flutter" driver
info Doctor ### Starting doctor diagnostics ###
info Doctor ✔ HOME is set to: /Users/andrew
info Doctor ✔ applesimutils is installed at: /opt/homebrew/bin/applesimutils
info Doctor ✔ ffmpeg exists at '/opt/homebrew/bin/ffmpeg'
info Doctor ✔ xCode is installed at '/Applications/Xcode.app/Contents/Developer'
info Doctor ✔ xCode tools are installed and work properly
info Doctor ### Diagnostic completed, 0 required fixes needed, 0 optional fixes possible. ###
info Doctor
info Doctor Everything looks good, bye!
info Doctor
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.4 23E214 darwin-arm64, locale ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.95.1)
[✓] Connected device (5 available)
[✓] Network resources
• No issues found!
StackTrace of Client
2024-12-02T09:11:44.152Z ERROR webdriver: WebDriverError: An unknown server-side error occurred while processing the command. Original error: Cannot connect to the Dart Observatory URL ws://127.0.0.1:37217/a2d0eAatFlc=/ws. Check the server log for more details when running "http://localhost:4723/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"platformName":"Android","appium:deviceName":"R3CWC0F7AXF","appium:app":"/Users/andrew/Documents/GitHub/retinol-app/build/app/outputs/flutter-apk/app-debug.apk","appium:automationName":"Flutter","appium:maxRetryCount":2,"appium:autoGrantPermissions":true},"firstMatch":[{}]}}"
2024-12-02T09:11:44.152Z ERROR webdriver: unknown error: WebDriverError: An unknown server-side error occurred while processing the command. Original error: Cannot connect to the Dart Observatory URL ws://127.0.0.1:37217/a2d0eAatFlc=/ws. Check the server log for more details when running "http://localhost:4723/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"platformName":"Android","appium:deviceName":"R3CWC0F7AXF","appium:app":"/Users/andrew/Documents/GitHub/retinol-app/build/app/outputs/flutter-apk/app-debug.apk","appium:automationName":"Flutter","appium:maxRetryCount":2,"appium:autoGrantPermissions":true},"firstMatch":[{}]}}"
at FetchRequest._request (file:///Users/andrew/node_modules/webdriver/build/node.js:1652:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async startWebDriverSession (file:///Users/andrew/node_modules/webdriver/build/node.js:1022:16)
at async _WebDriver.newSession (file:///Users/andrew/node_modules/webdriver/build/node.js:1238:41)
at async remote (file:///Users/andrew/node_modules/webdriverio/build/index.js:7810:20)
at async /Users/andrew/Documents/GitHub/retinol-app/appium/test.js:29:20
An error occurred: Error: Failed to create session.
WebDriverError: An unknown server-side error occurred while processing the command. Original error: Cannot connect to the Dart Observatory URL ws://127.0.0.1:37217/a2d0eAatFlc=/ws. Check the server log for more details when running "http://localhost:4723/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"platformName":"Android","appium:deviceName":"R3CWC0F7AXF","appium:app":"/Users/andrew/Documents/GitHub/retinol-app/build/app/outputs/flutter-apk/app-debug.apk","appium:automationName":"Flutter","appium:maxRetryCount":2,"appium:autoGrantPermissions":true},"firstMatch":[{}]}}"
at startWebDriverSession (file:///Users/andrew/node_modules/webdriver/build/node.js:1026:11)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async _WebDriver.newSession (file:///Users/andrew/node_modules/webdriver/build/node.js:1238:41)
at async remote (file:///Users/andrew/node_modules/webdriverio/build/index.js:7810:20)
at async /Users/andrew/Documents/GitHub/retinol-app/appium/test.js:29:20
Node JS source code
const wdio = require('webdriverio');
const assert = require('assert');
const { FlutterFinder } = require('appium-flutter-finder');
const path = require('path');
const osSpecificOps = {
'platformName': 'Android',
'appium:deviceName': 'R3CWC0F7AXF',
'appium:app': path.join(__dirname, '../build/app/outputs/flutter-apk/app-debug.apk')
};
if (Object.keys(osSpecificOps).length === 0) {
console.error('Environment variable APPIUM_OS not set correctly. It should be either "android" or "ios".');
process.exit(1);
}
const opts = {
port: 4723,
capabilities: {
...osSpecificOps,
'appium:automationName': 'Flutter',
'appium:maxRetryCount': 2,
'appium:autoGrantPermissions': true,
}
};
(async () => {
try {
const driver = await wdio.remote(opts);
const finder = new FlutterFinder();
const element = await driver.execute('flutter', 'waitFor', finder.byValueKey('kakao_login_button'));
await driver.execute('flutter', 'tap', finder.byValueKey('kakao_login_button'));
await driver.deleteSession();
} catch (error) {
console.error('An error occurred:', error);
}
})();
Thank you for checking!