MIHO
MIHO

Reputation: 101

Java webdriver for angular application not protractor?

I will be responsible for test automation for angular application. I know that we have a protractor tool but i prefer webdriver with java(feel better with this than javascript and protractor). May i use java with webdriver or i must do it using protractor because selenium will not handle it?

Upvotes: 3

Views: 1563

Answers (1)

alecxe
alecxe

Reputation: 473763

Of course, you can still use the regular Java selenium bindings to test AngularJS applications. It's just that Protractor is simply more suitable/convenient to use for specifically AngularJS applications because of the several unique things it provides:

  • it works in sync with Angular - it always knows when Angular is "ready" to be interacted with
  • it provides Angular specific locators like by.model, by.binding, by.repeater etc
  • it allows you to easily mock AngularJS modules on the fly
  • it is developed and supported by Google developers (and of course the github community) - meaning it is in sort of a sync with Angular development cycle
  • it has a very nice and documented API
  • and many more

It's also important to understand that Protractor is actually a wrapper around the WebDriverJS - JavaScript selenium bindings. And, as a side note, Protractor can also be used to test non-angular apps (just turn the sync off).


There is also ngWebDriver package that might actually be your solution:

We have taken JavaScript from Angular's Protractor project. While ngWebDriver perfectly compliments the Java version of WebDriver, it has to pass JavaScript up to the browser to inteoprate with Angular, and the Protractor project has done the hard work (including testing) to make that solid, and ngWebDriver benefits from that work.


Also see:

Upvotes: 2

Related Questions