Selenium and Mocha

This lesson will serve as an installation guide for Selenium and Mocha test framework.

Installing Selenium

By default, Node.js scripts load dependent (npm) packages installed locally, i.e., the packages are installed under the directory where the scripts are located.

> cd YOUR_SCRIPT_DIRECTORY
> npm install selenium-webdriver@3.6.0

When it is done, you will see output like below:

+ selenium-webdriver@3.6.0

At the time of writing, the latest release of Selenium WebDriver for JavaScript is 4.0.0-alpha.7, which is a pre-release version (and I found some issues with it). For some unknown reason, npm install selenium-webdriver will install 4.0.0-alpha.7 as a stable version. So that’s why I have used the version specific syntax for installing Selenium.

Successful installation will create the node_modules folder in the current directory, and the packages will be installed into that directory.

If you run into issues on npm package installation, refer to npm docs.

Get hands-on with 1200+ tech skills courses.