In Protractor, there is the .first()
and .last()
methods available on ElementArrayFinder
:
var elements = element.all(by.css(".myclass"));
elements.last();
elements.first();
But, how to get the element just before the last one (penultimate) without knowing how many elements are there in total?