|
21 | 21 |
|
22 | 22 | import org.openqa.selenium.Beta; |
23 | 23 | import org.openqa.selenium.Capabilities; |
| 24 | +import org.openqa.selenium.ImmutableCapabilities; |
24 | 25 | import org.openqa.selenium.WebDriverException; |
25 | 26 | import org.openqa.selenium.internal.Require; |
26 | 27 | import org.openqa.selenium.net.PortProber; |
@@ -141,6 +142,10 @@ protected URL getUrl(int port) throws IOException { |
141 | 142 | return new URL(String.format("http://localhost:%d", port)); |
142 | 143 | } |
143 | 144 |
|
| 145 | + protected Capabilities getDefaultDriverOptions() { |
| 146 | + return new ImmutableCapabilities(); |
| 147 | + } |
| 148 | + |
144 | 149 | /** |
145 | 150 | * @return The base URL for the managed driver server. |
146 | 151 | */ |
@@ -178,7 +183,10 @@ public void start() throws IOException { |
178 | 183 | return; |
179 | 184 | } |
180 | 185 | if (this.executable == null) { |
181 | | - this.executable = DriverFinder.getPath(this); |
| 186 | + if (getDefaultDriverOptions().getBrowserName().isEmpty()) { |
| 187 | + throw new WebDriverException("Driver executable is null and browser name is not set."); |
| 188 | + } |
| 189 | + this.executable = DriverFinder.getPath(this, getDefaultDriverOptions()); |
182 | 190 | } |
183 | 191 | process = new CommandLine(this.executable, args.toArray(new String[]{})); |
184 | 192 | process.setEnvironmentVariables(environment); |
@@ -272,7 +280,7 @@ public void stop() { |
272 | 280 | if (getOutputStream() instanceof FileOutputStream) { |
273 | 281 | try { |
274 | 282 | getOutputStream().close(); |
275 | | - } catch (IOException e) { |
| 283 | + } catch (IOException ignore) { |
276 | 284 | } |
277 | 285 | } |
278 | 286 | } finally { |
|
0 commit comments