Class: PageObject::Elements::UnorderedList

Inherits:
Element
  • Object
show all
Includes:
Enumerable
Defined in:
lib/page-object/elements/unordered_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.



21
22
23
# File 'lib/page-object/elements/unordered_list.rb', line 21

def [](idx)
  list_items[idx]
end

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

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



11
12
13
# File 'lib/page-object/elements/unordered_list.rb', line 11

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

#itemsObject

Return the number of items contained in the unordered list



28
29
30
# File 'lib/page-object/elements/unordered_list.rb', line 28

def items
  list_items.size
end

#list_itemsObject

Return Array of ListItem objects that are children of the UnorderedList



35
36
37
# File 'lib/page-object/elements/unordered_list.rb', line 35

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