A small library of WebDriver locators for AngularJS, as well as a utility to interoperate with $scope variables directly.
It is only in Java for now, but I'm sure ports will make it available for .Net, Python, Ruby etc.
Protractor (from where some of the JavaScript has been copied) is stable, but this Java library isn't quite released as yet despite 99% test coverage, hence the sub-1.0 version number. APIs could change!
All our usage examples are in a single test class:
In there are examples of:
- how to wait for Angular to stop being busy.
- how to find 'rows', 'columns' or 'cells' via Angular's ng-repeat directive.
- how to find elements via Angular's ng-bind directive, also used like so: {{bindingVar}}.
- how to find read $scope variables
- how to find write $scope variables
If you're trying to retrieve a date object, there's a selenium bug stopping that for now. Instead bring it back as JSON and post-process it:
DateTimeFormatter parser = ISODateTimeFormat.dateTimeParser()
.withChronology(ISOChronology.getInstanceUTC());
DateTime actualWhen = parser.parseDateTime(ngModel.retrieveJson(anElem, "myDateField").replace("\"", ""));
<dependency>
<groupId>com.paulhammant</groupId>
<artifactId>ngwebdriver</artifactId>
<version>0.9.1</version>
<scope>test</scope>
</dependency>
<!-- you still need to have a dependency for preferred version of Selenium/WebDriver 2.35 or above -->