lib/kelp/helper.rb
# A slightly friendlier version of Capybara's `find_field`, which actually
# tells you which locator failed to match (instead of giving a useless
# Unable to find '#<XPath::Union:0xXXXXXXX>' message).
#
# @raise [Kelp::AmbiguousField]
#   If more than one field with the given locator was found
# @raise [Kelp::FieldNotFound]
#   If no field with the given locator could be found
#
A slightly friendlier version of Capybara's `find_field`, which actually
tells you which locator failed to match (instead of giving a useless
Unable to find '#' message).
A slightly friendlier version of Capybara ' s ` find_field ` which actually tells you which locator failed to match ( instead of giving a useless Unable to find ' # ' message ) .
def nice_find_field(locator)
      begin
        field = find_field(locator)
      rescue Capybara::ElementNotFound
        raise Kelp::FieldNotFound,
          "Could not find field: '#{locator}'"
      end
    end
def nice_find_field ( locator ) begin field = find_field ( locator ) rescue Capybara :: ElementNotFound raise Kelp :: FieldNotFound , "Could not find field: '#{locator}'" end end
A slightly friendlier version of Capybara's `find_field`, which actually
tells you which locator failed to match (instead of giving a useless
Unable to find '#<XPath::Union:0xXXXXXXX>' message).
A slightly friendlier version of Capybara ' s ` find_field ` which actually tells you which locator failed to match ( instead of giving a useless Unable to find ' #<XPath :: Union : 0xXXXXXXX > ' message ) .
[Kelp::AmbiguousField] If more than one field with the given locator was found
[ Kelp :: AmbiguousField ] If more than one field with the given locator was found
[Kelp::FieldNotFound] If no field with the given locator could be found
[ Kelp :: FieldNotFound ] If no field with the given locator could be found
locator
<not_specific>