I four <select>
with ng-options
used in my page that will retrieve different information.
All of them are like this, except with different data binding, names and ids:
<div class="col-sm-3">
<label class="control-label" for="lawyer">Lawyer</label>
<select class="form-control" id="lawyer" name="lawyer" ng-model="model.lawyerUuid" required
ng-options="lawyer.uuid as lawyer.name for lawyer in model.lawyers">
</select>
</div>
How can I test this in protractor so I can make sure there are only x (e.g. 2) lawyers returned ?
Since I use ng-options
, finding by ng-repeat
won't work and if I search with the following, I will get all four <selects>
in my page and not only the one above (so if all of them would return 2 elements I would have a count()
of 8):
element.all(by.css('select option'))
Is there a way to retrieve all the elements that have a parent with some specified id?
driver.findElements(protractor.By.css('#lawyer > option')).then(function (lawyers) {
expect(lawyers.length).toBe(2);
});
This is similar to finding it by repeat but may still work