我有以下设置,我希望Protractor点击一行(或连续的复选框,也可以):
<li data-ng-repeat="room in chatRooms | ***filters***">
<div ng-click="toggleJoin(room.id)">
<input type="checkbox" value="{{room.id}}" ng-checked="isChecked(room.id)" />
<span>{{room.name}}</span>
</div>
</li>
我希望使用我的Page Object:
var PageObject = function() {
this.lstChatRooms = element.all(by.repeater('room in chatRooms'));
this.clickChatRoom = function(index) {
this.lstChatRooms.row(index).column('{{room.id}}').click();
};
};
但是当我尝试在我的测试中使用某个索引调用clickChatRoom
时,我收到一个错误,说该对象没有方法&#39; row&#39;,我看到了相同的行为用&#39;列&#39;。在我的测试之前,我没有在聊天室列表中调用任何内容,所以在那时不应该解决这个问题。我做错了什么?
更新:此问题可能是由此bug引起的。除非任何人都能看到我在API或其他方面做错了什么。
答案 0 :(得分:0)
我现在无法测试,但这应该适合你:
this.lstChatRooms.then(function(rooms) {
rooms[index].findElement(by.tagName('input')).click();
});