Reputation: 3744
I am getting started with Nighwatch for web testing, and trying to do that with Chrome.
However, when I start the test, it immediately crashes with the following error:
17:56:35.218 INFO - Executing: [new session: Capabilities [{acceptSslCerts=true, name=Sandbox, browserName=chrome, javascriptEnabled=true, platform=ANY}]])
17:56:35.219 INFO - Creating a new session for Capabilities [{acceptSslCerts=true, name=Sandbox, browserName=chrome, javascriptEnabled=true, platform=ANY}]
/Users/murdockcrc/repos/nightwatch/bin/chromedriver: /Users/murdockcrc/repos/nightwatch/bin/chromedriver: cannot execute binary file
I am running the test with the following command:
./bin/nightwatch --test hdv/tests/sandbox.js --config ./nightwatch.json
As far as I am concerned, all paths here are accurate and point to the right files.
Below is my nightwatch configuration file:
{
"src_folders" : ["./hdv/tests"],
"output_folder" : "./hdv/reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"globals_path" : "",
"live_output" : true,
"parallel_process_delay" : 10,
"disable_colors": false,
"test_workers" : false,
"selenium" : {
"start_process" : false,
"server_path" : "",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver",
"webdriver.ie.driver" : "",
"webdriver.firefox.profile" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost:3000",
"selenium_host" : "127.0.0.1",
"selenium_port" : 4444,
"silent" : true,
"disable_colors": false,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities" : {
"browserName" : "chrome",
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
}
}
}
And finally, here is the test I am trying to run (as you can see, just a placeholder to see if it runs at all):
module.exports = {
'Demo test Google' : function (browser) {
browser
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('#main', 'Night Watch')
.end();
}
};
Running this same test but with firefox (by changing the nightwatch.json file) does work without issues.
I would appreciate any pointers on what's wrong with this configuration and get it running on Chrome.
Upvotes: 4
Views: 12162
Reputation: 101
As a sanity check, have you tried running chromedriver yourself (ie. running "./bin/chromedriver")? You should get some output that looks like
Starting ChromeDriver (v2.9.248307) on port 9515
You should also make sure you have the appropriate version of chromedriver for your machine. Check the ChromeDriver downloads page.
Upvotes: 2