Skip to content

Commit 06a8a62

Browse files
committed
A better fix for service availability checking that works for both Chrome and Marionette
1 parent ffb124c commit 06a8a62

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import java.io.File;
2828
import java.io.IOException;
29+
import java.net.MalformedURLException;
2930

3031
/**
3132
* Manages the life and death of an GeckoDriver aka 'wires'.
@@ -63,6 +64,11 @@ public static GeckoDriverService createDefaultService() {
6364
return new Builder().usingAnyFreePort().build();
6465
}
6566

67+
@Override
68+
protected void waitUntilAvailable() throws MalformedURLException {
69+
return;
70+
}
71+
6672
/**
6773
* Builder used to configure new {@link GeckoDriverService} instances.
6874
*/

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,19 @@ public void start() throws IOException {
163163
process.copyOutputTo(System.err);
164164
process.executeAsync();
165165

166+
waitUntilAvailable();
167+
} finally {
168+
lock.unlock();
169+
}
170+
}
171+
172+
protected void waitUntilAvailable() throws MalformedURLException {
173+
try {
166174
URL status = new URL(url.toString() + "/status");
167175
new UrlChecker().waitUntilAvailable(20, SECONDS, status);
168176
} catch (UrlChecker.TimeoutException e) {
169177
process.checkForError();
170178
throw new WebDriverException("Timed out waiting for driver server to start.", e);
171-
} finally {
172-
lock.unlock();
173179
}
174180
}
175181

0 commit comments

Comments
 (0)