private static InternetExplorerDriverService.Builder setServiceExecutablePath(BrowserConfig browserConfig, InternetExplorerDriverService.Builder builder) { if (hasServicePath(browserConfig)) { File profilePath = new File(browserConfig.getProfilePath()); File ieDriverFile = new File(profilePath, IE_SERVICE_EXECUTABLE); if (ieDriverFile.isFile()) { builder.usingDriverExecutable(ieDriverFile); } } return builder; }
private InternetExplorerDriverService getThreadService() { InternetExplorerDriverService service = services.get(currentThreadName()); if (service != null) { return service; } try { service = new InternetExplorerDriverService.Builder().usingDriverExecutable(new File(getInternetExplorerDriverPath())).build(); service.start(); services.put(currentThreadName(), service); } catch (IOException e) { LOGGER.error("Failed to start chrome service"); service = null; } return service; } }
@Override protected InternetExplorerDriverService newDriverService() { InternetExplorerDriverService newService = new InternetExplorerDriverService.Builder() .usingDriverExecutable(driverExecutable()) .usingAnyFreePort() .build(); DriverPathConfiguration.updateSystemProperty(WEBDRIVER_IE_DRIVER.getPropertyName()) .withExecutablePath(driverExecutable()); Runtime.getRuntime().addShutdownHook(new StopServiceHook(newService)); return newService; }
@Override public DriverService createDriverService() { Builder builder = new InternetExplorerDriverService.Builder(); if (port != null) builder.usingPort(port); if (driverExecutable != null) builder.usingDriverExecutable(driverExecutable); if (environment != null) builder.withEnvironment(environment); if (logFile != null) builder.withLogFile(logFile); if (logLevel != null) builder.withLogLevel(InternetExplorerDriverLogLevel.valueOf(logLevel.toUpperCase())); if (host != null) builder.withHost(host); if (extractPath != null) builder.withExtractPath(extractPath); if (silent != null) builder.withSilent(silent); return builder.build(); } }