Why you choose Protractor with Selenium rather than just Selenium when an application is built on Angular or Angular JS?

There is no rule that you must use Protractor when the UI is built with Angular or AngularJS. It depends upon your requirement and team knowledge. Both these tools (Protractor & Selenium) helps us in flawless browser automation.

You can just use plain Selenium for testing Angular applications. Protractor just makes it easier to test Angular application. Protractor is a framework for testing Angular applications.

It has Automatic Waiting for elements and you can access specific Angular elements by.model and by.binding. Also it implements the Page Objects in the framework making tests more maintainable if used correctly.

Some of the points to consider when taking a decision on whether to go with Protractor or not. These points are some of the features of Protractor that make it worthy for testing AngularJS applications.

  • Protractor is a wrapper around WebDriverJS and supports Behavior Driven Development Frameworks such as Jasmine, Cucumber, Mocha etc.
  • Protractor works in conjunction with Selenium. It offers some other new locator strategies that automate the testing of AngularJS applications.
  • Protractor makes use of Selenium Grid to run Multiple browsers at once.
  • Protractor handles the $http or $timeout synchronisation issues arising out of Angular/Angular JS very well.
  • Angular/Angular JS code is written in JavaScript/TypeScript, and Protractor supports both these languages.