EdgeDriverService service = new EdgeDriverService.Builder() .usingDriverExecutable(new File("path/to/my/MicrosoftWebDriver.exe")) .usingAnyFreePort() .build(); service.start(); WebDriver driver = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.edge()); driver.get("www.google.com");
@Override protected EdgeDriverService newDriverService() { EdgeDriverService newService = new EdgeDriverService.Builder() .usingDriverExecutable(edgeDriverExecutable()) .usingAnyFreePort() .build(); DriverPathConfiguration.updateSystemProperty(WEBDRIVER_EDGE_DRIVER.getPropertyName()) .withExecutablePath(edgeDriverExecutable()); Runtime.getRuntime().addShutdownHook(new StopServiceHook(newService)); return newService; }
@Override public WebDriver newInstance(DriverOptions driverOptions) { if (!OS.isFamilyWindows()) throw new UnsupportedOperationException("Unsupported platform: " + Platform.getCurrent()); EdgeDriverService service = setupBuilder(new EdgeDriverService.Builder(), driverOptions, EDGEDRIVER).build(); EdgeOptions options = newEdgeOptions(driverOptions); options.merge(driverOptions.getCapabilities()); EdgeDriver driver = new EdgeDriver(service, options); setInitialWindowSize(driver, driverOptions); return driver; } }
/** * Configures and returns a new {@link EdgeDriverService} using the default configuration. In * this configuration, the service will use the MicrosoftWebDriver executable identified by the * {@link #EDGE_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 EdgeDriverService using the default configuration. */ public static EdgeDriverService createDefaultService() { return new Builder().build(); }