title: Using JavaScript's Selenium Webdriver, how to launch Chrome with a specific path to chromedriver.exe?
body: <p>I have the following Javascript code that launches Chrome with the path to chromedriver.exe specified by the PATH environment variable. This question is different than <a href="https://stackoverflow.com/questions/58141553/using-javascripts-selenium-webdriver-how-to-launch-chrome-with-a-specific-path">how to launch Chrome with a specific chrome.exe</a> because chromedriver.exe is a standalone server that takes in commands from Selenium Server and uses JSON commands to talk to the Chrome browser's API. You need both chrome.exe and chromedriver.exe to launch a Chrome browser with Selenium.</p>
  
  <pre><code>    let driver = await new Builder()
          .forBrowser('chrome')
          .build();
  </code></pre>
  
  <p>However, I would like to clear my PATH environment variable and instead set a path from within the code that launches Chrome, something like the below. How can I do that please?</p>
  
  <pre><code>    let driver = await new Builder()
          .forBrowser('chrome')
          .withDriverPath('C:\\temp\\chromedriver.exe')
          .build();
  </code></pre>