Class: FireWatir::SelectList
- Includes:
- Watir::SelectListCommonWatir
- Defined in:
- lib/watirloo/extension/firewatir_ducktape.rb
Instance Method Summary collapse
-
#set(item) ⇒ Object
For single select lists the last item in array wins.
-
#set_value(value) ⇒ Object
set item by the option value attribute.
-
#values ⇒ Object
returns array of value attributes each option usually has a value attribute which is hidden to the person viewing the page.
Methods included from Watir::SelectListCommonWatir
#selected_item, #selected_items, #selected_value, #selected_values
Instance Method Details
#set(item) ⇒ Object
For single select lists the last item in array wins
examples
select_list.set 'bla' # => single option text
select_list.set ['bla','foo','gugu'] # => set 3 options by text. If
this is a single select list box it will set each value in turn
select_list set 1 # => set the first option in a list
select_list.set [1,3,5] => set the first, third and fith options
86 87 88 |
# File 'lib/watirloo/extension/firewatir_ducktape.rb', line 86 def set(item) _set(:text, item) end |
#set_value(value) ⇒ Object
set item by the option value attribute. if array then set one after anohter. see examples in set method
92 93 94 |
# File 'lib/watirloo/extension/firewatir_ducktape.rb', line 92 def set_value(value) _set(:value, value) end |
#values ⇒ Object
returns array of value attributes each option usually has a value attribute which is hidden to the person viewing the page
99 100 101 102 103 104 105 |
# File 'lib/watirloo/extension/firewatir_ducktape.rb', line 99 def values a = [] items.each do |item| a << option(:text, item).value end return a end |