Protractor has the .first() and .last() methods available on ElementArrayFinder :
var elements = element.all(by.css(".myclass")); elements.last(); elements.first();
But how to get an element immediately before the last (penultimate), without knowing how many total elements in total?
source share