protractor
protractor copied to clipboard
Is there a ElementArrayFinder.prototype.filter function for Non-Angular pages
Please let me know if there exists a ElementArrayFinder.prototype.filter function for elements on Non-Angular pages. If not, is there any alternative method available?
Turn off the browser synchronisation. browser.ignoreSynchronization = true;
You'll need to drop down into vanilla selenium if you're looking to use protractor for non-angular pages.
For that you could use something like this:
var filter = function (selector, filterFn) {
var filtered = [];
return selector.then(function (selectorElements) {
selectorElements.forEach(function (selectorElement) {
if (filterFn(selectorElement).then === undefined) {
if (filterFn(selectorElement)) {
filtered.push(selectorElement)
}
} else {
filterFn(selectortElement).then(function (result) {
if (result) {
filtered.push(selectorElement);
}
});
}
});
return filtered;
}
};
You could also reference the source code and adapt it to your liking.
Either of these should work. Thanks @smahalingam and @Droogans