How to click first link in that case:
most of those solutions will not use Capybara's brilliant waiting features
better do as this link suggests:
https://thoughtbot.com/blog/write-reliable-asynchronous-integration-tests-with-capybara#find-the-first-matching-element
first(".active").click
If there isn’t an .active element on the page yet, first will return nil and the click will fail.
If you want to make sure there's exactly one
find(".active").click
If you just want the first element
find(".active", match: :first).click
Capybara will wait for the element to appear before trying to click.
Note that match: :first is more brittle, because it will silently click on a different element if you introduce new elements which match.