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 Capybara.drivers.key? browser log.error { "No driver with name #{browser} available" } log.debug { 'Available drivers are:' } log.debug { Capybara.drivers.keys } raise ArgumentError.new "No driver with name #{browser} available" end if Capybara.current_driver != browser log.info { "Switching from #{Capybara.current_driver} to #{browser}" } Capybara.current_driver = browser Capybara.default_driver = browser Capybara.javascript_driver = browser end #Force driver start Capybara.current_session.driver Capybara.current_session end |