I am trying to run example test in file google_search_test.js
located at \node_modules\selenium-webdriver\example
. I am using WebdriverJS and only installed the selenium-webdriver
NPM package in my system.
I have moved to that path location in mand prompt and ran the following mand: node google_search_test.js
I received the following error:
Error Description:
Path\node_modules\selenium-webdriver\example>node google_search_test.js
Path\node_modules\selenium-webdriver\testing\index.js:184
exports.describe.skip = global.describe.skip;
^
TypeError: Cannot read property 'skip' of undefined
at Object.<anonymous> (C:\Users\kanasra\Desktop\Jaguars\Automation Testing\N
odeJs\node_modules\selenium-webdriver\testing\index.js:184:40)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Users\kanasra\Desktop\Jaguars\Automation Testing\N
odeJs\node_modules\selenium-webdriver\example\google_search_test.js:24:12)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
I am trying to run example test in file google_search_test.js
located at \node_modules\selenium-webdriver\example
. I am using WebdriverJS and only installed the selenium-webdriver
NPM package in my system.
I have moved to that path location in mand prompt and ran the following mand: node google_search_test.js
I received the following error:
Error Description:
Path\node_modules\selenium-webdriver\example>node google_search_test.js
Path\node_modules\selenium-webdriver\testing\index.js:184
exports.describe.skip = global.describe.skip;
^
TypeError: Cannot read property 'skip' of undefined
at Object.<anonymous> (C:\Users\kanasra\Desktop\Jaguars\Automation Testing\N
odeJs\node_modules\selenium-webdriver\testing\index.js:184:40)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Users\kanasra\Desktop\Jaguars\Automation Testing\N
odeJs\node_modules\selenium-webdriver\example\google_search_test.js:24:12)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Share
Improve this question
edited Jan 31, 2019 at 11:45
iamdanchiv
4,1124 gold badges38 silver badges42 bronze badges
asked Dec 1, 2014 at 9:09
Ravi KanasagraRavi Kanasagra
6111 gold badge10 silver badges23 bronze badges
7
- skip is some variable you r using in your tests? – Sakshi Singla Commented Dec 1, 2014 at 9:16
- No. I am not using such variable. – Ravi Kanasagra Commented Dec 1, 2014 at 10:31
- This error is because of npm not bale to pick mocha library. Need to provide correct path. – Ravi Kanasagra Commented Dec 1, 2014 at 10:32
- Add tag for mocha in your post too – Sakshi Singla Commented Dec 1, 2014 at 10:34
- Is mocha available under node_modules? – Sakshi Singla Commented Dec 1, 2014 at 10:42
1 Answer
Reset to default 9WebDriverJS (distributed as the npm package selenium-webdriver
) uses Mocha as its test driver. Assuming you are in the directory where node_modules
is located, you must run the test in Mocha:
mocha -t 5000 node_modules/selenium-webdriver/example/google_search_test.js
The above will work if you have Mocha installed globally (with npm -g install mocha
). If you install it locally (with npm install mocha
), you have to give the path to the local binary. On Unix systems you'd do:
node_modules/.bin/mocha -t 5000 node_modules/selenium-webdriver/example/google_search_test.js
I don't know where npm puts local binaries on Windows systems.
I suggest using -t 5000
to increase the timeout from the default 2 seconds to 5 seconds. On my system, the default timeout is too short and the test fails in the before
hook while waiting for Firefox to start.
If you wonder why selenium-webdriver
does not just list Mocha as a dependency this is because it is quite possible to use this package without using Mocha. So it is up to users of the package to install Mocha themselves, if they want to use it.