Jonathan
Jonathan

Reputation: 395

Protractor element by Xpath Index

I am trying to get xpath by index and i am not making an progress. protractor says "that the element has more than one element is found for locator choosing the 1st one". however I want to make sure that the 1st one is selected intentionally screen shot below:

enter image description here My code: that is not working: enter image description here I tried the following site nothing works: https://devhints.io/xpath xpath get element by index Any help would be appreciated.

Upvotes: 0

Views: 1593

Answers (1)

tehbeardedone
tehbeardedone

Reputation: 2858

var payroll = element.all(by.xpath('//*[text()="Payroll"]')).first();

Upvotes: 1

Related Questions