appium / appium-flutter-driver

Appium Flutter Driver is a test automation tool for Flutter apps on multiple platforms/OSes. Appium Flutter Driver is part of the Appium mobile test automation tool maintained by community
MIT License
455 stars 183 forks source link

"ext.flutter.driver" is not found in "extensionRPCs" #28

Closed hattersharath closed 3 years ago

hattersharath commented 4 years ago
[FlutterDriver] /Users/xxxx/Library/Android/sdk/platform-tools/adb forward tcp:42559 tcp:42559
[FlutterDriver] Attempt #1
[FlutterDriver] Connecting to Dart Observatory: ws://127.0.0.1:42559/TZyCumpgCHs=/ws
[FlutterDriver] Connected to ws://127.0.0.1:42559/TZyCumpgCHs=/ws
[FlutterDriver] "ext.flutter.driver" is not found in "extensionRPCs" ["ext.ui.window.scheduleFrame"]
[FlutterDriver] Cannot get Dart Isolate
[FlutterDriver] Error: "ext.flutter.driver" is not found in "extensionRPCs" ["ext.ui.window.scheduleFrame"]
[FlutterDriver]     at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium-flutter-driver/node_modules/appium-support/lib/logging.js:74:35)
[FlutterDriver]     at Client.onOpenListener (/usr/local/lib/node_modules/appium-flutter-driver/lib/sessions/observatory.ts:91:17)
[FlutterDriver]     at runMicrotasks (<anonymous>)
[FlutterDriver]     at processTicksAndRejections (internal/process/task_queues.js:93:5)
[FlutterDriver] Waiting 300 seconds before trying...
(node:35764) UnhandledPromiseRejectionWarning: Error: "ext.flutter.driver" is not found in "extensionRPCs" ["ext.ui.window.scheduleFrame"]
    at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium-flutter-driver/node_modules/appium-support/lib/logging.js:74:35)
    at Client.onOpenListener (/usr/local/lib/node_modules/appium-flutter-driver/lib/sessions/observatory.ts:91:17)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:35764) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 21)
