Over the last few weeks, We have been experimenting with a protractor+typescript+cucumber framework for our new Angular 6 application. The main reason we thought our present Selenium+Cucumber+java framework may not rise up to occasion was due to angular page elements and angular architecture, in general, may render it useless. Also, we'd like to see if there are better options that make e2e test case writing quicker, easy and make maintenance easy as we have a large suite of test cases

I want to list out my observations regarding protractor(the most popular tool for testing angular apps) and wanted to ask if my understanding is correct as I do not find a strong reason to transition to it.

1) Page elements: I know that, there are different ways of grabbing angular elements in protractor. See docs here: - https://www.protractortest.org/#/locators but the only ones that give protractor the edge are "by.model", "by.repeater", "by.binding" & etc. However, this was the case with angular js. but with angular 2+ apps protractor has lost support for the locators. Also, we have seen custom components in the DOM. For e.g. this demo site: https://miherlosev.github.io/e2e_angular/ is made in angular 4 and does not have any of elements that can be identified with "by.model", "by.repeater", "by.binding" rendering these utilities useless. how does one grab angular specific page elements. If everybody is using CSS locators than what advantage does protractor give over my existing framework?

2) Waits: I have seen automation testers still using sleeps, waits - implicit/ explicit waits both protractor or selenium. I think one of the reason is many apps are hybrid is nature i.e angular and HTML/css UI and therefore at times the automatic wait between page transition with protractor is not of huge advantage here. Besides, there are java libraries that give selenium the same capability. Like this lib: https://github.com/paul-hammant/ngWebDriver provides waitForAngular() api that protractor does. If not much, the async nature of javascript makes it hard to wrap helper functions, page objects and other utlity code in promises- all this renders the flakiness nature .of tests

SetUp/Scafolding: I agree protractor project with say typescript/javascript scores over selenium+java here as all you need to do is configure config.ts to start off; where as selenium+java requires lot of setup. But in my case, I have a mature framework setup already in java.

I am not able to find a good reason as to what advantages does protractor have over my present framework? Would Selenium+java framework would be unusable on angular 6 application?

Please let me know if I am not understanding this right or missing an important aspect of protractor.

  • Instead of spending weeks ,just spend 2 hours and prototype on one page automation with your existing framework and see yourself where it stands. – Vishal Aggarwal Apr 21 '19 at 17:28

I totally had the same experience as you. For a new angular project i looked into protractor as the recommended way but then just risked using java + selenium because, as you, i found that the protractor features where either not usable or have been ported to java. So far I had no problems with element locators and i don't have to wait for anything (at least not more than in non angular projects). The only waits I usually need are for modals.

In short: I see no reason to not use java + selenium for new angular projects.

There are other reasons to go for protractor, like when the developers also write tests it may be better to have just a single language, it integrates better in the node builds... but if your are feeling more comfortable with java and it fits into your project, use it.


Selenium + Java will not work for angular 2 and above applications. Apart from thread.sleep and explicit/implicit combination there is no way to wait the script till page loads. Thread.sleep is not the right practice and explicit/implicit is not trustworthy.

Ng webdriver only works for angularjs applications and not for angular framework( angular2 and above).

Better to start the project with protractor.

  • This is java's answer for the "waits" problem you are talking about:- github.com/paul-hammant/ngWebDriver . Protractor does not provide "Angualar specific" locators as well for 2+ onward version. So, even that advantage is no longer an advantage for protractor – Monnie_tester Jun 11 '20 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.