Search code examples
javascriptjasmineprotractorjasmine-nodejasmine2.0

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.


Solution

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