Webdriver hangs for ~1 minute even if chromedriver exits immediately
This isn't a direct problem with webdriver, but it does make diagnosing other problems harder. I had a bug in my chromedriver wrapper script, and it was exiting immediately. But webdriver will hang for a minute before reporting a problem, and will just report a timeout, not that the chromedriver failed/exited.
I believe the core of the problem is in javascript/node/selenium-webdriver/remote/index.js where the command.result().then handler will not kick the httpUtil.waitForServer in the case the command exits early/immediately.
The patch below demonstrates the problem by adding a test for using /bin/false as the chromedriver. It times out after a minute.
diff --git a/javascript/node/selenium-webdriver/test/chrome/options_test.js b/javascript/node/selenium-webdriver/test/chrome/options_test.js
index eab3070..39524b9 100644
--- a/javascript/node/selenium-webdriver/test/chrome/options_test.js
+++ b/javascript/node/selenium-webdriver/test/chrome/options_test.js
@@ -204,7 +204,7 @@ test.suite(function(env) {
driver.quit();
});
- describe('Chrome options', function() {
+ describe.only('Chrome options', function() {
test.it('can start Chrome with custom args', function() {
var options = new chrome.Options().
addArguments('user-agent=foo;bar');
@@ -219,5 +219,16 @@ test.suite(function(env) {
'return window.navigator.userAgent');
assert(userAgent).equalTo('foo;bar');
});
+
+ test.it('can catch bad startup script', function() {
+ var options = new chrome.Options().
+ setChromeBinaryPath('/bin/false');
+
+ driver = env.builder().
+ setChromeOptions(options).
+ build();
+
+ driver.get('nothing');
+ });
});
}, {browsers: ['chrome']});
Thanks for the quick fix!