I have created an automation project to test a flutter app using appium flutter driver. But I cannot use flutter driver.
My automation project does not detect automationName as flutter. Even if I try driver.context("FLUTTER"); I get NoSuchContextException error.
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);
Solution 1: dmle
Make sure your Appium server version is above 1.6
There shouldn't be anything specific with Java client, just try to change your capabilities this way:
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);
Next time post Appium server log :)