Method: Webrat::Scope#fill_in

Defined in:
lib/webrat/core/scope.rb

#fill_in(field_locator, options = {}) ⇒ Object

Verifies an input field or textarea exists on the current page, and stores a value for it which will be sent when the form is submitted.

Examples:

fill_in "Email", :with => "user@example.com"
fill_in "user[email]", :with => "user@example.com"

The field value is required, and must be specified in options[:with]. field can be either the value of a name attribute (i.e. user[email]) or the text inside a <label> element that points at the <input> field.



50
51
52
53
54
# File 'lib/webrat/core/scope.rb', line 50

def fill_in(field_locator, options = {})
  field = locate_field(field_locator, TextField, TextareaField, PasswordField)
  field.raise_error_if_disabled
  field.set(options[:with])
end

Comments