This is a follow-up question to Take elements while a condition evaluates to true (extending ElementArrayFinder) topic and @cvakiitho's answer in particular.
The problem:
After executing the following code:
var i = 0;
var el = element.all(by.css('ul li a'));
var tableItems = [];
(function loop() {
el.get(i).getText().then(function(text){
if(text){
tableItems.push(el.get(i));
i+=1;
loop();
}
});
}());
tableItems
would contain an array of ElementFinder
instances - or, to put it simple - an array of web elements.
The Question:
Is it possible to convert an array of ElementFinder
s to an ElementArrayFinder
instance?
The Motivation:
The reason I want this is to have all of the convenient ElementArrayFinder
functional utilities, like map()
, each()
, reduce()
and to be able to call getText()
on it producing a promise which would resolve into an array of element texts.