In Protractor, Say I have 5 elements with the same class/model/binding/repeater tags.
For example:-
Guest 1 - $2345
Guest 2 - $2345
Guest 3 - $2345
Guest 4 - $2345
Guest 5 - $2345
So, to inspect the first and last element we will write code something like this:
element.all(by.css('')).first();
element.all(by.css('')).last();
Now, how to detect the 2nd, 3rd and 4th element using the same css tag?
I was thinking of taking the for loop.. but not able to proceed.
Use .get() , index starting from 0
let second = $$('LOCATOR').get(1)
let third = $$('LOCATOR').get(2)
let forth = $$('LOCATOR').get(3)
expect(second.getText()).toEqual('Guest 2 - $2345')
Also you can look on this lib - https://github.com/Marketionist/protractor-numerator