Sha256: 26f2e053eee24cb59df9771afae2059084c4399d07e61525f05c3e58b2b1c9a3

Contents?: true

Size: 986 Bytes

Versions: 3

Compression:

Stored size: 986 Bytes

Contents

module PageObject
  module Platforms
    module WatirWebDriver
      module UnorderedList

        #
        # 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 unordered list
        #
        def items
          children.size
        end

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

        private

        def children
          element.uls(: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/unordered_list.rb
page-object-1.2.1 lib/page-object/platforms/watir_webdriver/unordered_list.rb
page-object-1.2.0 lib/page-object/platforms/watir_webdriver/unordered_list.rb