Reputation: 85
In my application there are couple of rows and in each row last column, there is option of 'Edit'|'Delete' and when click on Edit, on the same place we get option for 'Update'|'Cancel', I successfully clicked on edit, made some changes and when I try to click on update it throws an error:
more than one element found with locator
by.css(..)
as both have same code
<td>
<div class="biometricActionCln ng-hide" ng-show="!list.isEditable" style="">
<a ng-click="editBiometrics(list, $index)">
**<i class="fa fa-pencil-square-o">**
</i> Edit</a>
<span> | </span>
<div ng-show="list.isEditable" class="" style="">
<a ng-click="manageEditBiometric(editBiometric, 'Modify', list.biometricId)">
**<i class="fa fa-pencil-square-o">**
</i> Update</a>
<span> | </span>
</div>
</td>
Kindly let me know how do I click on update link.
Upvotes: 1
Views: 6394
Reputation: 153
Below are different ways of handling multiple elements.
accessing multiple elements with index:
element.all(by.css('.selector'))[0]
element.all(by.css('.selector'))[1]
accessing multiple elements by calling methods:
element.all(locator).first();
element.all(locator).last();
accessing multiple elements through callback function:
element.all(by.css('.selector')).then(function(elements) {
// elements is an array of ElementFinders.
});
Upvotes: 5