public static AppiumDriverLocalService buildDefaultService() { return buildService(new AppiumServiceBuilder()); }
public static AppiumDriverLocalService buildDefaultService() { return buildService(new AppiumServiceBuilder()); }
/** * @author wasiq.bhamla * @since 12-Apr-2017 5:23:19 PM */ public void start () { log.trace ("Starting Appium Service..."); if (!this.setting.isExternal () && !this.setting.isCloud ()) { this.service = AppiumDriverLocalService.buildService (this.builder); try { this.service.start (); } catch (final AppiumServerHasNotBeenStartedLocallyException e) { fail (AppiumServerNotStartingError.class, "Error occured while starting Appium server", e); } catch (final Exception e) { fail (AppiumServerAlreadyRunningError.class, "Appium server is running already.", e); } log.trace ("Appium Service Started..."); } else { if (isRunning ()) { log.trace ("Appium Service is already running..."); } } }
private URL localServerUrlFor(String deviceName) { LOGGER.info("Finding local appium server for " + deviceName); DriverService appiumDriverService = null; try { if (appiumServers.get(deviceName) != null) { appiumDriverService = appiumServers.get(deviceName); if(!appiumDriverService.isRunning()) { LOGGER.info(" -> Restarting local appium server " + appiumDriverService.getUrl()); appiumDriverService.start(); } return appiumDriverService.getUrl(); } LOGGER.info("No local appium server found for " + deviceName + " - starting a new one"); appiumDriverService = AppiumDriverLocalService.buildService(new AppiumServiceBuilder().withIPAddress("127.0.0.1"). withArgument(GeneralServerFlag.SESSION_OVERRIDE).usingAnyFreePort()); LOGGER.info("Starting service..."); appiumDriverService.start(); LOGGER.info("Service started: " + appiumDriverService.getUrl()); appiumServers.put(deviceName, appiumDriverService); index(appiumDriverService); LOGGER.info("Local appium server for " + deviceName + " started on " + appiumDriverService.getUrl()); logStatus(); return appiumDriverService.getUrl(); } catch (Throwable e) { LOGGER.info("Failed to start appium service on " + appiumDriverService.getUrl()); e.printStackTrace(); LOGGER.error("Failed to start appium service on " + appiumDriverService.getUrl()); throw new WebDriverException("Failed to start appium service on " + appiumDriverService.getUrl(), e); } }