[FlutterDriver] Attempt #2
[FlutterDriver] Connecting to Dart Observatory: ws://127.0.0.1:42559/TZyCumpgCHs=/ws
[FlutterDriver] Connected to ws://127.0.0.1:42559/TZyCumpgCHs=/ws
[FlutterDriver] "ext.flutter.driver" is not found in "extensionRPCs" ["ext.ui.window.scheduleFrame","ext.flutter.reassemble","ext.flutter.exit","ext.flutter.saveCompilationTrace","ext.flutter.platformOverride","ext.flutter.evict","ext.flutter.timeDilation","ext.flutter.debugPaint","ext.flutter.debugPaintBaselinesEnabled","ext.flutter.repaintRainbow","ext.flutter.debugCheckElevationsEnabled","ext.flutter.debugDumpLayerTree","ext.flutter.debugDumpRenderTree","ext.flutter.debugDumpSemanticsTreeInTraversalOrder","ext.flutter.debugDumpSemanticsTreeInInverseHitTestOrder","ext.flutter.debugDumpApp","ext.flutter.showPerformanceOverlay","ext.flutter.didSendFirstFrameEvent","ext.flutter.didSendFirstFrameRasterizedEvent","ext.flutter.profileWidgetBuilds","ext.flutter.debugAllowBanner","ext.flutter.debugWidgetInspector","ext.flutter.inspector.structuredErrors","ext.flutter.inspector.show","ext.flutter.inspector.trackRebuildDirtyWidgets","ext.flutter.inspector.trackRepaintWidgets","ext.flutter.inspector.disposeAllGroups","ext.flutter.inspector.disposeGroup","ext.flutter.inspector.isWidgetTreeReady","ext.flutter.inspector.disposeId","ext.flutter.inspector.setPubRootDirectories","ext.flutter.inspector.setSelectionById","ext.flutter.inspector.getParentChain","ext.flutter.inspector.getProperties","ext.flutter.inspector.getChildren","ext.flutter.inspector.getChildrenSummaryTree","ext.flutter.inspector.getChildrenDetailsSubtree","ext.flutter.inspector.getRootWidget","ext.flutter.inspector.getRootRenderObject","ext.flutter.inspector.getRootWidgetSummaryTree","ext.flutter.inspector.getDetailsSubtree","ext.flutter.inspector.getSelectedRenderObject","ext.flutter.inspector.getSelectedWidget","ext.flutter.inspector.getSelectedSummaryWidget","ext.flutter.inspector.isWidgetCreationTracked","ext.flutter.inspector.screenshot","ext.dart.io.getOpenFiles","ext.dart.io.getFileByID","ext.dart.io.getOpenSockets","ext.dart.io.getSocketByID"]
[FlutterDriver] Cannot get Dart Isolate
[FlutterDriver] Error: "ext.flutter.driver" is not found in "extensionRPCs" ["ext.ui.window.scheduleFrame","ext.flutter.reassemble","ext.flutter.exit","ext.flutter.saveCompilationTrace","ext.flutter.platformOverride","ext.flutter.evict","ext.flutter.timeDilation","ext.flutter.debugPaint","ext.flutter.debugPaintBaselinesEnabled","ext.flutter.repaintRainbow","ext.flutter.debugCheckElevationsEnabled","ext.flutter.debugDumpLayerTree","ext.flutter.debugDumpRenderTree","ext.flutter.debugDumpSemanticsTreeInTraversalOrder","ext.flutter.debugDumpSemanticsTreeInInverseHitTestOrder","ext.flutter.debugDumpApp","ext.flutter.showPerformanceOverlay","ext.flutter.didSendFirstFrameEvent","ext.flutter.didSendFirstFrameRasterizedEvent","ext.flutter.profileWidgetBuilds","ext.flutter.debugAllowBanner","ext.flutter.debugWidgetInspector","ext.flutter.inspector.structuredErrors","ext.flutter.inspector.show","ext.flutter.inspector.trackRebuildDirtyWidgets","ext.flutter.inspector.trackRepaintWidgets","ext.flutter.inspector.disposeAllGroups","ext.flutter.inspector.disposeGroup","ext.flutter.inspector.isWidgetTreeReady","ext.flutter.inspector.disposeId","ext.flutter.inspector.setPubRootDirectories","ext.flutter.inspector.setSelectionById","ext.flutter.inspector.getParentChain","ext.flutter.inspector.getProperties","ext.flutter.inspector.getChildren","ext.flutter.inspector.getChildrenSummaryTree","ext.flutter.inspector.getChildrenDetailsSubtree","ext.flutter.inspector.getRootWidget","ext.flutter.inspector.getRootRenderObject","ext.flutter.inspector.getRootWidgetSummaryTree","ext.flutter.inspector.getDetailsSubtree","ext.flutter.inspector.getSelectedRenderObject","ext.flutter.inspector.getSelectedWidget","ext.flutter.inspector.getSelectedSummaryWidget","ext.flutter.inspector.isWidgetCreationTracked","ext.flutter.inspector.screenshot","ext.dart.io.getOpenFiles","ext.dart.io.getFileByID","ext.dart.io.getOpenSockets","ext.dart.io.getSocketByID"]
[FlutterDriver]     at Object.wrappedLogger.errorAndThrow (/usr/local/lib/node_modules/appium-flutter-driver/node_modules/appium-support/lib/logging.js:74:35)
[FlutterDriver]     at Client.onOpenListener (/usr/local/lib/node_modules/appium-flutter-driver/lib/sessions/observatory.ts:91:17)
[FlutterDriver]     at runMicrotasks (<anonymous>)
[FlutterDriver]     at processTicksAndRejections (internal/process/task_queues.js:93:5)
Trongk58d commented 3 years ago

@Trongk58d I am still running appium@1.19.0-beta.0 and the related appium-flutter-driver as seen below:

npm list -g appium-flutter-driver
/usr/local/lib
└─┬ appium@1.19.0-beta.0
  └── appium-flutter-driver@0.0.25 

I have since shortened the retry time in my configuration to: retry_backoff_time: 2000 #2 seconds For me, it almost always works on Attempt 2.

I still get the failed attempt quite often, too.

thank you! image my appium is the newest version (1.19.0) and the same version of appium-flutter-driver with U! I will try to change retry_backoff_time like You and rerun it, tks!

Trongk58d commented 3 years ago

@Trongk58d I am still running appium@1.19.0-beta.0 and the related appium-flutter-driver as seen below:

npm list -g appium-flutter-driver
/usr/local/lib
└─┬ appium@1.19.0-beta.0
  └── appium-flutter-driver@0.0.25 

I have since shortened the retry time in my configuration to: retry_backoff_time: 2000 #2 seconds For me, it almost always works on Attempt 2.

