Last Updated: July 01, 2022
·
22.16K
· vlado

Capybara - select first element (Ambiguity Resolution)

To select first element with Capybara use

find(".my-selector", match: :first)

This is much better then

all(".my-selector").first

or

first(".my-selector")

cause it will wait for at least one element matching selector to appear on the page.