如果有两个链接具有相同的元素名称,但位于页面的不同形式上,如何指定一个链接?
我的意思是在检查 我的元素我发现这两个链接 名称相同但形式不同。 我想点击第二个链接。 我如何在水中指定这一点?
提前致谢。
What I mean that in the inspection of
my element I found that the two links
have the same name but are on different forms.
I want to click the second link.
How could I specify that in water?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您提供相关的 HTML,我可以更具体。
If you provide relevant HTML I can be more specific.
这两个链接都位于一个 div 内,并带有一些独特的文本。
尽管它们的文本相同,但 href 不同。
这为您提供了两种潜在的方法
1) 如果您知道 href 不会更改,则只需使用该链接来寻址
2) 如果文本不会更改,并且您无法确定 href,则参考它通过外部容器使用正则表达式来匹配已知文本
The two links are each inside a div along with some unique text
Also despite the fact their text is the same the href is different.
This gives you two potential approaches
1) if you know the href won't change, then just address the link using that
2) if the text won't change, and you can't be sure about the href, then refer to it via the outer container using a regular expression to match the known text