Sha256: c078630007421f36d84df52d4a846e3773df71ee22fe8044d8b3f42823e63d94

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

module PageObject
  module Elements
    class TextField < Element

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

      protected

      def self.watir_finders
        super + [:tag_name]
      end

      def self.watir_mapping
        super.merge({:css => :tag_name})
      end

      def self.selenium_finders
        super + [:css]
      end

      def self.selenium_mapping
        super.merge({:tag_name => :css})
      end

      def include_platform_for platform
        super
        if platform[:platform] == :watir
          require 'page-object/platforms/watir/text_field'
          self.class.send :include, PageObject::Platforms::Watir::TextField
        elsif platform[:platform] == :selenium
          require 'page-object/platforms/selenium/text_field'
          self.class.send :include, PageObject::Platforms::Selenium::TextField
        else
          raise ArgumentError, "expect platform to be :watir or :selenium"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page-object-0.2.5 lib/page-object/elements/text_field.rb
page-object-0.2.4 lib/page-object/elements/text_field.rb