Q:

click on second ambiguous link with Capybara

I want to click on the second of the two following links:
<a href="photo/1">photo</a>
<a href="photo/2">photo</a>

As you can see, the URLs are actually different, but the link title, "photo", is the same in both. I am not using IDs on my links, and there is no nesting class context by which to distinguish the links.
Ideally, I would like to be able to click even a third, or nth ambiguous link.
An example of a DSL for this purpose would be something like:
click_link photo.title, match: 2

A:

I find that using all is easier to read than locating by xpath:
all('a', :text => 'photo')[1].click

However, it not as fast as using xpath.

