My question is: how to update my setup in order to use W3C caps:
My current caps:
private static DesiredCapabilities getCaps() throws Exception {
MyLogger.log.info("Creating iosDriver caps for device: " + deviceID);
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "iOS");
caps.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.3.3");
caps.setCapability(MobileCapabilityType.DEVICE_NAME, DEVICE_NAME());
caps.setCapability(MobileCapabilityType.APP, APP_LOCATION());
caps.setCapability(MobileCapabilityType.UDID, DEVICE_ID());
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, AUTOMATION_NAME());
caps.setCapability(MobileCapabilityType.CLEAR_SYSTEM_FILES, true);
caps.setCapability(IOSMobileCapabilityType.WDA_CONNECTION_TIMEOUT, 60000);
caps.setCapability(IOSMobileCapabilityType.USE_NEW_WDA, true);
caps.setCapability(IOSMobileCapabilityType.COMMAND_TIMEOUTS, "12000");
caps.setCapability(IOSMobileCapabilityType.WDA_LOCAL_PORT, JavaHelpers.converStringToInt(WDA_PORT()));
caps.setCapability(IOSMobileCapabilityType.RESET_ON_SESSION_START_ONLY, true);
// caps.setCapability(IOSMobileCapabilityType.AUTO_ACCEPT_ALERTS, true);
if (!fullResetNeeded) {
caps.setCapability(MobileCapabilityType.NO_RESET, true);
}
return caps;
}
Server creation:
private static AppiumDriverLocalService createService() throws Exception {
Map<String, String> env = new HashMap<>(System.getenv());
env.put(“PATH”, “/usr/local/bin:” + env.get(“PATH”));
service = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File(nodeJS))
.withAppiumJS(new File(appiumJS))
.withIPAddress("0.0.0.0")
.usingAnyFreePort()
.withEnvironment(env)
.withStartUpTimeOut(120, TimeUnit.SECONDS)
.withArgument(IOSServerFlag.WEBKIT_DEBUG_PROXY_PORT, IOS_WEBKIT())
.withArgument(Arg.LOG_LEVEL, "warn"));
MyLogger.log.info("+++++++++++++++++++++++ STARTING APPIUM SERVER ++++++++++++++++++++++");
MyLogger.log.info(String.format(
"Appium server running for device with UDID: " + DEVICE_ID()));
MyLogger.log.info("++++++++++++++++++ STARTED APPIUM SERVER ++++++++++++++++++: " + service.getUrl());
return (AppiumDriverLocalService) service;
}
Driver creation:
public static void createiOSDriver() throws Exception {
String device = DEVICE_ID();
try {
deviceID = device;
if (useDevice(deviceID)) {
queueUp();
gracePeriod();
MyLogger.log.info("Trying to create new Driver for device: " + device);
createService().start();
Drivers.driverIos = getNewDriver((AppiumDriverLocalService) service, getCaps());
leaveQueue();
}
} catch (Exception e) {
e.printStackTrace();
//Ignore and try next device
}
}
Any suggestions?