Webrat::Locators

Public Instance Methods

field_by_xpath(xpath) click to toggle source
# File lib/webrat/core/locators.rb, line 15
def field_by_xpath(xpath)
  Field.load(@session, dom.xpath(xpath).first)
end
field_labeled(label, *field_types) click to toggle source

Locates a form field based on a label element in the HTML source. This can be useful in order to verify that a field is pre-filled with the correct value.

Example:

field_labeled("First name").value.should == "Bryan"
# File lib/webrat/core/locators/field_labeled_locator.rb, line 51
def field_labeled(label, *field_types)
  FieldLabeledLocator.new(@session, dom, label, *field_types).locate!
end
field_named(name, *field_types) click to toggle source
# File lib/webrat/core/locators/field_named_locator.rb, line 36
def field_named(name, *field_types)
  FieldNamedLocator.new(@session, dom, name, *field_types).locate!
end
field_with_id(id, *field_types) click to toggle source
# File lib/webrat/core/locators/field_by_id_locator.rb, line 32
def field_with_id(id, *field_types)
  FieldByIdLocator.new(@session, dom, id, *field_types).locate!
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.