Sha256: b717ebaf9d588e26342b9f8e8719fbafd1867ce0cbecc97243f070dfcfdac2f8

Contents?: true

Size: 977 Bytes

Versions: 7

Compression:

Stored size: 977 Bytes

Contents

module PageObject
  #
  # module which provides a function for determining
  # which platform to provide to the page object
  # 
  module LoadsPlatform
    #
    # Determines which platform the Page Object should use based upon browser
    #
    # @example
    #  platform =  load_platform(watir_webdriver_browser, PageObject.Adapters.list).send(:new, watir_webdriver_browser)
    # 
    # @param [Object] A browser driver that has a supported adapter
    # @param [adapters] a list of adapters that are currently supported
    # @returns [PageObject] 
    #
    def load_platform(browser, adapters)
      adapters.each_value { |adapter|
        return adapter.create_page_object(browser) if adapter.is_for?(browser)
      }
      message = 'Unable to pick a platform for the provided browser.'
      message += "\nnil was passed to the PageObject constructor instead of a valid browser object." if browser.nil?
      raise message 
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

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