This is my code -
formElements[0].findElements(by.repeater(repeater)).then(function(items){
console.log(i, '>>>>>>>>>.No of items in the list --- '+items.length);
(function(items){
for(var x1=0; x1<itemsToBeSelected.length; x1++){
console.log(i, '>>>>>>.Looking for item --- '+itemsToBeSelected[x1]);
skip = false;
(function(items, x1){
for(var x2=0; x2<items.length; x2++){
(function(items, x2){
items[x2].getText().then(function(itemName){
console.log(i, '>>>>..Verifying '+itemsToBeSelected[x1]+' with '+itemName);
if(itemName == itemsToBeSelected[x1]){
console.log(i, '>>>>>.Selecting the item --- '+itemName);
items[x2].findElement(by.css('.regular-checkbox')).click();
}
});
}(items, x2));
}
}(items, x1));
}
}(items));
});
I want to break out of inner for loop when the condition itemName == itemsToBeSelected[x1] is satisfied. Tried using flag, return statements, but unable to break out from the loop.
Please suggest corrections in the code.