Sha256: a924a40a603fc46db6e40b443e131a7bbb2e4f54bbc3f46ba198aa97efb67527

Contents?: true

Size: 951 Bytes

Versions: 5

Compression:

Stored size: 951 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

5 entries across 5 versions & 2 rubygems

Version Path
page-object-1.0.3 lib/page-object/loads_platform.rb
meeane-page-object-0.1.11 lib/page-object/loads_platform.rb
page-object-1.0.2 lib/page-object/loads_platform.rb
page-object-1.0.1 lib/page-object/loads_platform.rb
page-object-1.0 lib/page-object/loads_platform.rb