Closed sai-saketh closed 9 months ago
Hey Hi, I hope Your Flutter app-under-test (AUT) must be compiled in debug because Flutter Driver does not support running in release mode. Also, ensure that your Flutter AUT has enableFlutterDriverExtension() before run the app. Then, please make sure your app imported flutter_driver package as its devDependencies as well.
Try to update appium appium@next version
Hi, Thanks for the reply. I have the app in debug mode and with all requirements to test flutter app, also I am using appium@next and with latest version of flutter driver. I will try to check the same in different machine.
Sure
Hello, First of all, great job on the repository! I have the exact same issue described in this thread. I'm not able to make the "byAncestor" or "byDescendant" finders locate the element (and interact with it) and getting the same error response in appium logs as detailed by sai-saketh. Has anyone been able to solve the issue?
Please attach the log it might help to debug the issue and make sure you selected the correct ancestor or descendent. Any issue please wright back
Facing same issue in java code when i try on javascript cardName = find.byValueKey("New 13 june"); matching1 = find.byValueKey("moreHoriz"); (await driver).touchClick(find.descendant({ of:cardName,matching:matching1,firstMatchOnly:true,matchRoot:true })); this is working but when in java it throws error "response": "Uncaught extension error while executing tap: type 'bool' is not a subtype of type 'Map<String, dynamic>' The issue is hashmap from dependantmethod
@sanjay7956 Can please attach the error log file?
appium.log here is the log @ashwithpoojary98
Can u please check the locator and its child locators? I will debug and update the issue.
I have a PR that fixes this issue: See PR #15
If you want the fix right away, you can add the jar file to your local maven repo using this branch on my repo to produce the artifact in GitHub Actions (see my mavenbuild.yml): https://github.com/guulp/javaflutterfinder/tree/with_github_actions_and_fix
Then just run:
mvn install:install-file \
-Dfile=appium_flutterfinder_java-1.0.4.jar \
-DgroupId=io.github.ashwithpoojary98 \
-DartifactId=appium_flutterfinder_java \
-Dversion=1.0.4 \
-Dpackaging=jar
I am trying to automate flutter applications using appium and this java flutter finder and when I try to pass elements to 'of' and 'matching' fields, they are not passing through the driver. I tried looking the code of appium-flutter-driver and the code had changed previously for those 2 functions and I can also see that this flutter finder class was updated after that code change. I am using "1.12.0" version of driver and latest build of this class and I couldnt figure out where this issue is happening. This is the code I used to automate: ` public static void main(String[] args) throws MalformedURLException, InterruptedException { // TODO Auto-generated method stub DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("deviceName", "vivo 1915"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("noReset", true); capabilities.setCapability("app", "D:\Documents\java_test\samples\provider_shopper\build\app\outputs\flutter-apk\app-debug.apk"); capabilities.setCapability("automationName", "Flutter"); driver = new AndroidDriver(new URL("http://localhost:4723"), capabilities); find = new FlutterFinder(driver); login(); } public static void login() throws InterruptedException { switchContext("NATIVE_APP"); //RemoteWebElement username = (RemoteWebElement) driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.View/android.view.View/android.view.View/android.view.View/android.widget.EditText[1]")); RemoteWebElement username = (RemoteWebElement) driver.findElement(By.xpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.View/android.view.View/android.view.View/android.widget.EditText[1]")); username.click(); Thread.sleep(2000); username.sendKeys("Username"); switchContext("FLUTTER"); Thread.sleep(2000); FlutterElement fe = find.bySemanticsLabel("Password"); //System.out.println(fe); fe.sendKeys("Password"); Thread.sleep(2000); FlutterElement te = find.byText("ENTER"); te.click(); Thread.sleep(3000); FlutterElement aa = find.byAncestor(find.byText("Code Smell"), find.byType("LimitedBox"), false, false); //System.out.println(aa); System.out.println(te); //find.byText("ADD").click();
`
And this is the log that I get from appium driver:
[debug] [FlutterDriver] Executing Flutter driver command 'click' [debug] [FlutterDriver] >>> **{"command":"tap","firstMatchOnly":"false","of":false,"finderType":"Descendant","matchRoot":"false","matching":false}** [debug] [FlutterDriver] <<< {"isError":true,"response":"Uncaught extension error while executing tap: type 'bool' is not a subtype of type 'Map<String, dynamic>' in type cast\n#0 Descendant.deserialize (package:flutter_driver/src/common/find.dart:327:58)\n#1 DeserializeFinderFactory.deserializeFinder (package:flutter_driver/src/common/deserialization_factory.dart:32:44)\n#2 FlutterDriverExtension.deserializeFinder (package:flutter_driver/src/extension/extension.dart:401:18)\n#3 new CommandWithTarget.deserialize (package:flutter_driver/src/common/find.dart:32:30)\n#4 new Tap.deserialize (package:flutter_driver/src/common/gesture.dart:13:60)\n#5 DeserializeCommandFactory.deserializeCommand (package:flutter_driver/src/common/deserialization_factory.dart:56:30)\n#6 FlutterDriverExtension.deserializeCommand (package:flutter_driver/src/extension/extension.dart:421:18)\n#7 FlutterDriverExtension.call (package:flutter_driver/src/extension/extension.dart:365:31)\n#8 BindingBase.registerServiceExtension.<anonymous closure> (package:flutter/src/foundation/binding.dart:856:32)\n<asynchronous suspension>\n","type":"_extensionType","method":"ext.flutter.driver"} | previous command tap [debug] [FlutterDriver@b604 (b335a082)] Encountered internal error running command: Error: Cannot execute command tap, server reponse { [debug] [FlutterDriver@b604 (b335a082)] "isError": true, [debug] [FlutterDriver@b604 (b335a082)] "response": "Uncaught extension error while executing tap: type 'bool' is not a subtype of type 'Map<String, dynamic>' in type cast\n#0 Descendant.deserialize (package:flutter_driver/src/common/find.dart:327:58)\n#1 DeserializeFinderFactory.deserializeFinder (package:flutter_driver/src/common/deserialization_factory.dart:32:44)\n#2 FlutterDriverExtension.deserializeFinder (package:flutter_driver/src/extension/extension.dart:401:18)\n#3 new CommandWithTarget.deserialize (package:flutter_driver/src/common/find.dart:32:30)\n#4 new Tap.deserialize (package:flutter_driver/src/common/gesture.dart:13:60)\n#5 DeserializeCommandFactory.deserializeCommand (package:flutter_driver/src/common/deserialization_factory.dart:56:30)\n#6 FlutterDriverExtension.deserializeCommand (package:flutter_driver/src/extension/extension.dart:421:18)\n#7 FlutterDriverExtension.call (package:flutter_driver/src/extension/extension.dart:365:31)\n#8 BindingBase.registerServiceExtension.<anonymous closure> (package:flutter/src/foundation/binding.dart:856:32)\n<asynchronous suspension>\n", [debug] [FlutterDriver@b604 (b335a082)] "type": "_extensionType", [debug] [FlutterDriver@b604 (b335a082)] "method": "ext.flutter.driver" [debug] [FlutterDriver@b604 (b335a082)] } [debug] [FlutterDriver@b604 (b335a082)] at FlutterDriver.executeElementCommand (C:\Users\739328\.appium\node_modules\appium-flutter-driver\lib\sessions\observatory.ts:175:11) [debug] [FlutterDriver@b604 (b335a082)] at processTicksAndRejections (node:internal/process/task_queues:95:5) [debug] [FlutterDriver@b604 (b335a082)] at FlutterDriver.tapEl (C:\Users\739328\.appium\node_modules\appium-flutter-driver\lib\commands\gesture.ts:17:10) [debug] [FlutterDriver@b604 (b335a082)] at FlutterDriver.click (C:\Users\739328\.appium\node_modules\appium-flutter-driver\lib\commands\gesture.ts:5:18) [HTTP] <-- POST /session/b335a082-f141-42c4-91ae-31c927e3cc2e/element/eyJmaXJzdE1hdGNoT25seSI6ImZhbHNlIiwib2YiOmZhbHNlLCJmaW5kZXJUeXBlIjoiRGVzY2VuZGFudCIsIm1hdGNoUm9vdCI6ImZhbHNlIiwibWF0Y2hpbmciOmZhbHNlfQ%3D%3D/click 500 301 ms - 3114
In above logs, we can see that 'false' is being sent for both 'of' and 'matching' fields. Any help is appreciated. Thank you.