Module: Fluent::Platforms::WatirWebDriver::SelectList

Defined in:
lib/fluent/platform_watir/platform_web_elements/select_list.rb

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Object

Returns an object representing the option for the index provided. The index is zero-based.

Returns:

  • (Object)

    Fluent::WebElements::Option



36
37
38
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 36

def [](index)
  options[index]
end

#include?(value) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 28

def include?(value)
  web_element.include? value
end

#optionsArray

Provides an array of Option objects that are contained within a select list object.

Returns:

  • (Array)

    Fluent::WebElements::Option objects



44
45
46
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 44

def options
  web_element.options.map { |option| ::Fluent::WebElements::Option.new(option, :platform => :watir_webdriver) }
end

#select(value) ⇒ Object



6
7
8
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 6

def select(value)
  web_element.select(value)
end

#select_value(value) ⇒ Object



10
11
12
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 10

def select_value(value)
  web_element.select_value(value)
end

#selected?(value) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 14

def selected?(value)
  web_element.selected? value
end

#selected_optionsArray

Returns array of strings representing the text of the currently selected options.

Returns:

  • (Array)

    array of strings representing the text of the currently selected options



19
20
21
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 19

def selected_options
  web_element.selected_options.map { |e| e.text }.compact
end

#selected_valuesArray

Returns array of strings representing the value of the currently selected options.

Returns:

  • (Array)

    array of strings representing the value of the currently selected options



24
25
26
# File 'lib/fluent/platform_watir/platform_web_elements/select_list.rb', line 24

def selected_values
  web_element.selected_options.map { |e| e.value }.compact
end