The appium server (2.5.1) starts (image), but stops with error 500 because it says it cannot find UiAutomator2. This is supposed to be checked by the server at startup and if not installed. For CI this is logical.
AppiumServiceBuilder:
public static void appiumStart(DesiredCapabilities caps){
try {
AppiumServiceBuilder builder = new AppiumServiceBuilder();
service = AppiumDriverLocalService.buildService(builder);
builder
.withIPAddress("127.0.0.1")
.usingPort(AppiumServiceBuilder.DEFAULT_APPIUM_PORT)
.withArgument(BASEPATH, "/wd/hub")
.withArgument(GeneralServerFlag.SESSION_OVERRIDE)
.withArgument(GeneralServerFlag.LOG_LEVEL, "info")
.withCapabilities(caps)
.build();
service.start();
Sleep.forMillis(10000);
}catch (SessionNotCreatedException e){}
}
Capabilities:
private static AndroidDriver startApp(boolean noReset) {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", PropertyReader.getInstance().appiumPlatformname());
caps.setCapability("platformVersion", PropertyReader.getInstance().appiumPlatformVersion());
caps.setCapability("udid", PropertyReader.getInstance().appiumUdid());
caps.setCapability("automationName", PropertyReader.getInstance().appiumAutomationName());
caps.setCapability("app", PropertyReader.getInstance().appiumApp());
caps.setCapability("appWaitPackage", PropertyReader.getInstance().appiumAppPackage());
caps.setCapability("appWaitActivity", PropertyReader.getInstance().appiumAppActivity());
caps.setCapability("noReset", noReset);
appiumStart(caps);
try {
AndroidDriver appDriver = new AndroidDriver(service.getUrl(), caps);
return appDriver;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
What is the solution? Thanks in advance for your reply.