Sha256: 81aae9878952e2abfc7b8b689227ae049e0579530e22b21a7889811d9bc7d007

Contents?: true

Size: 888 Bytes

Versions: 4

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

require 'selenium-webdriver'
require 'aranha/selenium/driver_factory/base'

module Aranha
  module Selenium
    class DriverFactory
      class Chrome < ::Aranha::Selenium::DriverFactory::Base
        def build
          ::Selenium::WebDriver.for :chrome, options: chrome_options
        end

        private

        def chrome_options
          r = ::Selenium::WebDriver::Chrome::Options.new
          r.add_argument('--ignore-certificate-errors') if accept_insecure_certs?
          r.add_argument('--headless') if headless?
          r.add_argument('--disable-popup-blocking')
          r.add_argument('--disable-translate')
          r.add_argument("user-agent=#{user_agent}") if user_agent.present?
          r.add_preference(:download, prompt_for_download: false, default_directory: downloads_dir)
          r
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
aranha-selenium-0.1.2 lib/aranha/selenium/driver_factory/chrome.rb
aranha-selenium-0.1.1 lib/aranha/selenium/driver_factory/chrome.rb
aranha-selenium-0.1.0 lib/aranha/selenium/driver_factory/chrome.rb
aranha-0.11.0 lib/aranha/selenium/driver_factory/chrome.rb