开发者

If there are two links with the same element name but are on different forms of a page how to specify one over the other?

If there are two links with the same element name but are on different forms of a page how to specify one over the other?

What I mean t开发者_JAVA技巧hat 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.


browser.form(how, what).link(how, what)

If you provide relevant HTML I can be more specific.


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

browser.link(:href, 'javascript:document.poentryform.submit();').click

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

browser.div(:class => 'screenlet-title-bar', :text => /Purchase Order/).link(:text, 'Continue').click
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