Class: PageObject::Elements::OrderedList

Inherits:
Element
  • Object
show all
Includes:
Enumerable
Defined in:
lib/page-object/elements/ordered_list.rb

Instance Attribute Summary

Attributes inherited from Element

#element

Instance Method Summary collapse

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

included

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::ListItem

Return the PageObject::Elements::ListItem for the index provided. Index is zero based.



22
23
24
# File 'lib/page-object/elements/ordered_list.rb', line 22

def [](idx)
  list_items[idx]
end

#each(&block) ⇒ PageObject::Elements::ListItem

iterator that yields with a PageObject::Elements::ListItem



12
13
14
# File 'lib/page-object/elements/ordered_list.rb', line 12

def each(&block)
  list_items.each(&block)
end

#itemsObject

Return the number of items contained in the ordered list



29
30
31
# File 'lib/page-object/elements/ordered_list.rb', line 29

def items
  list_items.size
end

#list_itemsObject

Return Array of ListItem objects that are children of the OrderedList



36
37
38
# File 'lib/page-object/elements/ordered_list.rb', line 36

def list_items
  @list_items ||= children(tag_name: 'li')
end