0

I am trying to store data in an array in a ordered way, here in the code I am trying to get row by row using the DOM, the problem is that getText() is asynchronous function and the execute is not in the order I expect, how can I access the correct value of counter1 when the then() called?

for(var counter1 = 0;counter1<length;counter1++) {

       rows[counter1].all(by.css("div:nth-child(1)")).getText().then(function(row){
             arr[counter1] = row;  //the value is the length for all calls
       });
}
user1684140
  • 444
  • 6
  • 18

0 Answers0