Friday, November 20, 2015

Protractor : How to install protractor environment?

Protractor is a end to end test framework for automating AngularJS application that has special angular element locating feature and it can automatically control the waiting time between two steps which selenium needs to handle using different implicit and explicit wait technique.
In our previous post we have discussed about Protractor and its features. Now how we can install protractor in our windows machine will be discussed here.

Prerequisites :
Node.js : Protractor is a Node.js program. So we need to install Node.js before installing protractor.
Jasmine : Protractor uses Jasmine Framework by default. It is not needed to install Jasmine separately.
Java Development Kit (JDK) : For running selenium Standalone server it is needed to install JDK.

Step 1 : Install JDK
How to install JDK is found in my another post. Also you can visit to Java download page to download and install JDK. You can also take help from this link to install JDK

Step 2 : Install Node.js application
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It is lightweight and efficient.
image
  • Double click on the installer file. In my case it is “node-v5.0.0-x86.msi”. A pop up window is displayed.
  • Click on Run button.
image
  • Node.js setup window is displayed. Click on Next button.
image
  • Check on the checkbox named “I accept the terms in the License agreement”. Click on Next button.
image
  • Keep the destination path same in this window and click on Next button.
image
  • Click on Next button.
image
  • Click on Install button.
image
  • A pop up window is displayed and click on Yes button.
image
  • Installation starts.
image
  • Click on Finish button.
image
  • Node.js installation is now complete.
  • In order to verify that node.js is installed properly, open command prompt window by writing “cmd” text in the run text box and press Enter key from Keyboard.
image
  • Command prompt window is displayed and type the following command.

node –version

 image

  • Inspect that node.js version 5.0.0 is displayed.
image
  • It is proved that node.js is installed properly.
Step 3 : Install Protractor
  • Open Command prompt typing the text “cmd” at run text box and press enter button.
image
  • Command prompt window is displayed.
image
  • Type the following command to install protractor globally. Note that it installs two command line tools – protractor and webdriver-manager. It also installs Protractor API (library).
npm install -g protractor
image

Note that we use “–g” in the command line to install protractor globally.



  • Press Enter key.
  • Protractor starts installing.

image


  • After finishing installation type the following command to verify that protractor has been installed successfully.

protractor --version

image


  • Press Enter key.
  • It shows the protractor version. It means that protractor has been installed successfully.

image


  • Now type the following update command that will install standalone selenium server and ChromeDriver.

webdriver-manager update

image


  • Press  enter key and it starts installing.
  • After finishing installation run the standalone selenium server to verify that it is running. We need to run it before executing protractor test script. The command will be,

webdriver-manager start

image
Now our environment is ready to run protractor test script. So it’s time for writing protractor test. Our next post will be on that topic.

Happy UI Testing with Protractor!!!

Cypress: How to handle browser-based authentication pop up dialog in Cypress

Five years ago I have written a blog on how to handle browser-based authentication for selenium webdriver.   Now it is for cypress. Cypress...