class FireWatir::SelectList

Description:

Class for SelectList element.

Constants

INPUT_TYPES

Attributes

o[RW]

Public Instance Methods

[](key) click to toggle source

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
clear() click to toggle source

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
Also aliased as: clearSelection
clearSelection() click to toggle source
Alias for: clear
each() { |option(self, :jssh_name, arr_options)| ... } click to toggle source
# 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
getAllContents() click to toggle source
Alias for: options
getSelectedItems() click to toggle source
Alias for: selected_options
option(attribute, value) click to toggle source

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
options() click to toggle source

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
Also aliased as: getAllContents
select( item ) click to toggle source

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
Also aliased as: set
select_value( item ) click to toggle source

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
selected_options() click to toggle source

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
Also aliased as: getSelectedItems
set( item ) click to toggle source
Alias for: select