Sha256: 8a41bb359a9e4311fc1a8586c7f181f35b964b8227b82085ccba6223130a7739

Contents?: true

Size: 904 Bytes

Versions: 7

Compression:

Stored size: 904 Bytes

Contents

module PageObject
  module Platforms
    module SeleniumWebDriver
      module UnorderedList

        #
        # 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 unordered 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

7 entries across 7 versions & 2 rubygems

Version Path
page-object-lds-0.0.14 lib/page-object/platforms/selenium_webdriver/unordered_list.rb
page-object-lds-0.0.13 lib/page-object/platforms/selenium_webdriver/unordered_list.rb
page-object-lds-0.0.12 lib/page-object/platforms/selenium_webdriver/unordered_list.rb
page-object-lds-0.0.11 lib/page-object/platforms/selenium_webdriver/unordered_list.rb
page-object-lds-0.0.1 lib/page-object/platforms/selenium_webdriver/unordered_list.rb
meeane-page-object-0.1.10 lib/page-object/platforms/selenium_webdriver/unordered_list.rb
meeane-page-object-0.1.8 lib/page-object/platforms/selenium_webdriver/unordered_list.rb