I still get the failed attempt quite often, too.

it works with me, thank you!

sahanaprasad commented 3 years ago

I'm having the same issue. Changed appium to beta version as well. It is still not working for me. Tried with android emulator API26 and real device. Still no luck. Is there any update on this issue?

mesolutionsN commented 3 years ago

Is there any further fix or workaround possible?

huylg commented 3 years ago

does anyone have a solution for this issue? I am getting the same issue :(

LSambo02 commented 3 years ago

For me it was getting this error for using incompatible packages with Sound Null-Safety. After I rolled back to an sdk version prior to 2.7 (dart) and got rid of all the package versions related to null-safety it worked.

EDIT 1: Another point to peer attention is to make sure you are using the latest appium flutter driver, currently on 0.0.28

ravireddy07 commented 2 years ago

i'm getting the tree like this:

npm list -g appium-flutter-driver

/usr/local/lib
└── appium-flutter-driver@0.0.25 
└─┬ appium@1.19.0-beta.0
       └── appium-flutter-driver@0.0.32 
KazuCocoa commented 2 years ago

Note that flutter_driver package is needed for this driver instead of integration_test

jackgitsource commented 2 years ago

I encountered this problem and I solved it.

Upgrade the fluent SDK to the latest version. Mine is

Use the fluent create command to create a new project

Migrate your old project business code to the new project

configure enableFlutterDriverExtension

flutter clean && flutter build apk --debug

prolificcoder commented 2 years ago

This problem is still happening to me on both iOS or Android and even on a physical device. For the small sample apps I was able to add the enableFlutterDriverExtension() call https://github.com/appium-userland/appium-flutter-driver/pull/256 and it works.

But when I add this enableFlutterDriverExtension on my PROD app I am getting the following error and the app hangs

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: 'package:flutter_driver/src/extension/extension.dart': Failed assertion: line 222 pos 10: 'WidgetsBinding.instance == null': is not true.
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2      enableFlutterDriverExtension (package:flutter_driver/src/extension/extension.dart:222:10)
#3      main (package:sofi_x_package/main.dart:19:3)
#4      main (package:sofi_x_flutter/main.dart:4:9)
#5      main (file:///Users/smalugu/code/sofi-x/.dart_tool/flutter_build/generated_main.dart:212:42)
#6      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:128:38)
#7      _rootRun (dart:async/zone.dart:1426:13)
#8      _CustomZone.run (dart:async/zone.dart:1328:19)
#9      _runZoned (dart:async/zone.dart:1861:10)
#10     runZonedGuarded (dart:async/zone.dart:1849:12)
#11     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:126:5)<…>

Are there any known workarounds?

Looks like google's moving away from flutter_driver for integration tests to integration_test and appium_flutter_driver is depending on this old driver. This seems like a fundamental issue? Am i missing something, why is this issue closed?

brolund commented 1 year ago

TL;DR: Use capability 'fullReset': true to clear out artefacts from builds without enableFlutterDriverExtension();.

I had the same problem in Appium 2.0.0-beta.46, and first it worked and then it didn't. It wasn't intermittently failing, but rather it worked at first, and then stubbornly it didn't.

I can reproduce the problem (and fix it) this way: Regular build = app without enableFlutterDriverExtension(); Test build = app with enableFlutterDriverExtension();

1) Deploy Regular build to device. 2) Run appium with Test build without capability 'fullReset': true -> "ext.flutter.driver" is not found in "extensionRPCs" 3) Run appium with Test build with capability 'fullReset': true -> Works as expected 4) Deploy Regular build to device. 5) Run appium with Test build without capability 'fullReset': true -> "ext.flutter.driver" is not found in "extensionRPCs" 6) Run appium with Test build with capability 'fullReset': true -> Works as expected

From this, I'd say there is a problem with cleaning out artefacts from previous deploys. I'm not sure this is the problem everyone is having, but there seems to be a pattern here worth investigating.

MatteoAntolini commented 1 year ago

Solved by adding

dev_dependencies:
 flutter_driver:
    sdk: flutter

And then starting the client with capability 'appium:fullReset': true,

LSambo02 commented 1 year ago

This problem is still happening to me on both iOS or Android and even on a physical device. For the small sample apps I was able to add the enableFlutterDriverExtension() call #256 and it works.

