class WWW::Mechanize::Form::SelectList
Options can also be selected by “clicking” or selecting them. See Option
selectlist.value = selectlist.options.first.value
the select lists value to the option value:
list of Option that were found. After finding the correct option, set
value for the list by calling SelectList#value=. SelectList contains a
This class represents a select list or drop down box in a Form. Set the
def initialize(name, node)
def initialize(name, node) super(name, node) if selected_options.length > 1 selected_options.reverse[1..selected_options.length].each do |o| o.unselect end end end
def value
def value value = super if value.length > 0 value.last elsif @options.length > 0 @options.first.value else nil end end
def value=(new)
def value=(new) if new != new.to_s and new.respond_to? :first super([new.first]) else super([new.to_s]) end end