Skip to content

Commit 77445ff

Browse files
committed
Improving error messages if the driver server can't start in the given time, Fixes #4403
1 parent 9bd5351 commit 77445ff

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

java/client/src/org/openqa/selenium/net/UrlChecker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.concurrent.ExecutorService;
3535
import java.util.concurrent.Executors;
3636
import java.util.concurrent.TimeUnit;
37+
import java.util.concurrent.TimeoutException;
3738
import java.util.concurrent.atomic.AtomicInteger;
3839
import java.util.logging.Logger;
3940

@@ -97,7 +98,7 @@ public void waitUntilAvailable(long timeout, TimeUnit unit, final URL... urls)
9798
sleepMillis = (sleepMillis >= MAX_POLL_INTERVAL_MS) ? sleepMillis : sleepMillis * 2;
9899
}
99100
}, timeout, unit);
100-
} catch (UncheckedTimeoutException e) {
101+
} catch (UncheckedTimeoutException | java.util.concurrent.TimeoutException e) {
101102
throw new TimeoutException(String.format(
102103
"Timed out waiting for %s to be available after %d ms",
103104
Arrays.toString(urls), MILLISECONDS.convert(System.nanoTime() - start, NANOSECONDS)), e);

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,7 @@ protected static void checkExecutable(File exe) {
149149
public boolean isRunning() {
150150
lock.lock();
151151
try {
152-
if (process == null) {
153-
return false;
154-
}
155-
return process.isRunning();
152+
return process != null && process.isRunning();
156153
} catch (IllegalThreadStateException e) {
157154
return true;
158155
} finally {
@@ -189,7 +186,7 @@ protected void waitUntilAvailable() throws MalformedURLException {
189186
URL status = new URL(url.toString() + "/status");
190187
new UrlChecker().waitUntilAvailable(20, SECONDS, status);
191188
} catch (UrlChecker.TimeoutException e) {
192-
if (process != null) {
189+
if (process != null && !process.isRunning()) {
193190
process.checkForError();
194191
}
195192
throw new WebDriverException("Timed out waiting for driver server to start.", e);

0 commit comments

Comments
 (0)