bfaqwa
Last Updated: February 25, 2016
·
5.247K
· 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.