# File lib/capybara/node/finders.rb, line 131 def first(*args) selector = Capybara::Selector.normalize(*args) options = extract_normalized_options(args) found_elements = [] selector.xpaths.each do |path| find_in_base(selector, path).each do |node| node.without_wait do if matches_options(node, options) found_elements << node return found_elements.last if not Capybara.prefer_visible_elements or node.visible? end end end end found_elements.first end