Question

I have a page with HTML like this:

<a>text</a>
<img src="image.png" />
<a>text</a>

I would like to click the second link. Links have completely identical attributes. The only thing that is different is that the second link is after an image.

This always clicks the first link:

browser.link(:text, "text").click

OTHER TIPS

You can also do:

browser.link(:text=>"text",:index=>2)

In general, you can include any combination of conditions via a ruby hash.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top