I'm new to Selenium and Nightwatch and installed selenium-webdriver first, then chromedriver and finally I installed Nightwatch (because the syntax looks nice to me). Now when I want to run a single test with nightwatch, I always get this result:

> ./node_modules/nightwatch/bin/nightwatch -t nightwatch-node-scripts/test.js 

[Test] Test Suite

Running:  Demo test Google
Error processing the server response: 
 unknown command: wd/hub/session

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ value: -1, error: 'Unexpected token u in JSON at position 0' }

The chromedriver is running and listening on port 9515:

> lsof -Pnl +M -i4 | grep 9515
chromedri  6489     1000    8u  IPv4 867952      0t0  TCP (LISTEN)

which is the one I use in my pretty basic nightwatch.json:

    "src_folders": ["tests"],
    "output_folder": "reports",
    "custom_commands_path": "",
    "custom_assertions_path": "",
    "page_objects_path": "",
    "globals_path": "",

    "selenium": {
        "start_process": false,
        "server_path": "",
        "log_path": "",
        "port": 4444,
        "cli_args": {
            "webdriver.chrome.driver": "/usr/local/bin/chromedriver",
            "webdriver.gecko.driver": "",
            "webdriver.edge.driver": ""

    "test_settings": {
        "default": {
            "launch_url": "http://localhost",
            "selenium_port": 9515,
            "selenium_host": "localhost",
            "silent": true,
            "screenshots": {
                "enabled": false,
                "path": ""
            "desiredCapabilities": {
                "browserName": "chrome",
                "chromeOptions" : {
                    "args" : ["--no-sandbox"]
                "acceptsCerts" : true

        "chrome": {
            "desiredCapabilities": {
                "browserName": "chrome"
  • 2
    With that error message, I'm inclined to say that you need to have an active Selenium session to run your test.
    – Kate Paulk
    Dec 19, 2016 at 14:48
  • OK, thank you. My first understanding told me that chrome driver would replace the selenium server, which is why I was confused. Dec 19, 2016 at 23:05
  • 2
    Selenium Standalone Server can be used to define a 'hub' and 'nodes'. The hub distributes tests and the nodes run them (using WebDriver).
    – kirbycope
    Dec 21, 2016 at 17:08
  • stackoverflow.com/questions/27225118/… hope it help you @RSeidelsohn Jan 2, 2017 at 6:26

1 Answer 1


From Selenium Documentation:

You may, or may not, need the Selenium Server, depending on how you intend to use Selenium-WebDriver. If your browser and tests will all run on the same machine, and your tests only use the WebDriver API, then you do not need to run the Selenium-Server; WebDriver will run the browser directly.

There are some reasons though to use the Selenium-Server with Selenium-WebDriver.

You are using Selenium-Grid to distribute your tests over multiple machines or virtual machines (VMs). You want to connect to a remote machine that has a particular browser version that is not on your current machine. You are not using the Java bindings (i.e. Python, C#, or Ruby) and would like to use HtmlUnit Driver

  • Which brings up a question if Nightwatch can use Webdriver API. Judging from it having server_path and start_process options, it can't. Or am I wrong? Come to think of it which tools do you know that can? Does starting Selenium Server means Webdriver protocol (or what's its name) can't be used?
    – x-yuri
    Apr 19, 2018 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.