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