Skip to content Skip to sidebar Skip to footer

Protractor And For Loops

I have a question concerning below code for test in Protractor. Namely as you can see firstly I find list of labels and then I check its number(three). Then I have a first loop whe

Solution 1:

In your example, labels.count() is a promise and you cannot use it directly. To get the value of count, you need to resolve the promise first. Look at below code,

labels.count().then(function(labelCount){
    for (var i = 0; i <labelCount; i++) {
      expect(labels.get(i).getText()).toEqual(table[i]); 
    }
})

Post a Comment for "Protractor And For Loops"