I am trying to understand the Protractor code for locating elements within an ng-repeat. I work with the Python binding for WebDriver so I want to mimic the behavior within Python. Within the findRepeaterRows function there is the code

/* while it is not a comment node OR ... */ while (elem.nodeType != 8 || /* the nodeValue contains the specific ng-repeat, 'repeater' we are looking for */ elem.nodeValue.indexOf(repeater) == -1) { /* and if it is an element node */ if (elem.nodeType == 1) { /* push it into the rows array */ row.push(elem); } /* move onto the next sibling */ elem = elem.nextSibling; }

I am having a tough time reading/interpreting what the inner while loop is doing. My hang-up is in the definition of a Node [1,2] and the nextSibling [3]. Looking at the example within Protractor's API documentation [4]

// Returns a promise that resolves to an array of WebElements containing
// the DIVs for the second book.
var  bookInfo  =  element.all(by.repeater('book in library').row(1));

I am not sure what nodes get hit when it loops through and what nodeValue it is trying to match with or really what the value is of various node types (I see it is looking for the 'repeater' we specify,elem.nodeValue.indexOf(repeater) == -1).

Could anyone explain this using pseudo code and maybe the Protractor's API documentation [4] or the internal Protractor tests? Thanks.

I have tried running the Protractor runner with a debug breakpoint, browser.debugger() [5], but it does not seem to be stopping. I am not running under Windows but Linux so I don't think I am hitting issue #552, maybe undergrading selenium will help (#907)? Again thanks for any insight you can provide.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Node
[2] https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeType
[3] https://developer.mozilla.org/en-US/docs/Web/API/Node.nextSibling
[4] https://github.com/angular/protractor/blob/master/docs/api.md#api-protractorby-prototype-repeater
[5] https://github.com/angular/protractor/blob/master/docs/debugging.md

--
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to