Description:
Class for SelectList element.
Description:
Get option element at specified index in select list.
Input:
key - option index
Output:
Option element at specified index
# File lib/firewatir/elements/select_list.rb, line 49 def [] (key) assert_exists arr_options = js_options return Option.new(self, :jssh_name, arr_options[key - 1]) end
Description:
Clears the selected items in the select box.
# File lib/firewatir/elements/select_list.rb, line 15 def clear assert_exists #highlight( :set) wait = false each do |selectBoxItem| if selectBoxItem.selected selectBoxItem.selected = false wait = true end end self.wait if wait #highlight( :clear) end
# File lib/firewatir/elements/select_list.rb, line 30 def each assert_exists arr_options = js_options #puts arr_options[0]#.length for i in 0..arr_options.length - 1 do yield Option.new(self, :jssh_name, arr_options[i]) end end
Description:
Get the option using attribute and its value.
Input:
- attribute - Attribute used to find the option. - value - value of that attribute.
# File lib/firewatir/elements/select_list.rb, line 128 def option (attribute, value) assert_exists Option.new(self, attribute, value) end
Description:
Gets all the items in the select list as an array. An empty array is returned if the select box has no contents.
Output:
Array containing the items of the select list.
# File lib/firewatir/elements/select_list.rb, line 86 def options assert_exists #element.log "There are #{@o.length} items" returnArray = [] each { |thisItem| returnArray << thisItem.text } return returnArray end
Description:
Selects an item by text. If you need to select multiple items you need to call this function for each item.
Input:
- item - Text of item to be selected.
# File lib/firewatir/elements/select_list.rb, line 62 def select( item ) select_items_in_select_list(:text, item) end
Description:
Selects an item by value. If you need to select multiple items you need to call this function for each item.
Input:
item - Value of the item to be selected.
# File lib/firewatir/elements/select_list.rb, line 74 def select_value( item ) select_items_in_select_list(:value, item) end
Description:
Gets all the selected items in the select list as an array. An empty array is returned if the select box has no selected item.
Output:
Array containing the selected items of the select list.
# File lib/firewatir/elements/select_list.rb, line 104 def selected_options assert_exists returnArray = [] #element.log "There are #{@o.length} items" each do |thisItem| #puts "#{thisItem.selected}" if thisItem.selected #element.log "Item ( #{thisItem.text} ) is selected" returnArray << thisItem.text end end return returnArray end