Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Quality Assurance Introduction to Selenium Test Drive Selenium Installation

Erick Luna
Erick Luna
20,171 Points

I'm getting this message while using the build pattern "The ChromeDriver could not be found on the current PATH"

The full error message is: " The ChromeDriver could not be found on the current PATH. Please download the latest version of t he ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found o n your PATH."

Tzvetan Petrov
Tzvetan Petrov
1,242 Points

Same problem - I have followed the steps 1 by 1 -

C:\Users\Kasapcho\selenium-basics>npm install chromedriver -g C:\Users\Kasapcho\AppData\Roaming\npm\chromedriver -> C:\Users\Kasapcho\AppData\Roaming\npm\node_modules\chromedriver\bin\chromedriver

chromedriver@83.0.0 install C:\Users\Kasapcho\AppData\Roaming\npm\node_modules\chromedriver node install.js

Current existing ChromeDriver binary is unavailable, proceeding with download and extraction. Downloading from file: https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_win32.zip Saving to file: C:\Users\Kasapcho\AppData\Local\Temp\83.0.4103.39\chromedriver\chromedriver_win32.zip Received 1040K... Received 2080K... Received 3120K... Received 4160K... Received 4649K total. Extracting zip contents to C:\Users\Kasapcho\AppData\Local\Temp\83.0.4103.39\chromedriver. Copying to target path C:\Users\Kasapcho\AppData\Roaming\npm\node_modules\chromedriver\lib\chromedriver Done. ChromeDriver binary available at C:\Users\Kasapcho\AppData\Roaming\npm\node_modules\chromedriver\lib\chromedriver\chromedriver.exe

C:\Users\Kasapcho\selenium-basics>chromedriver --version ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416})



C:\Users\Kasapcho\selenium-basics>node Welcome to Node.js v12.18.0. Type ".help" for more information.

const selenium = require ("selenium-webdriver"); undefined const driver = new selenium.Builder().forBrowser ("chrome").build(); Uncaught: 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 new ServiceBuilder (C:\Users\Kasapcho\selenium-basics\node_modules\selenium-webdriver\chrome.js:173:13) at Function.getDefaultService (C:\Users\Kasapcho\selenium-basics\node_modules\selenium-webdriver\chrome.js:212:22) at Function.createSession (C:\Users\Kasapcho\selenium-basics\node_modules\selenium-webdriver\chromium.js:582:49) at Function.createSession (C:\Users\Kasapcho\selenium-basics\node_modules\selenium-webdriver\chrome.js:289:41) at createDriver (C:\Users\Kasapcho\selenium-basics\node_modules\selenium-webdriver\index.js:155:33) at Builder.build (C:\Users\Kasapcho\selenium-basics\node_modules\selenium-webdriver\index.js:662:16) const driver = new selenium.Builder().forBrowser ("chrome").build(); and getting the same error when I begin to write the script following the video

using win10 btw ....

3 Answers

I exactly have the same problem and still looking for the solutions.

Avery Miller
Avery Miller
1,213 Points

I found that I had to import two additional things to get it to run ( credit to this stack overflow answer).

const webdriver = require('selenium-webdriver');

// add these two imports, and the line after that
const chrome = require('selenium-webdriver/chrome');
const chromedriver = require('chromedriver');

// I needed this the first time around, but then I didn't after, so not sure on this
// chrome.setDefaultService(new chrome.ServiceBuilder(chromedriver.path).build());

// NOW I can do this line!
const driver = new selenium.Builder().forBrowser('chrome').build();

Afterwards, I get a message about "a device attach to the system is not functioning" and something with my USB settings, but I think that's just my system thing, and so far it hasn't actually impacted what I'm doing! 😀 Hope this helps!

I previously tried installing it to the project directly. I also tried using a different shell, just in case. I use Git Bash, but I tried in powershell or in the command prompt, all gave the current PATH error message.

Hey mate, thank you for the help. Actually I found the solution and as I can see we thought about the same thing. So my solution is more simple and only 1 line code you need to write.

So my solution is, I added / require('chromedriver'); / this line before I define the driver and build it which is ( const driver = new selenium.Builder().forBrowser("chrome").build(); )

Hope that helps!