Sha256: d1bc91ff11cf0a6cab6997634359786129efc30d3d1c0bbe893c06df0ba0a187

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

module PageObject
  module Elements
    class SelectList < Element

      def initialize(element, platform)
        @element = element
        include_platform_for platform
      end

      protected

      def child_xpath
        ".//child::option"
      end

      def self.watir_finders
        super + [:text, :value]
      end

      def self.selenium_finders
        super + [:css]
      end

      def include_platform_for platform
        super
        if platform[:platform] == :watir_webdriver
          require 'page-object/platforms/watir_webdriver/select_list'
          self.class.send :include, PageObject::Platforms::WatirWebDriver::SelectList
        elsif platform[:platform] == :selenium_webdriver
          require 'page-object/platforms/selenium_webdriver/select_list'
          self.class.send :include, PageObject::Platforms::SeleniumWebDriver::SelectList
        else
          raise ArgumentError, "expect platform to be :watir_webdriver or :selenium_webdriver"
        end
      end

    end

    ::PageObject::Elements.tag_to_class[:select] = ::PageObject::Elements::SelectList
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page-object-0.7.5.1 lib/page-object/elements/select_list.rb
page-object-0.7.5 lib/page-object/elements/select_list.rb