Sha256: d16200eee5f48489b9d3d56cd01e3ede3352429722e3f065e48d1655108404a2

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require 'aranha/selenium/defaults'
require 'eac_ruby_utils/core_ext'

module Aranha
  module Selenium
    class DriverFactory
      class Base
        common_constructor :options do
          self.options = options.with_indifferent_access.freeze
        end

        def build
          raise 'Must be overrided'
        end

        def downloads_dir
          option_value(:downloads_dir)
        end

        def accept_insecure_certs?
          option_value(:accept_insecure_certs)
        end

        def headless?
          option_value(:headless)
        end

        def profile_dir
          options[:profile_dir].to_s
        end

        def profile_name
          options[:profile_name]
        end

        def user_agent
          option_value(:user_agent)
        end

        private

        def option_value(key)
          if options.key?(key)
            options.fetch(key)
          else
            ::Aranha::Selenium::Defaults.instance.send(key)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aranha-selenium-0.6.1 lib/aranha/selenium/driver_factory/base.rb
aranha-selenium-0.6.0 lib/aranha/selenium/driver_factory/base.rb