Search code examples
google-chromeseleniumgridselenium-chromedriverremotewebdriver

Can't create Chrome RemoteWebDriver in Selenium Grid


I've been struggling with this issue for couple of days now. I can't create RemoteWebDriver using Chrome in Selenium Grid.

The hub, node and Eclipse (which triggers the tests) are running on one machine but I also tried multiple machines.

I'm getting exception in Eclipse:

Caused by: org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist

Here is what node log says:

11:57:26.208 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory 
org.openqa.selenium.remote.server.ServicedSession$Factory (provider: 
org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) 
on port 32456
Only local connections are allowed.
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab)     on port 9515
Only local connections are allowed.
11:58:26.903 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome",
  "goog:chromeOptions": {
    "args": [
      "--no-sandbox",
      "--disable-dev-shm-usage",
      "--log-level=DEBUG",
     "--dns-prefetch-disable"
    ],
"extensions": [
],
"useAutomationExtension": false,
"binary": "chromedriver.exe"
  }
}
11:58:26.903 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory         org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 11072
Only local connections are allowed.
Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 9515
Only local connections are allowed.
[1530698307.499][SEVERE]: bind() returned an error: Tylko jedno u┐ycie ka┐dego adresu gniazda (protokˇ│/adres sieciowy/port) jest normalnie dozwolone. (0x2740)
IPv4 port not ava[i1lable. Exiting...
530698307.499][INFO]: listen on IPv4 failed with error ERR_ADDRESS_IN_USE

I'm wondering what causes two ChromeDrivers to start and the second one always starts on port 9515. I'm using Chrome v67 and Driver 2.40.

Here is my code:

ChromeOptions options = new ChromeOptions();
        options.addArguments("--no-sandbox");
        options.addArguments("--disable-dev-shm-usage");
        options.addArguments("--log-level=DEBUG");
        options.addArguments("--dns-prefetch-disable");
        options.setExperimentalOption("useAutomationExtension", false);
            try {
            WebDriver rwb = new RemoteWebDriver(new URL(hubAddress), options);
            return rwb;
            } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            }

I've tried everything you can find in Google or here, on Stack. Nothing helps. Any suggestions will be highly appreciated. Thanks in advance.


Solution

  • The solution for this problem is passing chromedriver path like below

    java -jar -Dwebdriver.chrome.driver=/Users/UserName/Desktop/chromedriver24 selenium-server-standalone-3.13.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=chrome,maxInstances=3

    instead of using parameter chrome_binary