Sha256: f6f1e58dc139451800e3921419fd7cf86edefc63ae106db6c323ee8c5e4a68f9
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
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_browser, PageObject.Adapters.list).send(:new, watir_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) adapter_for(browser,adapters).create_page_object(browser) end def browser_for root,adapters adapter_for(root,adapters).browser_for(root) end def adapter_for element_or_browser, adapters adapter = adapters.values.find { |adapter| adapter.is_for?(element_or_browser) } unless adapter message = "Unable to pick a platform for the provided browser or element: #{element_or_browser.inspect}." message += "\nnil was passed to the PageObject constructor instead of a valid browser or element object." if element_or_browser.nil? raise message end adapter end def root_element_for root, adapters adapter_for(root,adapters).root_element_for(root) end def browser_root_for browser, adapters adapter_for(browser,adapters).browser_root_for(browser) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
page-object-2.1.1 | lib/page-object/loads_platform.rb |
page-object-2.1 | lib/page-object/loads_platform.rb |
page-object-2.0.0 | lib/page-object/loads_platform.rb |