Recently, I have been experimenting with protractor and facing a limitation when trying to reference elements. The only way to refer to them is through CSS, as they only have a class attribute provided. The issue arises when there are more than 7 elements with the same class name. To locate the elements, I initially used the following syntax:
element.all(by.css('h4.ng-binding')).first();
This worked perfectly for the first element, but the same logic failed to work for the others. Below are the snippets of code I attempted to use to locate the subsequent elements:
element.all(by.css('h4.ng-binding')).second();
element.all(by.css('h4.ng-binding')).third();
element.all(by.css('h4.ng-binding')).fourth();
element.all(by.css('h4.ng-binding')).fifth();
element.all(by.css('h4.ng-binding')).sixth();
element.all(by.css('h4.ng-binding')).seventh();
element.all(by.css('h4.ng-binding')).eighth();