Sha256: 86ac7483eacfa7237ddab1e6563ffe809928bf27cf56b956c2f9c1a703459807

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

module PageObject
  module Elements
    class Form < Element
      def initialize(element, platform)
        @element = element
        include_platform_for platform
      end

      protected

      def self.watir_finders
        super + [:action]
      end

      def self.selenium_finders
        super + [:action]
      end

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

    ::PageObject::Elements.tag_to_class[:form] = ::PageObject::Elements::Form
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
page-object-lds-0.0.14 lib/page-object/elements/form.rb
page-object-lds-0.0.13 lib/page-object/elements/form.rb
page-object-lds-0.0.12 lib/page-object/elements/form.rb
page-object-lds-0.0.11 lib/page-object/elements/form.rb
page-object-lds-0.0.1 lib/page-object/elements/form.rb