Class: PageObject::Elements::SelectList
- Defined in:
- lib/page-object/elements/select_list.rb
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
-
#[](idx) ⇒ PageObject::Elements::Option
Return the PageObject::Elements::Option for the index provided.
-
#options ⇒ array of PageObject::Elements::Option
Return an array of Options contained in the select list.
-
#selected_options ⇒ Array<String>
An array of strings representing the text of the currently selected options.
-
#selected_values ⇒ Array<String>
An array of strings representing the value of the currently selected options.
Methods inherited from Element
#==, #check_exists, #check_visible, #children, #disabled?, #drag_and_drop_on, #following_sibling, #following_siblings, #initialize, #method_missing, #name, #parent, plural_form, #preceding_sibling, #preceding_siblings, #present?, #respond_to_missing?, #siblings, #wait_until, #when_not_present, #when_present
Methods included from NestedElements
Constructor Details
This class inherits a constructor from PageObject::Elements::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PageObject::Elements::Element
Instance Method Details
#[](idx) ⇒ PageObject::Elements::Option
Return the PageObject::Elements::Option for the index provided. Index is zero based.
11 12 13 |
# File 'lib/page-object/elements/select_list.rb', line 11 def [](idx) [idx] end |
#options ⇒ array of PageObject::Elements::Option
Return an array of Options contained in the select list.
20 21 22 |
# File 'lib/page-object/elements/select_list.rb', line 20 def element..map { |e| PageObject::Elements::Option.new(e) } end |
#selected_options ⇒ Array<String>
Returns An array of strings representing the text of the currently selected options.
27 28 29 |
# File 'lib/page-object/elements/select_list.rb', line 27 def element..map(&:text).compact end |
#selected_values ⇒ Array<String>
Returns An array of strings representing the value of the currently selected options.
34 35 36 |
# File 'lib/page-object/elements/select_list.rb', line 34 def selected_values element..map(&:value).compact end |