简体   繁体   中英

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:

在此处输入图片说明 My code: that is not working: 在此处输入图片说明 I tried the following site nothing works: https://devhints.io/xpath xpath get element by index Any help would be appreciated.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM