class FormElement

Public Class Methods

new(bot, target, value = nil, element = nil) click to toggle source
Calls superclass method MechanizeElement::new
# File lib/web_minion/bots/elements/form_element.rb, line 4
def initialize(bot, target, value = nil, element = nil)
  super(bot, target, value, element)
end

Public Instance Methods

get() click to toggle source
# File lib/web_minion/bots/elements/form_element.rb, line 8
def get
  case @target_type
  when :index
    index_get
  when :string_path
    string_get
  when :first_last
    first_last_get
  else
    raise(InvalidTargetType, "#{@target_type} is not valid!")
  end
end

Private Instance Methods

first_last_get() click to toggle source
# File lib/web_minion/bots/elements/form_element.rb, line 23
def first_last_get
  if @target == "first"
    @bot.page.forms.first
  elsif @target == "last"
    @bot.page.forms.last
  else
    raise(InvalidTargetType, "#{@target} is not first or last!")
  end
end
index_get() click to toggle source
# File lib/web_minion/bots/elements/form_element.rb, line 33
def index_get
  @bot.page.forms[@target]
end
string_get() click to toggle source
# File lib/web_minion/bots/elements/form_element.rb, line 37
def string_get
  @bot.page.form_with(@target)
end