Installing Protractor

To set up protractor, we need to install below three things
1. Node.js
2. Protractor
3. Selenium Webdriver

Step 1: First we have to install NodeJS. Please click here to download node.js

What is Node.js ???
Node.js is an open source, cross-platform runtime environment for server-side and networking applications. Click here for details on Node.JS

nodejs windows installer

Click on Windows Installer ( as im using windows, i have choosen to download windows installer). Once the download has finished. Please double click on exe file and Click on Run button.

It will launch Node.js setup wizard. Click on Next and click ok next button by accepting the terms and conditions and proceed to installation.

nodejs setup wizard

Now to see if the installation is done successfully, you can go and check in system environment variables. The path will be defined automatically.

nodejs system path

You can also check from the command prompt by typing the command 'npm -version' in command prompt which you give you the installed version

nodejs version

Step 2:
Installing protractor can be done in two ways Locally and Globally

We can Install protractor in a specified folder or project directory location. If we install in a project directory, every time we run, we should run from that location only.

To install project directory, navigate to that folder and type the command npm install protractor

To install globally, please go ahead an type the command npm install -g protractor in command prompt.

The above command will install protractor and make it available globally.

protractor installation

If you get any error as "Error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm.". Please create a folder named 'npm' which will solve your problem.

And also make sure you navigate to the folder AppData/Roaming/npm and install protractor

Path may look like C:\Users\name\AppData\Roaming\npm

Note: if you are not able to view the AppData folder, request you to view the hidden folders.

Once that is done, confirm by typing 'protractor --version' in the commend prompt which will show you the protractor version that is installed.

protractor installed version

Step 3:
To update the selenium webdriver, please type the command 'webdriver-manager update' in command prompt

protractor webdriver

It will download all webdriver latest version and default chrome driver.

selenium webdrivers

Now installation part is done successfully.

Let us now try to run one basic example using protractor.

Protractor Tutorials: 


Unable to execute the sample scripts

'protractor' is not recognized as an internal or external command,
operable program or batch file.

I am getting above error while checking version. Not sure why. I can see correct versions of node.js and npm. also no errors while installng.

'AppData\Roaming\npm\node_modules\protractor\example' is not recognized as an in
ternal or external command,
operable program or batch file.

the command to install protractor is giving connection error because of proxy.
Could you please help, how to configure proxy for npm?

I've updated my servers from Windows 7 to 2012 and 2016. Will Protractor still work? I'm currently have connectivity errors which may or may not be related. If it's supported what version should I upgrade to?

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.