vendredi 23 janvier 2015

Protractor get element by model in repeater array

For example, in HTML page:



<tr ng-repeat="post in posts">
<td ng-click="activePost(post)" class="title">{{post.title}}</td>
<td><button class="btn btn-danger" ng-click="delete(post)">Delete</button></td>
<td><input type="checkbox" ng-model="post.active"
id="{{post.id}}" /></td>
</tr>


Then, I want something like:



element.all(by.repeater('post in posts')).then(function(posts) {
var activePost = posts[0].element(by.model('active'));
expect(activePost).toEqual(true);
});


This returns an unable to find element. I am basing this on this question and answer: Protractor find element inside a repeater


Aucun commentaire:

Enregistrer un commentaire