diff --git a/lib/webrat/core/field.rb b/lib/webrat/core/field.rb index f52a002..28271d2 100644 --- a/lib/webrat/core/field.rb +++ b/lib/webrat/core/field.rb @@ -10,6 +10,10 @@ module Webrat class Field #:nodoc: attr_reader :value + def self.xpath_search + [".//button", ".//input", ".//textarea", ".//select"] + end + def initialize(form, element) @form = form @element = element diff --git a/lib/webrat/core/locators.rb b/lib/webrat/core/locators.rb index 68476b5..2d91e8b 100644 --- a/lib/webrat/core/locators.rb +++ b/lib/webrat/core/locators.rb @@ -53,7 +53,7 @@ module Webrat end def find_field_with_id(id, *field_types) #:nodoc: - field_elements = Webrat::XML.css_search(dom, "button", "input", "textarea", "select") + field_elements = Webrat::XML.xpath_search(dom, *Field.xpath_search) field_element = field_elements.detect do |field_element| if id.is_a?(Regexp)