I am testing an Angular site. I had been using Webdriver in Java but I was not able to identify elements on the page with normal IDs, xpaths or classes.
Are there alternative solutions to testing Angular sites without the use of Protractor/Jasmine? I am not interested in Cucumber or Mocha or any solution that resembles that syntax or those frameworks.
If I can use Java somehow that would be great. I am a big fan of Selenium Webdriver and prefer any solution with that tool. On a side note, I have looked into NodeJS and WebdriverJS, it seems rather fragile but I am looking into that at the moment.
Any input is appreciated.
Protractor the perfect choice for AngularJS end-to-end testing automation is that it was made and designed specifically for testing AngularJS apps - it works in sync with Angular knowing when Angular is ready to be interacted with eliminating all of the unnecessary delays and waits you might have added to wait for the page to load or specific elements to be shown:
You no longer need to add waits and sleeps to your test. Protractor can automatically execute the next step in your test the moment the webpage finishes pending tasks, so you don’t have to worry about waiting for your test and webpage to sync.
There are also AngularJS-specific locators like
Plus, there are advanced functional-programming capabilities -
And many more other features.
It's also important to understand that
Protractor is just a convenient wrapper around
Sure, you can use bare
java selenium bindings to test an Angular app, but you'll have to handle all of the waits manually yourself which would at least make your test codebase more complicated and less readable. The test flow would not be as natural as it could've been with
Additionally, there are similar to
Protractor packages in other languages:
We are using Selenium Webdriver / Java to develop test scripts for Angular JS web application. I can relate to your dislike of Jasmine syntax.
The procedure we are following is to have a standard set for attribute Ids attached to the web components using which we are able to identify the element. (By.id) (For this you will need support of Development team)
Other than that , even when element ids are not available and web components contain attributes like ng-bind , ng-model etc.,I have been successful in identifying elements using xpath.
Can you please put little more details of the detailed html where you are unable to identify using xpath.