Sha256: 964d6971c86b8a17b95c09df73dffda23361d7b4f83d5c356d6b3696eb541a81

Contents?: true

Size: 861 Bytes

Versions: 46

Compression:

Stored size: 861 Bytes

Contents

module PageObject
  module Platforms
    module SeleniumWebDriver
      module OrderedList

        #
        # Return the PageObject::Elements::ListItem for the index provided.  Index
        # is zero based.
        #
        # @return [PageObject::Elements::ListItem]
        #
        def [](idx)
          children[idx]
        end

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

        private

        def children
          items = list_items.map do |item|
            ::PageObject::Elements::ListItem.new(item, :platform => :selenium_webdriver)
          end
          items.find_all { |item| item.parent.element == element }
        end

        def list_items
          element.find_elements(:xpath, child_xpath)
        end

      end
    end
  end
end

Version data entries

46 entries across 46 versions & 3 rubygems

Version Path
page-object-0.6.7 lib/page-object/platforms/selenium_webdriver/ordered_list.rb
page-object-0.6.6 lib/page-object/platforms/selenium_webdriver/ordered_list.rb
page-object-0.6.5 lib/page-object/platforms/selenium_webdriver/ordered_list.rb
page-object-0.6.4 lib/page-object/platforms/selenium_webdriver/ordered_list.rb
page-object-0.6.3 lib/page-object/platforms/selenium_webdriver/ordered_list.rb
page-object-0.6.2 lib/page-object/platforms/selenium_webdriver/ordered_list.rb