Module: SelectListHelper

Defined in:
lib/watir_helper/select_list_helper.rb

Instance Method Summary collapse

Instance Method Details

#clear_selection_from_select_list(browser_handle, property, property_value) ⇒ Object

Clear selection from a Select list.



14
15
16
# File 'lib/watir_helper/select_list_helper.rb', line 14

def clear_selection_from_select_list(browser_handle, property, property_value)
  browser_handle.select_list(property.intern, /#{property_value}/).clear
end

#exists_select_list?(browser_handle, property, property_value) ⇒ Boolean

Check whether a Select list exists or not.

Returns:

  • (Boolean)


34
35
36
# File 'lib/watir_helper/select_list_helper.rb', line 34

def exists_select_list?(browser_handle, property, property_value)
  browser_handle.select_list(property.intern, /#{property_value}/).exists?
end

#flash_select_list(browser_handle, property, property_value) ⇒ Object

Highlight or Flash a Select list.



29
30
31
# File 'lib/watir_helper/select_list_helper.rb', line 29

def flash_select_list(browser_handle, property, property_value)
  browser_handle.select_list(property.intern, /#{property_value}/).flash
end

#get_all_contents_of_select_list(browser_handle, property, property_value) ⇒ Object

Get all contents of a Select list.



24
25
26
# File 'lib/watir_helper/select_list_helper.rb', line 24

def get_all_contents_of_select_list(browser_handle, property, property_value)
  browser_handle.select_list(property.intern, /#{property_value}/).options.map(&:text)
end

#get_selected_contents_of_select_list(browser_handle, property, property_value) ⇒ Object

Get selected contents of a Select list.



19
20
21
# File 'lib/watir_helper/select_list_helper.rb', line 19

def get_selected_contents_of_select_list(browser_handle, property, property_value)
  browser_handle.select_list(property.intern, /#{property_value}/).selected_options.map(&:text)
end

#is_value_selected_from_select_list?(browser_handle, property, property_value, selected_value) ⇒ Boolean

Check whether a particular value is selected from a Select list or not.

Returns:

  • (Boolean)


39
40
41
# File 'lib/watir_helper/select_list_helper.rb', line 39

def is_value_selected_from_select_list?(browser_handle, property, property_value, selected_value)
  browser_handle.select_list(property.intern, /#{property_value}/).selected?(selected_value)
end

#select_from_select_list(browser_handle, property, property_value, selected_value) ⇒ Object

Select from a Select list.



9
10
11
# File 'lib/watir_helper/select_list_helper.rb', line 9

def select_from_select_list(browser_handle, property, property_value, selected_value)
  browser_handle.select_list(property.intern, /#{property_value}/).select(selected_value)
end