appium flatter driver | capabilities.setcapability(“automationname”,“flatter”)失败

hrirmatl  于 2021-07-08  发布在  Java
关注(0)|答案(1)|浏览(285)

我已经创建了一个自动化项目,使用appium flatter驱动程序测试flatter应用程序。但我不能用Flutter驱动器。
我的自动化项目没有将automationname检测为flatter。即使我尝试driver.context(“flutter”);我得到了nosuchcontextexception错误。

service = AppiumDriverLocalService
                  .buildService(new AppiumServiceBuilder()
                          .usingDriverExecutable(new File("/usr/local/bin/node"))
                          .withAppiumJS(
                                  new File("/usr/local/lib/node_modules/appium/build/lib/main.js"))
                          .withIPAddress("127.0.0.1").usingPort(4723));
    service.start();

        DesiredCapabilities capabilities = new DesiredCapabilities();
          File appDir = new File(System.getProperty("user.dir")+"/app");
          File app = new File (appDir,"app-debug.apk");
          capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
          capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
          capabilities.setCapability("automationName", "Flutter");
          capabilities.setCapability("appPackage", "com.example.flutter_intellij_test");
     capabilities.setCapability("appActivity","com.example.flutter_intellij_test.MainActivity");

        driver = new AndroidDriver<MobileElement>(service.getUrl(), capabilities);
        wait = new WebDriverWait(driver, 10);

        find = new FlutterFinder(driver);
fdbelqdn

fdbelqdn1#

确保您的appium服务器版本高于1.6
java客户机不应该有任何特定的功能,只要尝试以这种方式更改您的功能:

DesiredCapabilities capabilities = new DesiredCapabilities();
File appDir = new File(System.getProperty("user.dir")+"/app");
File app = new File (appDir,"app-debug.apk");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("automationName", "Flutter");
capabilities.setCapability("retryBackoffTime", "500");
capabilities.setCapability("deviceName", <value from `adb devices`>);
driver = new AndroidDriver<MobileElement>(service.getUrl(), capabilities);

下一次发布应用程序服务器日志:)

相关问题