Is there a method to retrieve the iterator index/key while searching for elements by repeater?
protractor.By.repeater("(id,cat) in pets")
In this particular scenario, I am aiming to acquire the "id" of the cat. The "id" is not displayed as one of the columns in the table, rather it is utilized for navigation through ng-click="goto('/pets/'+cat.id)"
. There is no binding within the HTML like {{id}}
or {{cat.id}}
, so when attempting the following:
ptor.findElements(protractor.By.repeater("(id,cat) in pets").column('cat.id'))
it results in an empty element: []
I have also attempted, without success, something along the lines of:
ptor.findElement(protractor.By.repeater("(id,cat) in pets").row(0).column('cat.id'))
What is the appropriate way to access that specific index?
Here is the answer provided by Jmr in non-condensed syntax:
ptor.findElements(protractor.By.repeater('(id, cat) in pets')).then(function (arr) { arr[0].evaluate('cat.id').then(function (id) { console.log(id); }); });