2

I have a Java Selenium project that will not run on my machine, but does run on coworkers' machines with the same OS version (OSX 10.13.1), Chrome browser version (63.0.3239.84), and chromedriver version (2.34). I get the message:

Starting ChromeDriver 2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e) on port 18633
Only local connections are allowed.

org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'localhost', ip: 'fe80:0:0:0:1cc9:e0ab:f4e5:dd34%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.1', java.version: '1.8.0_20'
Driver info: driver.version: ChromeDriver
...
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:18633/status] to be available after 20005 ms
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
    at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
    ... 28 more
Caused by: java.util.concurrent.TimeoutException
    at java.util.concurrent.FutureTask.get(FutureTask.java:205)
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:149)
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
    ... 29 more

however when I open http://localhost:18633/status in my browser I get a valid response:

{"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Mac OS X","version":"10.13.1"}}}

I've tried swapping out chromedriver binaries, but I'm not really sure what else to do. I get similar issues with geckodriver, but that may or may not be the same issue. I have also tried creating a new user on my system and running it from that account, to account for user settings - No luck.

What am I missing here? What info would be helpful to debug this problem?

Clay H
  • 651
  • 9
  • 21
  • same versions of Chrome browser? – Corey Goldberg Dec 14 '17 at 20:37
  • Yes, same version of Chrome. They get an "IllegalMonitorStateException" but it launches the chrome browser. My instance doesn't even do that – Clay H Dec 14 '17 at 21:11
  • did you give execute permissions to chromedriver? – Corey Goldberg Dec 15 '17 at 01:28
  • Yes, it has execute permission and if I run it directly I get the output 'Starting ChromeDriver 2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e) on port 9515 Only local connections are allowed.' – Clay H Dec 15 '17 at 14:10
  • i think the issue is that you have localhost resolving to an IPv6 address. – Corey Goldberg Dec 15 '17 at 15:09
  • I disabled ipv6 for wifi, and I still have the issue - output now includes System info: host: 'localhost', ip: '10.10.8.24', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.2', java.version: '1.8.0_20' – Clay H Dec 15 '17 at 15:26
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/161315/discussion-between-clay-h-and-corey-goldberg). – Clay H Dec 15 '17 at 16:06

1 Answers1

2

The error says it all :

org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.

Clearly indicates the WebDriver instance didn't get initiated. Hence Driver info is left blank as :

Driver info: driver.version: ChromeDriver

Which inturn produces the error:

org.openqa.selenium.net.UrlChecker$TimeoutException

and

java.util.concurrent.TimeoutException

It would be tough to guess the actual reason without any visibility of your code block but in general we can solve this by downloading the ChromeDriver binary from this repository and passing the absolute path of the ChromeDriver while initializing the WebDriver instance as follows :

System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
driver = new ChromeDriver();

Key Points :

  • Always use the latest version of the Selenium Client and ChromeDriver binaries.
  • Always keep the automatic updates for the browser enabled.
  • Always keep the JDK version updated (the current version being JDK 8u241)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I apologize, I apparently focused on the error I was getting and didn't see / omitted the initialization log. I've included it in the output now - it's clearly starting the driver (I can even connect to the endpoint) but for some reason selenium is unable to communicate with the chromedriver server – Clay H Dec 18 '17 at 14:20
  • The first 2 lines - Starting ChromeDriver 2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e) on port 18633 Only local connections are allowed. – Clay H Dec 18 '17 at 14:27
  • But you still face a `WebDriverException: Timed out waiting for driver server to start.` makes no difference to the apperant solution. Did you try out my Solution once? – undetected Selenium Dec 18 '17 at 14:29
  • 1
    I did try setting the system property, and got the same result. However, updating my JDK version seems to have fixed it, so I'll be marking this as the answer. Thanks for the suggestion! – Clay H Dec 18 '17 at 14:36