But when I add this enableFlutterDriverExtension on my PROD app I am getting the following error and the app hangs

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: 'package:flutter_driver/src/extension/extension.dart': Failed assertion: line 222 pos 10: 'WidgetsBinding.instance == null': is not true.
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2      enableFlutterDriverExtension (package:flutter_driver/src/extension/extension.dart:222:10)
#3      main (package:sofi_x_package/main.dart:19:3)
#4      main (package:sofi_x_flutter/main.dart:4:9)
#5      main (file:///Users/smalugu/code/sofi-x/.dart_tool/flutter_build/generated_main.dart:212:42)
#6      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:128:38)
#7      _rootRun (dart:async/zone.dart:1426:13)
#8      _CustomZone.run (dart:async/zone.dart:1328:19)
#9      _runZoned (dart:async/zone.dart:1861:10)
#10     runZonedGuarded (dart:async/zone.dart:1849:12)
#11     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:126:5)<…>

Are there any known workarounds?

Looks like google's moving away from flutter_driver for integration tests to integration_test and appium_flutter_driver is depending on this old driver. This seems like a fundamental issue? Am i missing something, why is this issue closed?

Are you using the release or debug apk? Asking because you say "PROD", and it only runs correctly if it's a debug apk.

ehabibov commented 1 year ago

Okay, I spent 5+ hours for my case. Having production app with a lot of code I also faced this error on my Samsung. Interesting that sample apk worked fine, but mine - not (seen similar cases here).

If someone get into this thread again or first time - try placing your enableFlutterDriverExtension(); at the very first line in main() method, i.e. as earlier as possible.

2023-01-03_17-31-05

appium --version
2.0.0-beta.48

appium driver list
flutter@1.11.0 [installed (NPM)]

flutter --version
Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 135454af32 (3 weeks ago) • 2022-12-15 07:36:55 -0800
Engine • revision 3316dd8728
Tools • Dart 2.18.6 • DevTools 2.15.0

Inspector caps:
{
  "platformName": "Android",
  "appium:deviceName": "<my device udid>",
  "appium:app": "<my apk path>",
  "appium:noReset": false,
  "appium:automationName": "Flutter",
  "appium:fullReset": true,
  "appium:maxRetryCount": "10"
}

P.S.: assumption - seems only works with "reset" cap as using app package/activity loses observatory URL, i.e. url might be printed only once at first interaction with application.

If that helped - kudos to this post to see how much of us were suffering.

prolificcoder commented 1 year ago

Kind of a tangent but I discovered https://patrol.leancode.co/ and they said they support hybrid apps too. Worth a shot?

On Tue, Jan 3, 2023, 7:49 AM ehabibov @.***> wrote:

Okay, I spent 5+ hours for my case. Having production app with a lot of code I also faced this error on my Samsung. Interesting that sample apk https://github.com/appium-userland/appium-flutter-driver/tree/main/example/sample2 worked fine, but mine - not (seen similar cases here).

If someone get into this thread again or first time - try placing your enableFlutterDriverExtension(); the very first line in main() https://github.com/appium-userland/appium-flutter-driver/blob/main/example/flutter_app_under_test/lib/main.dart#L9 method, i.e. as earlier as possible.

[image: 2023-01-03_17-31-05] https://user-images.githubusercontent.com/20490584/210389944-b4234f1d-6767-48df-bd56-96ce4c7035f0.jpeg

appium --version

2.0.0-beta.48

appium driver list

@.*** [installed (NPM)]

flutter --version

Flutter 3.3.10 • channel stable • https://github.com/flutter/flutter.git

Framework • revision 135454af32 (3 weeks ago) • 2022-12-15 07:36:55 -0800

Engine • revision 3316dd8728

Tools • Dart 2.18.6 • DevTools 2.15.0

Inspector caps:

{

"platformName": "Android",

"appium:deviceName": "",

"appium:app": "",

"appium:noReset": false,

"appium:automationName": "Flutter",

"appium:fullReset": true,

"appium:maxRetryCount": "10"

}

P.S.: assumption - seems only works with "reset" cap as using app package/activity loses observatory URL, i.e. url might be printed only once at first interaction with application.

If that helped - kudos to this post to see how much of us were suffering.

— Reply to this email directly, view it on GitHub https://github.com/appium-userland/appium-flutter-driver/issues/28#issuecomment-1369926001, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABENOEJKWKR4VIYW2WWIVDWQRDAJANCNFSM4JX5FIHA . You are receiving this because you commented.Message ID: @.***>