To add to Niels’ answer, for those not using Babel
- First install the chromedrive package using npm. If you install globally ensure to have node packages in your path
npm install -g chromedriver
If PATH errors persist, just save it to the local project’s dependencies
npm install --save-dev chromedriver
- For those not using Babel
const webdriver = require('selenium-webdriver'); const chrome = require('selenium-webdriver/chrome'); const chromedriver = require('chromedriver'); chrome.setDefaultService(new chrome.ServiceBuilder(chromedriver.path).build());