What is Protractor and why we need Protractor for Automation - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Friday, 11 September 2020

What is Protractor and why we need Protractor for Automation

Protractor is a test framework to test Angular and AngularJS applications

What is Angular JS
AngularJs was developed by Google, its JavaScript based open source front end web framework
AngularJs has one version  i.e. version 1.x.x

What is Angular
Angular is a platform for building applications in HTML and TypeScript.
Angular has different versions Angular 2,Angular 4,Angular 5...


Protractor is a Node.js program built on top of WebDriverJS

WebdriverJS is official javascript implementation of Selenium

Now we can say protractor is a kind of wrapper written on top of WebDriverJS to support extra Angular JS Elements

Note: Protractor can also be used to Test Non AngularJS Applications

What is Node.js
Its a open source platform that can be used to write cross platform server-side networking applications

Node.js applications are written in Javascript

Why can't we find Angular JS web elements using Normal Selenium Web driver?

Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng-model.., etc. which are not included in Selenium locators.

Protractor which is a wrapper written is helpful in finding such elements

Protractor provides angular specific locator strategies and functions
waitForAngular
webElement.evaluate
By.binding
By.repeater
By.model


What is the issue we face if we try to Automate Angular JS Applications with Selenium
Synchronization issues while automation Angular JS Applications with Selenium, we often get failures and time outs

And moreover major of the applications these days are developed with Angular and AngularJS

Why synchronization Issues?
Angular like most of the Javascript is asynchronous, and makes use of promises to handle async vs callbacks


Automatic synchronization between Protractor and Angular that helps to minimize use of explicit wait here and there


Synchronous Vs Asynchronous
In Synchronous each operation has to wait for the operation to be completed before it goes to next operation

In Asynchronous multiple things can happen same time


No comments:

Post a Comment