Module: PageObject::Platforms::WatirWebDriver::SelectList
- Defined in:
- lib/page-object/platforms/watir_webdriver/select_list.rb
Instance Method Summary collapse
-
#[](idx) ⇒ PageObject::Elements::Option
Return the PageObject::Elements::Option for the index provided.
-
#include?(value) ⇒ Boolean
Returns true if the select list has one or more options where text or label matches the given value.
-
#options ⇒ array of PageObject::Elements::Option
Return an array of Options contained in the select lit.
-
#select(value) ⇒ Object
Select a value from the list.
-
#selected?(value) ⇒ Boolean
Returns true if any of the selected options’ text or label match the given value.
-
#selected_options ⇒ Array<String>
An array of strings representing the text value of the currently selected options.
Instance Method Details
#[](idx) ⇒ PageObject::Elements::Option
Return the PageObject::Elements::Option for the index provided. Index is zero based.
12 13 14 |
# File 'lib/page-object/platforms/watir_webdriver/select_list.rb', line 12 def [](idx) Object::PageObject::Elements::Option.new([idx], :platform => :watir_webdriver) end |
#include?(value) ⇒ Boolean
Returns true if the select list has one or more options where text or label matches the given value.
49 50 51 |
# File 'lib/page-object/platforms/watir_webdriver/select_list.rb', line 49 def include?(value) element.include? value end |
#options ⇒ array of PageObject::Elements::Option
Return an array of Options contained in the select lit.
28 29 30 31 32 33 34 35 |
# File 'lib/page-object/platforms/watir_webdriver/select_list.rb', line 28 def elements = [] = element.wd.find_elements(:xpath, child_xpath) .each do |opt| elements << Object::PageObject::Elements::Option.new(opt, :platform => :watir_webdriver) end elements end |
#select(value) ⇒ Object
Select a value from the list
19 20 21 |
# File 'lib/page-object/platforms/watir_webdriver/select_list.rb', line 19 def select(value) element.select(value) end |
#selected?(value) ⇒ Boolean
Returns true if any of the selected options’ text or label match the given value.
58 59 60 |
# File 'lib/page-object/platforms/watir_webdriver/select_list.rb', line 58 def selected?(value) element.selected? value end |
#selected_options ⇒ Array<String>
Returns An array of strings representing the text value of the currently selected options.
40 41 42 |
# File 'lib/page-object/platforms/watir_webdriver/select_list.rb', line 40 def element..map { |e| e.text }.compact end |