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 trialPeggy Sturman
3,298 PointsI'm QAing the Selenium class Receiving driver.get is Not a Function Error. When I type in
I'm running Windows 10 Everything followed the examples, until I typed in:
get.driver(url);
I then get the message:
TypeError: driver.get is not a function
at repl:1:8 at ContextifyScript.Script.runInThisContext (vm.js:44:33) at REPLServer.defaultEval (repl.js:239:29) at bound (domain.js:301:14) at REPLServer.runBound [as eval] (domain.js:314:12) at REPLServer.onLine (repl.js:440:10) at emitOne (events.js:120:20) at REPLServer.emit (events.js:210:7) at REPLServer.Interface._onLine (readline.js:279:10) at REPLServer.Interface._line (readline.js:626:8)
I'm stuck as I want to follow along.
I will Google to see if I can get past this. I would appreciate any tips so I can continue with the class.
9 Answers
Young Kim
Courses Plus Student 416 PointsSince many things can go wrong with everyone's setup, I will provide what I did this evening to get mine work (Windows 10).
1 Install Visual Studio Code.
2 Follow code example from the Getting Started, and save the index.js file to your local folder.
3 Using the bash terminal from VSC (I previously installed Git Bash), navigate to your local folder and execute following code one by one:
- npm install npm@latest -g
- npm install selenium-webdriver
- npm install chromedriver
4 Continue from bash terminal, execute following command (your URL may vary):
- URL=http://port-80-fbzpamvins.treehouse-app.com/ node index.js
5 Watch the wonder.
If you encounter ChromeDriver not found in path error, then download the latest ChromeDriver 2.32 and place it in your local folder and repeat #4 again.
Hope this helps.
Peggy Sturman
3,298 PointsThanks Dale, I appreciate your feedback. I'm going to check out the article you linked to when I get home tonight and make sure I have things set up as they mention. I'm fairly sure I do, but without my laptop to double-check I can't say for certain. What I might be missing is the dreaded semicolon at the end of my Path. The semicolon always seems to be my nemesis. hahahahahaha
Brian Haucke
13,717 PointsI was getting the same error: 'driver.get is Not a Function' Turns out, when I created the const driver, I forgot to put parenthesis () after build! In other words:
- I did this: const driver = new selenium.Builder().forBrowser("chrome").build;
- instead of: const driver = new selenium.Builder().forBrowser("chrome").build();
I had to exit and relaunch node, and create const selenium, driver, and url again, but after I did that, driver.get(url) worked for me!
Peggy Sturman
3,298 PointsThanks Steven, that makes sense. I clicked on the link for Help and I guess I thought it would take me to a help section for the pre-release. I'm going to Google to try to figure out what I'm doing wrong. If not I'm going to remove Node and my Selenium directory, which has webdriver installed and start from the beginning.
Craig Dennis
Treehouse TeacherHi Peggy!
Just saw this! Are you still blocked?
Craig
Peggy Sturman
3,298 PointsHi Craig,
Yeah, I'm still blocked. I've tried removing node, Selenium, etc., deleting my test folder and trying again. It made no difference. I also made sure I added Selenium to my Path. I can continue to watch the videos but I won't be able to follow along. I spent at least two hours trying to troubleshoot. I actually like when things don't work for me as I have the best learning. I will say I'm loving the class so far. It is the Selenium class the entire Internet has needed! :-)
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,350 PointsNot sure if this is the same issue, but for Windows 10 I had to setup a path for the Chrome Driver.
This article explains how to set this up. Also make sure you have the correct latest version copied over.
https://stackoverflow.com/questions/26191142/selenium-nodejs-chromedriver-path
Peggy Sturman
3,298 PointsThanks for everyone's input. I just tried this on my lunchhour. I uninstalled everything. Things seem to work, however when I get to the driver.get(url); all the code runs and appears the same as in the video. However Chrome does not launch. It tells me Chrome is not reachable in the code. Has anyone run into this. I will try Googling some more when I get home. I am on my work's VPN, not sure if that makes a difference or not. I don't think it should. I'll do more research tonight when I get home. .
Peggy Sturman
3,298 PointsI'm still running into problems.
I followed Young's instructions and got what I have been running into as of late
After I run: const driver = new selenium.Builder().forBrowser("chrome").build();
it launches a Chrome window that says, "You are using an unsupported command-line flag, --ignore-certificate-errors. Stability and Security will Suffer. Then you get a dialog to disable developer mode extensions. I try this and and then try again and am stuck in the same loop. I've done a lot of Googling and this seems to be an issue. I really need to figure this out and would appreciate any help. I will keep researching on my own as well.
Peggy Sturman
3,298 PointsThanks so much for the answer Brian.
Here is the weird thing I discovered yesterday afternoon. I took all the code we were running on the console and put it into a .js file. When I do "Node <filename>.js" it works. So weird. I'm sure it must be something I'm doing. The plus side is this is what we run into as testers or developers and I always really learn from the problems. Overall this is such a great class. I'm so greatful they created it after all the no so great stuff or hard to follow stuff out there. I'm learning JS too. This class has been perfect.
Steven Parker
231,236 PointsSteven Parker
231,236 PointsIt might be tough to get an answer for this one until the course is released. Right now only another QA tester can even see the video your question references.