Adding Field.xpath_search method with the XPath to all Webrat fields

This commit is contained in:
Bryan Helmkamp 2008-11-29 01:12:07 -05:00
parent e0488cd8e4
commit 4736c4cb1a
2 changed files with 5 additions and 1 deletions

View File

@ -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

View File

@ -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)