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.
Written by Vlado Cingel
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Find
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#