Making Webrat's usage of the #path Nokogiri method work with Hpricot too

This commit is contained in:
Bryan Helmkamp 2008-11-26 14:25:42 -05:00
parent 54de30032e
commit 01fcd0dea1
2 changed files with 14 additions and 2 deletions

View File

@ -43,7 +43,11 @@ module Webrat
end
def path
@element.path
if Webrat.configuration.parse_with_nokogiri?
@element.path
else
@element.xpath
end
end
def matches_id?(id)

View File

@ -19,7 +19,15 @@ module Webrat
end
def field_by_element(element, *field_types)
fields_by_type(field_types).detect { |possible_field| possible_field.path == element.path }
if Webrat.configuration.parse_with_nokogiri?
expected_path = element.path
else
expected_path = element.xpath
end
fields_by_type(field_types).detect do |possible_field|
possible_field.path == element.xpath
end
end
def find_select_option(option_text)