Pipo
Pipo

Reputation: 5821

Get element by repeater with specific value in Protractor?

Can I filter by.repeater('object in array') so it returns just objects with a specific value in Protractor?

E.g. something like

var filteredElements = element.all(by.repeater('object in array')).column('object.type').value('car'));

Is something like this possible without creating additional loops (and without creating new promises)?

Upvotes: 2

Views: 892

Answers (1)

joaomqcunha
joaomqcunha

Reputation: 58

These elements doesn't have any unique identifier? If they have you can do a cssSelector searching for that specific identifier (id, class or any other attributes..)

If they don't have ny unique identifier, the best way to do that is change you FE application to add the class "car" to each element that you want to have, and then, have a selector that retrieves all the element with class "car".

Upvotes: 1

Related Questions