Module: QAT::Web::Browser::Factory
- Includes:
- Logger
- Defined in:
- lib/qat/web/browser/factory.rb
Overview
Module to provide browsers and drivers for web control.
Class Method Summary collapse
-
.for(browser) ⇒ Object
Method to ask for a browser.
Class Method Details
.for(browser) ⇒ Object
Method to ask for a browser. It will be provided if Capybara has a driver with that name
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/qat/web/browser/factory.rb', line 16 def self.for browser browser = browser.to_sym unless .drivers.key? browser log.error { "No driver with name #{browser} available" } log.debug { 'Available drivers are:' } log.debug { .drivers.keys } raise ArgumentError.new "No driver with name #{browser} available" end if .current_driver != browser log.info { "Switching from #{Capybara.current_driver} to #{browser}" } .current_driver = browser .default_driver = browser .javascript_driver = browser end #Force driver start .current_session.driver .current_session end |