elias-berg
elias-berg

Reputation: 559

Selenium always times out waiting for server to start

So recently I upgraded to Selenium 3.5.0 and Chromedriver 2.32.

Every time I run my program, which stopped working shortly before upgrading anyway, I've been getting this error:

Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'XXXX', ip: '192.168.171.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: ChromeDriver

It's implemented such that you click a button on a GUI which starts a thread that starts the class that contains the WebDriver object:

try {
      driver = DriverFactory.createDriver( Browser.CHROME, run_type );
      if ( run_type == Type.WEB )
        webSetup();
      else
        mobileSetup();
}
...
finally {
      if ( driver != null ) 
        driver.quit();
}

The createDriver function calls createChromeDriver, which is as simple as:

private static ChromeDriver createChromeDriver(Run.Type t)
{
    System.setProperty( "webdriver.chrome.driver", Properties.server() );
    System.setProperty( "webdriver.chrome.driver.host", "127.0.0.1" ); 

    ChromeOptions options = new ChromeOptions();
    options.addArguments("--disable-extensions");

    if ( t == Type.MOBILE )
    {
      Map<String, String> mobileEmulation = new HashMap<String, String>();
      mobileEmulation.put("deviceName", "Apple iPhone 6");
      options.setExperimentalOption("mobileEmulation", mobileEmulation);
    }

    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    return new ChromeDriver(capabilities);
}

The server() points directly to the chromedriver.exe, which I've made sure of.

I've even tried running the PhantomJS example on https://www.guru99.com/selenium-with-htmlunit-driver-phantomjs.html, only to get the same error, but with the driver info pointing to PhantomJS (go figure).

The weirdest thing is that the chromedriver.exe process actually starts in the background and if I try to run the program multiple times, multiple chromedriver processes will have spawned.

Any ideas?

Upvotes: 0

Views: 1162

Answers (2)

Mohith
Mohith

Reputation: 115

I had a similar issue and found that in /etc/hosts 127.0.0.1 was not binded to localhost.

Adding 127.0.0.1 localhost in the etc/hosts file solved the issue.

Try removing any other bindings to localhost and just keep 127.0.0.1

Upvotes: 0

neonidian
neonidian

Reputation: 1263

I had a similar kind of problem when i upgraded. Found out that my anti virus was blocking from running the chromedriver executable since it was fairly new and the anti virus software did not have it in their central repo of trusted executables.

Try disabling the anti virus software if you have any.

Upvotes: 3

Related Questions