Skip to main content

Automate Angular JS Application using Protractor

The "Protractor" is an automation testing tool for web applications testing; combining powerful technologies such as Jasmine, Selenium Webdriver, Node.js etc.

About Angular JS Application :-
AngularJS is a framework that is gaining in popularity because it extends the functionality of HTML and can be used to quick launch applications. The frameworks follows basic HTML & offers extension (in the form of directives) which has the capability to make the web site truly responsive & dynamic. It follows the DOM methodology which focuses primarily on improvising testability & performance

Protractor Introduction :

Protractor is a Node.js program.The first version of Protractor was released in July, 2013, when the framework was basically a prototype of a testing framework. However, Google, with the support of the testing community, is evolving the framework to follow the evolution of AngularJS and to meet the needs of the community that is using AngularJS.

It supports two Behavior-driven development (BDD) test frameworks right out of the box:
Jasmine: Jasmine is the default test framework when Protractor is installed.
Mocha: Mocha is a JavaScript test framework which runs on Node.js


Protractor is a wrapper (built on the top) around Selenium WebDriver, so it contains every feature that is available in the Selenium WebDriver. Additionally, Protractor provides some new locator strategies and functions which are very helpful to automate the AngularJS application. Examples include things like: waitForAngular, By.binding, By.repeater, By.textarea, By.model, WebElement.all, WebElement.evaluate, etc.

.'



Why we use Protractor instead of Selenium :-

Sometimes it is difficult to capture the web elements in AngularJS applications using Junit or Selenium WebDriver.
Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng-model.., etc. which are not included in Selenium locators. Selenium is not able to identify those web elements using Selenium code. So, Protractor on the top of Selenium can handle and controls those attributes in Web Applications. 


Protarctor Feature :-

  1. Protractor speeds up your testing as it avoids the need for a lot of “sleeps” and “waits” in your tests, as it optimizes sleep and wait times.
  2. Some new locator strategies and functions provided to help locate the Angular elements are: By.binding, By.repeater, By.textarea, By.model, WebElement.all, WebElement.evaluate, etc.
  3. Introduced new simple syntax to write tests
  4. Allows running tests targeting remote addresses
  5. Multiple browser support (Firefox, Chrome, Safari, Internet explorer)
  6. Ability to run the same scripts in mobile browsers also without the need to change the code
  7. Protractor allows tests to be organized based on Jasmine, thus allowing you to write both unit and functional tests on Jasmine.
  8. It runs on real browsers and headless browsers.












Comments

  1. This info was very helpful to me.
    AngularJS Training in Chennai

    ReplyDelete
  2. I am really impressed the way you have written the blog. Hope we are eagerly waiting for such post from your side. HATS OFF for the valuable information shared!
    AngularJS Training in Chennai
    AngularJS Course in Chennai

    ReplyDelete
  3. Wow this is really amazing post. Thanks for sharing the useful informative data. I appreciate your difficulty work. Keep blogging. Protractor Training in Electronic City

    ReplyDelete
  4. I like your post there is a lot of information about software testing, which i would like to learn, thank you for the great guide. Very useful post and I think it is rather easy to see from the other comments as well that this post is well written and useful. I bookmarked this blog a while ago because of the useful content and I am never being disappointed. Keep up the good work.. Read more about QA Services

    ReplyDelete

Post a Comment

Popular posts from this blog

Handle radio button & Check Boxes in Selenium

The main difference between Radio button and Checkbox is that, using radio button we will be able to select only one option from the options available. whereas using checkbox, we can select multiple options. Selenium WebDriver supports Radio Button and Radio Group controls using the WebElement class. We can select and deselect the radio buttons using the click() method of the WebElement class and check whether a radio button is selected or deselected using the isSelected() method. Before performing the click on the Radio buttons or check boxes we will have to verify follwing scenarios :- If Radio button or Checkbox is displayed on the webpage If Radio button or Checkbox is enabled on the webpage Check the default selection of the Radio button or Checkbox We use predefined methods present in selenium to handle check Box and Radio  button :- isDisplayed() isEnabled() isSelected() 1.  isDisplayed () this method returns a Boolean value, if it returns t

How To Send Report In Mail Using Java In Selenium Web driver

Today we will share code how to send any type of selenium report in mail using java. For sending the email using JavaMail API, you need to load the two jar files: mail.jar activation.jar package SeleniumNew; import java.util.Properties; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.*;  import javax.mail.internet.*;  public class SendEmail {     public static void main(String[] args)     {                 String host="smtp.gmail.com";          final String user="ashishxx@gmail.com";//change accordingly          final String password="XXX";//change accordingly                    /*String[] to={"AshishXX@gmail.com","Ashishxxx@gmail.com"};           String[] cc={};           String[] bcc={};         */           String to="ashishxx@gmail.com";//change accordingly                     //Get the session object            Properties props = new

Appium architecture (How Appium works internally)

Appium Architecture  A ppium is a cross-platform automation tool, API of it supports both OS (Android and iOS) test scripts.It is tested on simulators (iOS,), emulators (Android), and real devices (iOS, Android)   Appium is an HTTP server written in Node.js that creates and handles WebDriver sessions.The Appium web server follows the same approach as the Selenium WebDriver, which receives HTTP requests from client libraries through JSON and then handles those requests in different ways   JSON wire protocol The JSON wire protocol  ( JSONWP ) is a transport mechanism created by WebDriver developers. This wire protocol is a specific set of predefined, standardized endpoints exposed via a RESTful API.   Appium implements the Mobile JSONWP, the extension to the Selenium JSONWP, and it controls the different mobile device behaviors, such as installing/uninstalling apps over the session Let’s have a look at some of the endpoints from the API which are used to interact with