Sha256: 5aefb41182bfd4c2343dd94e2457bb56e9260ef5e54bf6e64cf72d577a388bf8
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true require 'aranha/selenium/driver_options' require 'eac_ruby_utils/core_ext' module Aranha module Selenium class DriverFactory class << self def create_driver(options = {}) new(options).create_driver end end # @!attribute [r] options # @return [ActiveSupport::HashWithIndifferentAccess] # @!method initialize(options) # @param options [ActiveSupport::HashWithIndifferentAccess] common_constructor :options do self.options = options.with_indifferent_access.freeze end def create_driver driver_class.new(driver_options).build end def driver_name (options[:driver] || default_driver_name).to_s end def driver_class Aranha::Selenium::DriverFactory.const_get(driver_name.classify) rescue NameError raise "Unknown Aranha Selenium driver: \"#{driver_name}\" " \ "(Class \"Aranha::Selenium::DriverFactory::#{driver_name.classify}\" not found)" end def default_driver_name :firefox end # @return [Aranha::Selenium::DriverOptions] def driver_options ::Aranha::Selenium::DriverOptions.default.merge( ::Aranha::Selenium::DriverOptions.assert(options.except(:driver)) ) end require_sub __FILE__ end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aranha-selenium-0.9.0 | lib/aranha/selenium/driver_factory.rb |
aranha-selenium-0.8.0 | lib/aranha/selenium/driver_factory.rb |