I’m using node 5.10.0 on Linux. Having some issues running my script, which are displayed below
[davea@mydevbox mydir]$ node SkyNet.js Validation Complete /home/davea/node_modules/selenium-webdriver/chrome.js:185 throw Error( ^ Error: The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH. at Error (native) at new ServiceBuilder (/home/davea/node_modules/selenium-webdriver/chrome.js:185:13) at getDefaultService (/home/davea/node_modules/selenium-webdriver/chrome.js:362:22) at Driver (/home/davea/node_modules/selenium-webdriver/chrome.js:771:34) at Builder.build (/home/davea/node_modules/selenium-webdriver/builder.js:464:16) at Object.<anonymous> (/home/davea/mydir/js/Optimus.js:14:4) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12)
It is saying chromedriver isn’t on my path, but I just downloaded the appropriate version from here — http://chromedriver.storage.googleapis.com/index.html?path=2.9/ , and as you can see, it is on my PATH
[davea@mydevbox mydir]$ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/davea/bin:/home/davea/bin:/usr/lib/chromedriver
with the following permissions …
[davea@mydevbox mydir]$ ls -al /usr/lib/chromedriver -rwxr-xr-x 1 davea evotext 5503600 Feb 3 2014 /usr/lib/chromedriver
So I am confused as to why I’m getting this error. Any help is appreciated, - Dave
To solve the Selenium error "WebDriverException: Message: 'chromedriver' executable needs to be in PATH", install and import the webdriver-manager module by running pip install webdriver-manager . The module simplifies management of binary drivers for different browsers.
Chromium/Google Chrome Note : For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. You can also override the Chrome binary location following Using a Chrome executable in a non-standard location .
Execute google.py - A new chrome browser is open and redirect to www.google.com. Execute yahoo.py - If webdriver. Chrome is executed/existed, then assign the browser to driver variable. Else launch new browser.
To add to Niels' answer, for those not using Babel
npm install -g chromedriver
If PATH errors persist, just save it to the local project's dependencies
npm install --save-dev chromedriver
const webdriver = require('selenium-webdriver'); const chrome = require('selenium-webdriver/chrome'); const chromedriver = require('chromedriver'); chrome.setDefaultService(new chrome.ServiceBuilder(chromedriver.path).build());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With