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?
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
精彩评论