How to click first link in that case:
<div class="item">
<a href="/agree/">Agree</a>
</div>
<div class="item">
<a href="/agree/">Agree</a>
</div>
within ".item" do
first(:link, "Agree").click
end
and I get this error:
Capybara::Ambiguous:
Ambiguous match, found 2 elements matching css ".item"
And without the within
I get this error:
Failure/Error: first(:link, "Agree").click
NoMethodError:
undefined method `click' for nil:NilClass