mardi 23 juin 2015

Protractor does not see the element's children

I have the function

var goThrough = function(opt_parentElement) {
    var using = opt_parentElement;
    var matches = [];
    var addMatchingLeaves = function(element) {
        if (element.children) {
            if (element.children.length === 0) {
                matches.push(element);
            }
            for (var i = 0; i < element.children.length; ++i) {
                addMatchingLeaves(element.children[i]);
            }
        }
    };
    addMatchingLeaves(using);

    return matches;
};

Then I call it in test as

amountOfElements = goThrough(element(by.css('.form-group')));

The html itself is

<div class="form-group has-feedback">
      <input id="password" name="password" type="password"> 
</div>

The problem is that function does not see the children of .form-group. I've tried with other elements but result is the same, function does not go inside first "if"

Aucun commentaire:

Enregistrer un commentaire