Selenium Nodejs CHROMEDRIVER path Selenium Nodejs CHROMEDRIVER path selenium selenium

Selenium Nodejs CHROMEDRIVER path


Ok assuming you are using Windows please try the following steps:

  • Download the latest version of ChromeDriver from here ChromeDriver

  • Extract the zip and place the contents somewhere you know where it is for example "C:\Users\UserName\AppData\ChromeDriver"

  • Go to your Control Panel -> System -> Edit the System Variables. Click on the "environment variables" button.

  • In the system variables box there will be a variable named "Path" select it and click edit. Copy and paste the path to the containing directory of the chromedriver.exe you downloaded onto the end of the variable value and end it with a semi-colon.

  • Click ok and again to close environment variables and again to close system properties.

  • Close and reopen your terminal window.

  • Run the command again.

I hope this helps - there is a good tutorial here


Even after adding the driver path in the System variables it didnt worked.

But by creating & setting own default chrome service, it worked

var webdriver = require('selenium-webdriver');var chrome = require('selenium-webdriver/chrome');var path = require('chromedriver').path;var service = new chrome.ServiceBuilder(path).build();chrome.setDefaultService(service);var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();


You only need to install npm install selenium-webdriver. Then download the chromedriver from here.

const path = require('path');const { ServiceBuilder } = require('selenium-webdriver/chrome');const { Builder } = require('selenium-webdriver');const geckoDriverPath = path.join(__dirname, "geckodriver"); // or wherever you've your geckodriverconst serviceBuilder = new ServiceBuilder(geckoDriverPath);const SeleniumDriver = await new Builder()  .forBrowser('chrome')  .setFirefoxService(serviceBuilder)  .build();