Nightwatch: selenium server hangs on "Starting selenium server..."

Created on 14 Mar 2018  路  5Comments  路  Source: nightwatchjs/nightwatch

When i type the command nightwatch --test dir/file.js, the selenium server starts and it is showing on the localhost:4444 but no test is starting....

Node version : 7.5.0
Nightwatch version : 0.9.20

This is my nightwatch.json file:

{
  "src_folders" : ["./automation-scripts"],
  "output_folder" : "./reports",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : true,
    "server_path" : "./bin/selenium-server-standalone-3.11.0.jar",
    "log_path" : "",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "./bin/chromedriver",
      "webdriver.gecko.driver" : "./bin/geckodriver",
      "webdriver.edge.driver" : ""
}
},

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost",
      "selenium_port" : 4444,
      "selenium_host" : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
},
      "desiredCapabilities": {
        "browserName": "chrome",
        "chromeOptions" : {
          "args" : ["start-maximized"]
}
   }
},

    "chrome" : {
      "desiredCapabilities": {
        "browserName": "chrome",
 "marionette": true
   }
},

    "edge" : {
      "desiredCapabilities": {
        "browserName": "MicrosoftEdge"
}
}
}
}

Most helpful comment

This will also happen if another process is using the port. You can use this command to kill those processes (most likely an older test that failed to terminate) kill -9 $(lsof -ti tcp:4444)

All 5 comments

I encountered the same problem just now as well. A week ago with the same config and no other related changed was working perfectly. Some advice what to try would be greatly appreciated.
This is my config:

var seleniumServer = require('selenium-server');
var chromedriver = require('chromedriver');
var geckodriver = require('geckodriver');

module.exports = {
  'src_folders': ['nightwatch/tests/'],
  'output_folder': './nightwatch/reports/',
  'custom_commands_path': './nightwatch/custom_commands/',
  'page_objects_path': './nightwatch/custom_pages/',
  'custom_assertions_path': './nightwatch/custom_assertions/',
  'live_output': false,
  'globals_path': './nightwatch/nightwatch.globals.js',
  'selenium': {
    'start_process': true,
    'server_path': seleniumServer.path,
    'log_path': './nightwatch/selenium_logs/',
    'port': 4444,
    'cli_args': {
      'webdriver.chrome.driver': chromedriver.path,
      'webdriver.gecko.driver': geckodriver.path,
    },
  },

  'test_settings': {
    'default': {
      'launch_url': 'http://localhost:8085',
      'selenium_port': 4444,
      'selenium_host': 'localhost',
      'silent': true,
      'end_session_on_fail': true,
      'skip_testcases_on_fail': false,
      'screenshots': {
        'enabled': true,
        'path': './nightwatch/screenshots/',
        'on_failure': true,
        'on_error': true,
      },
      'desiredCapabilities': {
        'browserName': 'chrome',
        "chromeOptions": {
          "args": [
            "window-size=1680,1050"
          ]
        },
        'javascriptEnabled': true,
        'acceptSslCerts': true,
      },
    },

    'firefox': {
      'end_session_on_fail': true,
      'desiredCapabilities': {
        'browserName': 'firefox',
        'marionette': true
      },
    },
  },
};

I ran into this after upgrading selenium server. Something seems to have changed in selenium server 3.10.0 that is incompatible with nightwatch. Downgrading to selenium server 3.9.1 fixes this issue for now until the incompatibility is resolved.

yes, downgrading seems to work. we are currently using version 3.7.1

This will also happen if another process is using the port. You can use this command to kill those processes (most likely an older test that failed to terminate) kill -9 $(lsof -ti tcp:4444)

This should be fixed in v1.0.4

Was this page helpful?
0 / 5 - 0 ratings