kev36663
kev36663

Reputation: 11

Nightwatch - Connection Refused! Is Selenium Server Started

I'm trying to configure Nightwatch and Selenium to try to create some web automation.

There's a lot within this that's very new to me and the company has not previously had an automation solution.

I have nightwatch 0.9.1.6 , nodes 8.9.0 , selenium java 3.6.0

I've been following this tutorial here > https://www.youtube.com/watch?v=93ndNx-h1ag < which was quite difficult to follow but I believe my steps match.

When running the google.js test which comes with Nightwatch I get the error back "Connection Refused is Selenium Server started?" and, well, it is. I started it.

my Json is included below, I'm guessing/hoping this is something straightforward - any help/guidance appreciated

{
  "src_folders" : ["tests"],
  "output_folder" : "/reports",
  "custom_commands_path" : "",
  "page_objects_path" : "./examples/pages",
  "custom_assertions_path" : "",
  "globals_path" : "",
  "live_output" : false,
  "parallel_process_delay" : 10,
  "disable_colors": false,
  "test_workers" : false,

  "selenium" : {
    "start_process" : false,
    "server_path" : "./selenium",
    "log_path" : "",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "",
      "webdriver.ie.driver" : "",
      "webdriver.firefox.profile" : ""
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost",
      "selenium_host" : "127.0.0.1",
      "selenium_port" : 4444,
      "silent" : true,
      "disable_colors": false,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities" : {
        "browserName" : "firefox",
        "javascriptEnabled" : true,
        "acceptSslCerts" : true
      }
    },

    "saucelabs" : {
      "selenium_host" : "ondemand.saucelabs.com",
      "selenium_port" : 80,
      "username" : "${SAUCE_USERNAME}",
      "access_key" : "${SAUCE_ACCESS_KEY}",
      "use_ssl" : false,
      "silent" : true,
      "output" : true,
      "screenshots" : {
        "enabled" : false,
        "on_failure" : true,
        "path" : ""
      },
      "desiredCapabilities": {
        "name" : "test-example",
        "browserName": "firefox"
      },
      "globals" : {
        "myGlobal" : "some_sauce_global"
      },
      "selenium" : {
        "start_process" : false
      }
    },

    "phantomjs" : {
      "desiredCapabilities" : {
        "browserName" : "phantomjs",
        "javascriptEnabled" : true,
        "acceptSslCerts" : true,
        "phantomjs.binary.path" : "/path/to/phantomjs"
      }
    },

    "browserstack" : {
      "selenium" : {
        "start_process" : false
      },
      "selenium_host" : "hub.browserstack.com",
      "selenium_port" : 80,
      "silent" : true,
      "desiredCapabilities": {
        "name" : "test-example",
        "browserName": "firefox",
        "browserstack.user" : "...",
        "browserstack.key" : "..."
      }
    },

    "testingbot" : {
      "selenium_host" : "hub.testingbot.com",
      "selenium_port" : 80,
      "apiKey" : "${TB_KEY}",
      "apiSecret" : "${TB_SECRET}",
      "silent" : true,
      "output" : true,
      "screenshots" : {
        "enabled" : false,
        "on_failure" : true,
        "path" : ""
      },
      "desiredCapabilities": {
        "name" : "test-example",
        "browserName": "firefox"
      },
      "selenium" : {
        "start_process" : false
      }
    }
  }
}

Upvotes: 1

Views: 1623

Answers (1)

Venu.p
Venu.p

Reputation: 71

i think you are misguided dude. just follow the original documentaion in nightwatchjs.org

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

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

   "test_settings" : {
      "default" : {
      "launch_url" : "http://localhost",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
         "enabled" : false,
         "path" : ""
      },
  "desiredCapabilities": {
    "browserName": "firefox",
    "marionette": true
  }
},

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

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

go with the document here http://nightwatchjs.org/gettingstarted

Upvotes: 1

Related Questions