magicode118
magicode118

Reputation: 1474

Find Repeater Nested Anywhere Inside Another Repeater

Using Protractor, I'm having issues locating a repeater which is nested inside another repeater but not as a direct child element.

Example:

<li ng-repeat="1 in hello">
  <div>
     <div ng-repeat"2 in hey">
  </div>
</li>

The technique I use for finding nested items assumes the element is a direct child as shown here https://github.com/angular/protractor/blob/master/docs/locators.md

Upvotes: 2

Views: 374

Answers (2)

Segg3r
Segg3r

Reputation: 466

element.all(by.repeater('outer')).get(0).all(by.repeater('inner'))...

will find all repeated elements inside first element of outer repeater. you can play with it using filtering to get elements you need.

Upvotes: 3

Dmitri Algazin
Dmitri Algazin

Reputation: 3456

you can always make unique id for div element

<li ng-repeat="i in hello" id="{{i}}">
  <div>
     <div ng-repeat"j in hey" id="{{i}}:{{j}}">
  </div>
</li>

and find element by id

Upvotes: 0

Related Questions