Skip to content

Commit d5d3cb4

Browse files
committed
Implementing ability to not send shutdown command to the driver servers that don't support it.
1 parent d17e0ac commit d5d3cb4

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

java/client/src/org/openqa/selenium/firefox/GeckoDriverService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ protected void waitUntilAvailable() throws MalformedURLException {
9797
PortProber.waitForPortUp(getUrl().getPort(), 20, SECONDS);
9898
}
9999

100+
@Override
101+
protected boolean hasShutdownEndpoint() {
102+
return false;
103+
}
104+
100105
/**
101106
* Builder used to configure new {@link GeckoDriverService} instances.
102107
*/

java/client/src/org/openqa/selenium/remote/service/DriverService.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected void waitUntilAvailable() throws MalformedURLException {
194194
}
195195

196196
/**
197-
* Stops this service is it is currently running. This method will attempt to block until the
197+
* Stops this service if it is currently running. This method will attempt to block until the
198198
* server has been fully shutdown.
199199
*
200200
* @see #start()
@@ -208,13 +208,15 @@ public void stop() {
208208
return;
209209
}
210210

211-
try {
212-
URL killUrl = new URL(url.toString() + "/shutdown");
213-
new UrlChecker().waitUntilUnavailable(3, SECONDS, killUrl);
214-
} catch (MalformedURLException e) {
215-
toThrow = new WebDriverException(e);
216-
} catch (UrlChecker.TimeoutException e) {
217-
toThrow = new WebDriverException("Timed out waiting for driver server to shutdown.", e);
211+
if (hasShutdownEndpoint()) {
212+
try {
213+
URL killUrl = new URL(url.toString() + "/shutdown");
214+
new UrlChecker().waitUntilUnavailable(3, SECONDS, killUrl);
215+
} catch (MalformedURLException e) {
216+
toThrow = new WebDriverException(e);
217+
} catch (UrlChecker.TimeoutException e) {
218+
toThrow = new WebDriverException("Timed out waiting for driver server to shutdown.", e);
219+
}
218220
}
219221

220222
process.destroy();
@@ -228,6 +230,10 @@ public void stop() {
228230
}
229231
}
230232

233+
protected boolean hasShutdownEndpoint() {
234+
return true;
235+
}
236+
231237
public void sendOutputTo(OutputStream outputStream) {
232238
this.outputStream = Preconditions.checkNotNull(outputStream);
233239
}

0 commit comments

Comments
 (0)