简体   繁体   中英

How to access multiple id elements in serenity-js

I have 5 links with the same name and id and linktext. I am using serenity-js. how can I access the 4th link

page.ts has

static link = Target.the('click the 4th link').located(by.linktext('link'));

Not sure if that can help anyone but Target finds all elements with specified selector, so what you can do in Java (not sure about javascript though) is you can map the result to:

List<WebElement> links = link.resolveAllFor(actor);

and then access by index links.get(x)

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