In Protractor, we can get a single element from an array by index via:
var elements = element.all(by.css(".myclass"));
elements.get(1);
elements.first();
elements.last();
But, is it possible to slice out a subarray out of the array of elements in a similar fashion?
Ideally, we'd like to have something like:
var subelements = elements.slice(2, 5);
// subelements is also an ElementArrayFinder
// we can call "filter()", "map()" etc on subelements
I think we would need to extend ElementArrayFinder
by defining a custom protractor.ElementArrayFinder.prototype.slice()
method (similar to how it was done here).
I've also noticed this pull request, but it has not been merged and it is not active anymore.