|
55 | 55 | import java.nio.file.Path;
|
56 | 56 | import java.util.Map;
|
57 | 57 | import java.util.Optional;
|
58 |
| -import java.util.ServiceLoader; |
59 |
| -import java.util.stream.StreamSupport; |
60 | 58 |
|
61 | 59 | /**
|
62 | 60 | * An implementation of the {#link WebDriver} interface that drives Firefox.
|
@@ -103,8 +101,9 @@ public FirefoxDriver(FirefoxDriverService service, Capabilities desiredCapabilit
|
103 | 101 | Require.nonNull("Driver service", service),
|
104 | 102 | new FirefoxOptions(desiredCapabilities));
|
105 | 103 | }
|
| 104 | + |
106 | 105 | public FirefoxDriver(FirefoxOptions options) {
|
107 |
| - this(toExecutor(options), options); |
| 106 | + this(new FirefoxDriverCommandExecutor(GeckoDriverService.createDefaultService()), options); |
108 | 107 | }
|
109 | 108 |
|
110 | 109 | public FirefoxDriver(FirefoxDriverService service) {
|
@@ -141,18 +140,6 @@ public static RemoteWebDriverBuilder builder() {
|
141 | 140 | return RemoteWebDriver.builder().oneOf(new FirefoxOptions());
|
142 | 141 | }
|
143 | 142 |
|
144 |
| - private static FirefoxDriverCommandExecutor toExecutor(FirefoxOptions options) { |
145 |
| - Require.nonNull("Options to construct executor from", options); |
146 |
| - |
147 |
| - FirefoxDriverService.Builder<?, ?> builder = |
148 |
| - StreamSupport.stream(ServiceLoader.load(DriverService.Builder.class).spliterator(), false) |
149 |
| - .filter(b -> b instanceof FirefoxDriverService.Builder) |
150 |
| - .map(FirefoxDriverService.Builder.class::cast) |
151 |
| - .findFirst().orElseThrow(WebDriverException::new); |
152 |
| - |
153 |
| - return new FirefoxDriverCommandExecutor(builder.withOptions(options).build()); |
154 |
| - } |
155 |
| - |
156 | 143 | /**
|
157 | 144 | * Check capabilities and proxy if it is set
|
158 | 145 | */
|
|
0 commit comments