# File lib/webrat/core/locators.rb, line 15 def field_by_xpath(xpath) Field.load(@session, dom.xpath(xpath).first) end
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
Generated with the Darkfish Rdoc Generator 2.