nightwatch-docs
nightwatch-docs copied to clipboard
Instructions in getting started don't seem to work with default geckodriver
On MacOS I followed the steps in the getting started quickstart
npm init -y
npm install nightwatch --save-dev
npm install geckodriver chromedriver --save-dev
To execute my first test I use the example on the page that doesn't specify an environment so it uses geckodriver
npx nightwatch node_modules/nightwatch/examples/tests/ecosia.js
When I run this I get the following error
[Ecosia.org Demo] Test Suite
────────────────────────────────────────────────────────
⠋ Starting GeckoDriver on port 4444...
Response 500 POST /session (5ms)
{
value: {
error: 'session not created',
message: "Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line",
stacktrace: ''
}
⚠ Failed to connect to GeckoDriver on localhost with port 4444.
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
TEST FAILURE (170ms):
- 1 error during execution;
- 0 tests failed;
- 0/NA tests passed
SessionNotCreatedError: An error occurred while creating a new GeckoDriver session: [SessionNotCreatedError] Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line
Verify if GeckoDriver is configured correctly; using:
{
start_process: true,
server_path: '/Users/[redacted]/projects/nw-2.0-test/node_modules/geckodriver/geckodriver',
port: 4444,
host: 'localhost',
ssl: false,
default_path_prefix: '',
proxy: undefined,
cli_args: {}
}
I tried to recreate the issue and I couldn't.
Do you have Firefox installed?
davidburns in ~/development/nightwatch-bugs/doc-155 λ npm init -y
Wrote to /Users/davidburns/development/nightwatch-bugs/doc-155/package.json:
{
"name": "doc-155",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
davidburns in ~/development/nightwatch-bugs/doc-155 λ npm i nightwatch --s
ave-dev
added 164 packages, and audited 165 packages in 12s
30 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
davidburns in ~/development/nightwatch-bugs/doc-155 λ npm i geckodriver ch
romedriver --save-dev
added 81 packages, and audited 246 packages in 7s
43 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
davidburns in ~/development/nightwatch-bugs/doc-155 λ npx nightwatch node_modules/nightwatch/examples/tests/ecosia.js
No config file found in the current working directory, creating nightwatch.conf.js in the current folder...
[Ecosia.org Demo] Test Suite
────────────────────────────────────────────────────────
ℹ Connected to GeckoDriver on port 4444 (4561ms).
Using: firefox (97.0.2) on MAC (21.3.0).
Running Demo test ecosia.org:
───────────────────────────────────────────────────────────────────────────────────────────────────
✔ Element <body> was visible after 31 milliseconds.
✔ Testing if the page title contains 'Ecosia' (6ms)
✔ Testing if element <input[type=search]> is visible (42ms)
✔ Testing if element <button[type=submit]> is visible (17ms)
✔ Testing if element <.mainline-results> contains text 'Nightwatch.js' (312ms)
OK. 5 assertions passed. (2.276s)
davidburns in ~/development/nightwatch-bugs/doc-155 λ
Firefox was inadvertently wiped off my system from an IT policy so that was it. Thanks.
I will add a note to make sure that browsers are installed