Skip to content

Instantly share code, notes, and snippets.

@shapovalovei
Created April 27, 2017 09:58
Show Gist options
  • Save shapovalovei/cb1c7bc376609fb89af9d7b91e66f03f to your computer and use it in GitHub Desktop.
Save shapovalovei/cb1c7bc376609fb89af9d7b91e66f03f to your computer and use it in GitHub Desktop.
Start Appium Service
/**
* Function for creating appium service
*/
private static void startAppiumService() {
if (service == null) {
int appiumPort = Integer.parseInt(Config.APPIUM_PORT);
int proxyPort = Integer.parseInt(Config.PROXY_PORT);
if (Config.PLATFORM_NAME.equals("iOS")) {
iOSProxyRunner(proxyPort);
}
killAppiumServer(appiumPort);
log.info("");
log.info("******************************* STARTING APPIUM SERVICE ***********************************");
log.info("APPIUM PORT: " + appiumPort);
log.info("IOS WEB PROXY PORT: " + proxyPort);
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
serviceBuilder.usingPort(appiumPort);
if (Config.PLATFORM_NAME.equals("iOS")) {
serviceBuilder.withArgument(IOSServerFlag.WEBKIT_DEBUG_PROXY_PORT, String.valueOf(proxyPort));
//serviceBuilder.withArgument(GeneralServerFlag.LOG_LEVEL, "warn");
serviceBuilder.withArgument(GeneralServerFlag.SESSION_OVERRIDE);
}
service = AppiumDriverLocalService.buildService(serviceBuilder);
service.start();
log.info("APPIUM URL: " + service.getUrl());
log.info("*******************************************************************************************");
log.info("");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment