Sha256: a1064e021bc45cb8818ba337fd7f029521dc76c346a4379e1387b928fbb4703c
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 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.assert(options.except(:driver)) end require_sub __FILE__ end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aranha-selenium-0.7.1 | lib/aranha/selenium/driver_factory.rb |