InternetExplorerDriverService.Builder serviceBuilder = new InternetExplorerDriverService.Builder().usingAnyFreePort(); InternetExplorerDriverService service = serviceBuilder.build(); WebDriver ie = new InternetExplorerDriver(service); // Open your URL: ie.get("http://www.google.com");
InternetExplorerDriverService.Builder ieDriverService = new InternetExplorerDriverService.Builder().withSilent(true); WebDriver driver = new InternetExplorerDriver(ieDriverService.build());
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; } }
return builder.build();
@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(); } }
public static InternetExplorerDriver createIeDriver(@Nullable String browserPath, @Nullable BrowserConfig config) { if (noBrowserPath(browserPath) && noServicePath(config)) { return createDefaultDriver(); } else { final InternetExplorerDriverService service = setBrowserExecutablePath(browserPath, setServiceExecutablePath(config, new InternetExplorerDriverService.Builder())) .usingAnyFreePort() .build(); return new InternetExplorerDriver(service); } }
@Override public WebDriver newInstance(DriverOptions driverOptions) { if (!OS.isFamilyWindows()) throw new UnsupportedOperationException("Unsupported platform: " + Platform.getCurrent()); InternetExplorerDriverService service = setupBuilder(new InternetExplorerDriverService.Builder(), driverOptions, IEDRIVER).build(); InternetExplorerOptions options = newInternetExplorerOptions(driverOptions); options.merge(driverOptions.getCapabilities()); InternetExplorerDriver driver = new InternetExplorerDriver(service, options); setInitialWindowSize(driver, driverOptions); return driver; } }
/** * Configures and returns a new {@link InternetExplorerDriverService} using the default configuration. In * this configuration, the service will use the IEDriverServer executable identified by the * {@link #IE_DRIVER_EXE_PROPERTY} system property. Each service created by this method will * be configured to use a free port on the current system. * * @return A new InternetExplorerDriverService using the default configuration. */ public static InternetExplorerDriverService createDefaultService() { return new Builder().build(); }
@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; }