AppiumTestDistribution / appium-flutter-integration-driver

MIT License
27 stars 10 forks source link

not able to click on drop down on a flutter mobile app though appium automation using java #87

Open Rahul1970 opened 1 month ago

Rahul1970 commented 1 month ago

Hi saikrishna

I am working on automation of a flutter mobile application. i am trying to perform click on a component which is a dropdown i.e upon clicking on it a bottomsheet with a list of option appears which has flutter view as its default view. but i am not able to do so FlutterElement element3 = find.byValueKey("SALUTATION"); element3.click(); Even though in the log it is showing that the element exist it is not being clicked. Please help.

This is the log i am getting in console.

[581e94f6] [0m [38;5;147m[FlutterDriver@de42] [0m Calling AppiumDriver.click() with args: ["eyJrZXlWYWx1ZVR5cGUiOiJTdHJpbmciLCJrZXlWYWx1ZVN0cmluZyI6IlNBTFVUQVRJT04iLCJmaW5kZXJUeXBlIjoiQnlWYWx1ZUtleSJ9","581e94f6-74ce-4bc9-a042-22ece1b38aa0"] [38;5;64m[581e94f6] [0m [38;5;54m[FlutterDriver] [0m Executing Flutter driver command 'click' [38;5;64m[581e94f6] [0m [38;5;54m[FlutterDriver] [0m >>> {"command":"tap","keyValueType":"String","keyValueString":"SALUTATION","finderType":"ByValueKey"} [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Shutting down because we waited 240 seconds for a command [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Deleting UiAutomator2 session [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Stopping chromedriver for context WEBVIEW_com.mobile.offlineplay [38;5;64m[581e94f6] [0m [38;5;99m[Chromedriver@d73e] [0m Changed state to 'stopping' [38;5;64m[581e94f6] [0m [38;5;99m[Chromedriver@d73e] [0m Proxying [DELETE /] to DELETE [http://127.0.0.1:64855/session/8b85960b52fdf9e6fab23e62cc7502ff] with no body [38;5;64m[581e94f6] [0m [38;5;99m[Chromedriver@d73e] [0m Got response with status 200: {"value":null} [38;5;64m[581e94f6] [0m [38;5;99m[Chromedriver@d73e] [0m Changed state to 'stopped' [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Deleting UiAutomator2 server session [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Matched '/' to command name 'deleteSession' [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Proxying [DELETE /] to DELETE [http://127.0.0.1:8205/session/2503dedc-5458-4f6c-a090-5ea95eda24c1] with no body [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Got response with status 200: {"sessionId":"2503dedc-5458-4f6c-a090-5ea95eda24c1","value":null} [38;5;64m[581e94f6] [0m [38;5;229m[ADB] [0m Running 'C:\Users\Rahul.singh2\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys activity services io.appium.settings/.recorder.RecorderService' [38;5;64m[581e94f6] [0m [38;5;229m[ADB] [0m Running 'C:\Users\Rahul.singh2\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop com.mobile.offlineplay' [38;5;64m[581e94f6] [0m [38;5;160m[Logcat] [0m Stopping logcat capture [38;5;64m[581e94f6] [0m [38;5;229m[ADB] [0m Removing forwarded port socket connection: 8205 [38;5;64m[581e94f6] [0m [38;5;229m[ADB] [0m Running 'C:\Users\Rahul.singh2\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 forward --remove tcp:8205' [38;5;199m[a647ca52] [0m [38;5;54m[FlutterDriver] [0m Connection to ws://127.0.0.1:46319/PZs9h8uhwHg=/ws closed [38;5;64m[581e94f6] [0m [38;5;-181m[AndroidUiautomator2Driver@1b10] [0m Restoring hidden api policy to the device default configuration [38;5;64m[581e94f6] [0m [38;5;229m[ADB] [0m Running 'C:\Users\Rahul.singh2\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy'' [38;5;199m[a647ca52] [0m [38;5;74m[Instrumentation] [0m . [38;5;199m[a647ca52] [0m [38;5;74m[Instrumentation] [0m Time: 316.348 [0m The process has exited with code 0

saikrishna321 commented 1 month ago

@Rahul1970 looks like your using appium-flutter-driver and not appium-flutter-integration-driver

Rahul1970 commented 1 month ago

Hi Sai yes i am using appium-flutter-driver whom should i reach out to solve this issue.

saikrishna321 commented 1 month ago

@Rahul1970 appium-flutter-driver Any reason your using a driver which depends on deprecated sdk? https://github.com/AppiumTestDistribution/appium-flutter-integration-driver?tab=readme-ov-file#differences-from-appium-flutter-driver

thuonglai commented 1 month ago

hi @Rahul1970 . You can increase appium.newCommandTimeout. May be it interrupt because it

Rahul1970 commented 1 month ago

Hi Sai, Thanks for your reply.

i have installed npm install source = npm appium-flutter-driver from cmd line [Appium] Available drivers: [Appium] - uiautomator2@3.7.3 (automationName 'UiAutomator2') [Appium] - flutter@2.8.0 (automationName 'Flutter')

and in desired capability i have used UiAutomator2Options options = new UiAutomator2Options(); // DesiredCapabilities dc = new DesiredCapabilities(); options.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);// deviceName options.setCapability(MobileCapabilityType.UDID, deviceName); options.setCapability("autoGrantPermissions", true); // dc.setCapability(MobileCapabilityType.PLATFORM_VERSION,platformVersion); options.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); options.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir") + "/src/test/resources/apps/" + AppName); // options.setCapability("automationName","UiAutomator2");

        options.setCapability("automationName", "Flutter");

        options.setCapability("unicodeKeyboard", true);
        options.setCapability("flutter:enableFlutterDriver", true);
        options.setCapability("resetKeyboard", true);
        options.setCapability("printPageSourceOnFindFailure", true);
        options.setCapability("noReset", false);
        //options.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
        // dc.setCapability("forwardingPort ","45761");

        // dc.setCapability("autoWebview", true);
        // dc.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
        // dc.setCapability("appWaitForLaunch", false);

        // dc.setCapability("appPackage", "com..mobile");
        // dc.setCapability("appActivity", "com..mobile.MainActivity");

        options.setCapability("appPackage", "com.mobile.offlineplay");
        options.setCapability("appActivity", "com.mobile.offlineplay.MainActivity");
        //options.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 300);
        options.setCapability("newCommandTimeout", 600);

        options.setChromedriverExecutable(
                "C:\\Users\\Rahul.singh2\\.appium\\node_modules\\appium-flutter-driver\\node_modules\\appium-chromedriver\\chromedriver\\win\\chromedriver.exe");

        driver = new AndroidDriver(service.getUrl(), options);
Rahul1970 commented 1 month ago

Hi thuonglai, Thanksfor your reply. I have tried it already it didn't work. Please suggest what else can be tried.

saikrishna321 commented 1 month ago

@Rahul1970 you have installed a wrong a flutter driver package.

This is flutter integration.

Please follow readme

Rahul1970 commented 1 month ago

hi sai please suggest which driver to install and its command to install either through npm or appium command

saikrishna321 commented 1 month ago

@Rahul1970 please follow the readme of this repo

Sanmejie commented 6 days ago

Hi Sai, Do you have any recommendations for a Python-based testing framework for Flutter?