Sha256: 52836a918deebbe0dc04ec9e9a5dd389fe3011c5a443a0fa5979c7b93d3f314a

Contents?: true

Size: 961 Bytes

Versions: 3

Compression:

Stored size: 961 Bytes

Contents

module PageObject
  module Platforms
    module WatirWebDriver
      module OrderedList

        #
        # Return the PageObject::Elements::ListItem for the index provided.  Index
        # is zero based.
        #
        # @return [PageObject::Elements::ListItem]
        #
        def [](idx)
          Object::PageObject::Elements::ListItem.new(children[idx], :platform => @platform.class::PLATFORM_NAME)
        end

        #
        # Return the number of items contained in the ordered list
        #
        def items
          children.size
        end

        #
        # Return the ListItem objects that are children of the OrderedList
        #
        def list_items
          children.collect do |obj|
            Object::PageObject::Elements::ListItem.new(obj, :platform => :watir_webdriver)
          end
        end

        private

        def children
          element.ols(:xpath => child_xpath)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
page-object-1.2.2 lib/page-object/platforms/watir_webdriver/ordered_list.rb
page-object-1.2.1 lib/page-object/platforms/watir_webdriver/ordered_list.rb
page-object-1.2.0 lib/page-object/platforms/watir_webdriver/ordered_list.rb