Transparency getText from WebElement in the repeater array
On the html page, I have:
<ul class="phones"> <li ng-repeat="phone in phones | filter:query | orderBy: orderProp"> {{phone.name}} - {{phone.age}} <p>{{phone.snippet}}</p> </li> </ul> In the e2e test, I have (returns two elements in an array):
var result= ptor.findElements(protractor.By.repeater('phone in phones').column('phone.name')); result.then(function(arr) { arr[0].getText().then(function(text) { console.log("*** 1: "+ text); }); arr[1].getText().then(function(text) { console.log("*** 2: "+ text); }) }); The console prints all three columns, phone.name, phone.age and phone.snippet. Why doesn't the selector just return phone.name?
In fact, it returns everything that I have in the "li" list, plain text or anchor.
The example tries to find elements with the following strategy (part of the column is fixed in accordance with the comments):
protractor.By.repeater('phone in phones').column('name') The repeater part corresponds to the li element, and then proceeds to search for the elements (s) with the phone.name binding. This wrapping element is the same li .
Changing a part of a column to .column('snippet') returns p elements because phone.snippet binding is found inside them.
Relevant docs / examples here: https://github.com/angular/protractor/blob/master/docs/getting-started.md#writing-tests