Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSteve Hunter
57,712 PointsError: The ChromeDriver could not be found ...
Hi all,
Just trying to run the builder command on my Windows 10 PC running Chrome. As in the video, I entered in the terminal (PowerShell):
const selenium = new selenium.Builder().forBrowser("chrome").build();
I get the error:
Error: The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http:.... and ensure it can be found on your PATH.
Entering chromerdriver --version
gives me ChromeDriver 2.32.498550
.
I'm not sure what to look at first. How should I configure the PATH?
Thanks in advance,
Steve.
9 Answers
andren
28,558 PointsI had the same issue while doing QA for this course. I was never able to find a proper solution in terms of getting selenium to read the PATH properly, since chromedriver was actually in the path regardless of what it claims, but I was able to find a relatively simple workaround that worked consistently for me.
I used NPM to install chromedriver to the project (rather than globally) just like selenium-webdriver and then I simply ran this code:
require("chromedriver");
Before running:
const selenium = new selenium.Builder().forBrowser("chrome").build();
Which made the rest of the code shown in this course work just fine.
Judy Mosley
1,352 PointsI also added
npm install chromedriver
and then ran the following:
const selenium = require('selenium-webdriver');
require('chromedriver');
const driver = new selenium.Builder().forBrowser("chrome").build();
driver.get('https://TheURLThatYouNeed');
Jonathan Grieve
Treehouse Moderator 91,253 PointsYes at last testing I’m set up for Selenium on the command line now. It’s just running it from a JavaScript file that is causing me the biggest issues. :)
Kosta Kuts
15,894 PointsHey there guys, for those who have been frustrated ( as much as I was ) with endless unsuccessful attempts of installation of Chromedriver via NPM there's an alternative solution: try to install it via Homebrew.
Here's the command: brew cask install chromedriver
Steve Hunter
57,712 PointsShould this still be categorised as Quality Assurance?
[EDIT]This solution worked once and then failed. I have the PATH to the correct folder in my environment variables but the problem still persists:
[/EDIT]
Anyway, I added the path to the directory we created to my PATH. In Windows 10, open File Explorer and right click 'This PC' and select 'Properties'. In there, on the right of the window, click 'Advanced System Settings' and this opens a smaller window. At the bottom of that, there's a button for ';Environment Variables'. Open that up.
You get a window with 'User variables for <username>' at the top. In that list, highlight "Path" and click 'Edit...'. This will give you a list of paths to various apps. Click "New".
Open up the 'selenium-basics' (or whatever you called it) that you created at the start of this video in File Explorer. Click to the right of the folder name in the explorer bar at the top. This will highlight the whole path. Press Ctrl+C to copy it.
Go back to the 'Edit environment variable' window and paste (Ctrl+V) the path you copied into the new entry. Click OK - and you're done!
Steve.
Jonathan Grieve
Treehouse Moderator 91,253 PointsHi Steven,
So did you get these fixed?
I've just been doing this Test drive video myself and it looks like I was able to overcome this error by simply installing the chrome driver as a dev dependency. I'll be trying again later for practice but while it's a little different for Windows 10, than on a Macbook Pro it should work.
install selenium - npm install selenium-webdriver
make folder a package -
install the browser specific web driver - npm install chromedriver -g
also try - npm install chromedriver --save-dev if installing globally does not work.
go into node REPL - node
You should then be good to go. Hope this helps others in the future :)
Steve Hunter
57,712 PointsI'll give that a go. The each-session solution that andren suggested works fine. I shall try your more permanent solution over the weekend when I revisit the course.
Thanks for the suggestion!
Steve.
Jonathan Grieve
Treehouse Moderator 91,253 PointsNo problem :)
Jonathan Grieve
Treehouse Moderator 91,253 PointsWell, I;m sorry because now I'm confused again. I had it all working before I shut down the laptop and decided to try again but now even my method is failing me.
I wondered if it was possible we simply needed to keep doing npm installs every time we run selenium becsuse as Craig says, there's no package.json in project files? Whether that would help so we merely needed to do npm install
?
If I can just find the path to selenium I might be able to fix up the proper environment variable and get it working that way.
Steve Hunter
57,712 PointsI still have the issue after the --save-dev
install. But, I've just added require("chromedriver");
at the start of my code in Visual Studio and this avoids the error. I'll have a look on Stack Overflow later to see if clever people have figured out the solution to this issue.
And it's weird seeing my name in the video!
Jonathan Grieve
Treehouse Moderator 91,253 PointsYes, I've just tested it with require("chromedriever")
in my REPL and it is now working! :-)
Let me know what else you find out!
michellegisela
3,069 PointsHi, fellows.
I would like to ask, have any of you got this error, "AvgMessageDispatcherClientLite::Initialize Get private logger failed: 0xe001003d", after executing the script 'require("chromedriver");'? I am asking because I also get the error 'The ChromeDriver could not be found' and executing the script does the trick, however, I'd get this error in a few minutes and it would then abort the node repl.
Appreciate your reply.
Thanks!
Jonathan Grieve
Treehouse Moderator 91,253 PointsMy first thought would be to try reinstalling Selenium again with NPM. Chances are you're just missing and important package or dependency. :-)
michellegisela
3,069 PointsHi, Jonathan.
Thanks for your prompt reply. :) I actually did, several times in fact. I thought at first it was because I was into deep a directory so then I tried re-installing it just like in the video. But then I'd get the same issue. :( I was about to update my original question because I am also getting this error '[16352:14408:0921/031403.082:ERROR:ssl_client_socket_impl.cc(1129)] handshake failed; returned -1, SSL error code 1, net_error -100' so I'm not sure if it's with the Selenium installation or if it's a problem with my machine.
Jonathan Grieve
Treehouse Moderator 91,253 PointsSorry, I'm not sure how to fix this specific issue.
Try googling the errors for your specific system. :) I'm sure someone else out there has had the very same issues you're having. :-)
Evgeniy Savchuk
1,000 PointsWhen you are adding new PATH in your environment - you should restart your OS. And only after this step it will be avaliable under node. Its related to instruction of "Steve Hunter on Sep 14"
Michael Robert
651 PointsHello all,
I'm getting the same error mentioned at the top of this thread (on Windows 7).
I've attempted using andren, steve's environment variable solution and Jonathan Grieve's option.
Would my problem be something more simple potentially? Should chromedriver be in the AppData folder?
After I've installed chromedriver and use where on the cmd, it displays the following:
C:\Users\Betty\selenium-basics>where chromedriver C:\Users\Betty\AppData\Roaming\npm\chromedriver C:\Users\Betty\AppData\Roaming\npm\chromedriver.cmd
Heres a full log of what I've completed so far:
C:\Users\Betty\selenium-basics>npm install chromedriver -g C:\Users\Betty\AppData\Roaming\npm\chromedriver -> C:\Users\Betty\AppData\Roamin g\npm\node_modules\chromedriver\bin\chromedriver
chromedriver@2.33.2 install C:\Users\Betty\AppData\Roaming\npm\node_modules\ch romedriver node install.js
Downloading https://chromedriver.storage.googleapis.com/2.33/chromedriver_win32. zip Saving to C:\Users\Betty\AppData\Local\Temp\chromedriver\chromedriver_win32.zip Received 781K... Received 1568K... Received 2352K... Received 3136K... Received 3920K... Received 4125K total. Extracting zip contents Copying to target path C:\Users\Betty\AppData\Roaming\npm\node_modules\chromedri ver\lib\chromedriver Done. ChromeDriver binary available at C:\Users\Betty\AppData\Roaming\npm\node_m odules\chromedriver\lib\chromedriver\chromedriver.exe C:\Users\Betty\AppData\Roaming\npm `-- chromedriver@2.33.2
C:\Users\Betty\selenium-basics>chromedriver --version ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f)
C:\Users\Betty\selenium-basics>where chromedriver C:\Users\Betty\AppData\Roaming\npm\chromedriver C:\Users\Betty\AppData\Roaming\npm\chromedriver.cmd
C:\Users\Betty\selenium-basics>node
const selenium = require("selenium-webdriver"); undefined const driver = new selenium.Builder().forBrowser("chrome").build(); Error: The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleap is.com/index.html and ensure it can be found on your PATH. at Error (native) at ServiceBuilder (C:\Users\Betty\selenium-basics\node_modules\selenium-webd river\chrome.js:215:13) at getDefaultService (C:\Users\Betty\selenium-basics\node_modules\selenium-w ebdriver\chrome.js:304:22) at Function.createSession (C:\Users\Betty\selenium-basics\node_modules\selen ium-webdriver\chrome.js:752:44) at createDriver (C:\Users\Betty\selenium-basics\node_modules\selenium-webdri ver\index.js:170:33) at Builder.build (C:\Users\Betty\selenium-basics\node_modules\selenium-webdr iver\index.js:642:16) at repl:1:60 at sigintHandlersWrap (vm.js:22:35) at sigintHandlersWrap (vm.js:73:12) at ContextifyScript.Script.runInThisContext (vm.js:21:12)
Jonathan Grieve
Treehouse Moderator 91,253 PointsI’m sorry, i wish I could give you the definitive answer but I’m struggling to debug my own issues with Selenium at the moment. :)
If you haven’t moved the chromedriver executable from where npm installed it I would suggest leaving it there. If you have a look at the Selenium website you might just be able to find a list of chrome driver installations based on version and see if any of those work for you, though, I have to say, 2.33 was the one that worked best for me.
michellegisela
3,069 PointsThanks for the reply, Jonathan. I am. So far, I had not seen the same scenario. Just the same error, different scenario. :(
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsThank you - that seems to have done the trick.
Do you think this is a bug within Selenium/Chromedriver or an installation-specific Windows issue? (assuming you were using Windows!)
Steve.
andren
28,558 Pointsandren
28,558 PointsI personally think it's a Selenium bug, and yes I am using Windows. Windows 10 to be specific.
The fact that chromedriver can be called from CMD and Powershell just fine means that there is no issue with it not being present in the PATH. And since I have Node apps that use other PATH binaries it doesn't seem like a Node bug either, which pretty much just leaves Selenium.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsI'd agree with that conclusion. Although it could be Windows 10 trying to be too clever! I'm using Win10 too.
I'll keep an eye on other forums to see if it becomes an issue- I hadn't seen the problem with a quick google this morning.
I'll try it on the Mac and a Linux box too.
crosscheckking
25,155 Pointscrosscheckking
25,155 PointsJust to add to this (over a year later). I agree with andren that it's probably a js selenium bug because I haven't had any issues using C# and not declaring a path to the driver files. Thanks andren for helping us get around it.