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 trial

Quality Assurance Introduction to Selenium Test Drive Selenium Installation

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

How to troubleshoot Selenium Web Driver Installation for Windows

I've been trying to set up a project to test some automation code on my website. I tried to set it up using the notes I made for running Selenium via chrome but I ran into a couple of issues.

I think I've nailed it down to 2 things and I hope this post helps others in the future. Now, as far as I know, Selenium should work with any desktop operating system that uses the major web browsers to go on the web.

Remember this is for Windows 10 OS using JavaScript.

The two things are as follows.

npm install chromedriver --save-dev - Use npm to install chromedriver as a dev dependency

The first thing I did was to try and install Selenium globally, via npm and the process seemed to work. However, when I called the index.js file in git bash there was an error.

Installing as a Dev Dependency seems to have it working in REPL, and in fact, I have now verified that Selenium opens my website in a QA Tab. (Not without further issues though).

require("chromedriver"); - require chromedriver into the project.

The second thing to note is that the build command will not work on Windows without having written a single command to require the chrome driver.

Furthermore, I've found that the browser will close its QA Tab if I use the same code in a JavaScript file but not via REPL.

If this happens you may have to work with Selenium via REPL. I still don't know why the browser would close though. Selenium and I are having a tricky relationship :)