module Watir::List

Public Instance Methods

[](idx) click to toggle source

Returns item from this list at given index.

@param [Integer] idx @return Watir::LI

# File lib/watir/elements/list.rb, line 33
def [](idx)
  list_items[idx]
end
each(&block) click to toggle source

Yields each LI associated with this list.

@example

list = browser.ol
list.each do |li|
  puts li.text
end

@yieldparam [Watir::LI] element Iterate through the items for this List.

# File lib/watir/elements/list.rb, line 17
def each(&block)
  list_items.each(&block)
end
list_items() click to toggle source
# File lib/watir/elements/list.rb, line 37
def list_items
  LICollection.new(self, adjacent: :child, tag_name: 'li')
end