Now Reading
How to Install Protractor

How to Install Protractor

Views  
views
12

To set up protractor, we need to install below three things

  1. Node.js
  2. Protractor
  3. Selenium Webdriver

Ads

Step 1: Install NodeJS, click here to download node.js

Click on Windows Installer. Once the download has finished. 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, check from the command prompt by typing the command ‘npm -version in command prompt which will give you the installed version.

Note: Restart the machine after installing NodeJS

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: Create a directory, “Protractor” and navigate to that folder and type the command npm install protractor

To install globally, please go ahead and type the command npm install -g protractor in command prompt. This command will install protractor and make it available globally.

Once that is done, confirm by typing ‘protractor –version’ in the command prompt which will show you the protractor version that is installed.

Step 3:  
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.

To start webdriver: type the command ‘webdriver-manager start’  in command prompt.

Run Scripts:

  1. Login to the machine where you have installed Protractor

  • Open command prompt and start selenium server Webdriver-manager start

  • Open another command prompt and move to the below location cd C:Users<USER> AppDataRoamingnpmnode_modulesprotractorexample

  • Now run : protractor conf.js command to start the test

  • If you want to run particular test case. Go to C:UsersUser>AppDataRoamingnpmnode_modulesprotractorexample

See Also

And edit the “conf.js” file. In this file add your test script file name to “specs:” section

  • Your test case html report and screenshots will be under c:/temp/report folder

Troubleshoot:

  1. If you get any error as “Error: ENOENT, stat ‘C:Users<name>AppDataRoamingnpm.”. 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<USER>AppDataRoamingnpm

  • You will have proxy issues if you try to install in office.

Open IE -> Settings -> Internet options -> Connections -> LAN settings -> Under Proxy server select
“Proxy server” -> Advanced

Here set proxy address: 

               Http: http://<YOUR-COMPANY-Proxy>.com:911

               Secure: https://<YOUR-COMPANY-Proxy>:912

View Comment (1)

Leave a Reply

Your email address will not be published.

Scroll To Top