lib/kelp/field.rb
# Check a checkbox, select from a dropdown or listbox, or fill in a text
# field, depending on what kind of form field is available. If value
# is `checked` or `unchecked`, assume `field` is a checkbox; otherwise,
# fall back on {#select_or_fill}.
#
# @param [String] field
#   Capybara locator for the field (name, id, or label text)
# @param [String] value
#   Text to select from a dropdown or enter in a text box, or
#   `checked` or `unchecked` to operate on a checkbox
#
# @raise [Kelp::AmbiguousField]
#   If more than one field is found matching the given identifier
# @raise [Kelp::FieldNotFound]
#   If no checkbox, dropdown, or text box is found with the given
#   identifier
#
# @since 0.1.9
#
Check a checkbox, select from a dropdown or listbox, or fill in a text
field, depending on what kind of form field is available.
Check a checkbox select from a dropdown or listbox or fill in a text field depending on what kind of form field is available .
def check_or_select_or_fill(field, value)
      begin
        if value == "checked"
          check(field)
        elsif value == "unchecked"
          uncheck(field)
        else
          select_or_fill(field, value)
        end
      rescue Capybara::ElementNotFound
        select_or_fill(field, value)
      end
    end
def check_or_select_or_fill ( field , value ) begin if value == "checked" check ( field ) elsif value == "unchecked" uncheck ( field ) else select_or_fill ( field , value ) end rescue Capybara :: ElementNotFound select_or_fill ( field , value ) end end
Check a checkbox, select from a dropdown or listbox, or fill in a text
field, depending on what kind of form field is available.
Check a checkbox select from a dropdown or listbox or fill in a text field depending on what kind of form field is available .
# If value is "checked" or "unchecked", assume # field is a checkbox
[Kelp::AmbiguousField] If more than one field is found matching the given identifier
[ Kelp :: AmbiguousField ] If more than one field is found matching the given identifier
[Kelp::FieldNotFound] If no checkbox, dropdown, or text box is found with the given identifier
[ Kelp :: FieldNotFound ] If no checkbox dropdown or text box is found with the given identifier
field
<not_specific>
value
<not_specific>
<not_specific>
value Text to select from a dropdown or enter in a text box, or `checked` or `unchecked` to operate on a checkbox
value Text to select from a dropdown or enter in a text box or ` checked ` or ` unchecked ` to operate on a checkbox
since
None