173
rated 0 times
[
176]
[
3]
/ answers: 1 / hits: 29548
/ 9 Years ago, tue, april 28, 2015, 12:00:00
I have a function in my protractor e2e page object that unchecks several options from a dropdown menu. It had previously worked fine, but now I'm getting the following error:
Failed: stale element reference: element is not attached to the page document
I have tried fetching the elements on each iteration of the for loop, but the for loop executes before the promise is resolved the first time, meaning that the limit value for x is passed repeatedly, and the test just clicks on the same dropdown option several times.
this.uncheckColumns = function(limit) {
element(by.className('fa-cog')).click();
element.all(by.className('multiSelectLi')).then(function(options) {
for (x = 1; x < limit; x++) {
options[x].click();
};
});
};
More From » angularjs