To set up protractor, we need to install below three things
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
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.
Now to see if the installation is done successfully, you can go and check in system environment variables. The path will be defined automatically.
You can also check from the command prompt by typing the command 'npm -version' in command prompt which you give you the installed version
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.
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.
To update the selenium webdriver, please type the command 'webdriver-manager update' in command prompt
It will download all webdriver latest version and default chrome driver.
Now installation part is done successfully.
Let us now try to run one basic example using protractor.