Xpath 索引的量角器元素

Protractor element by Xpath Index

我正在尝试通过索引获取 xpath,但我没有取得进展。量角器说 "that the element has more than one element is found for locator choosing the 1st one"。但是我想确保第一个是故意选择下面的屏幕截图:

我的代码:那是行不通的: 我试过以下网站没有任何效果: https://devhints.io/xpath xpath get element by index 任何帮助将不胜感激。

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