Sha256: fbf26c1477d87d5b02673cc7aa9815e28bb1a708e86d898a0608ca8e221d927d

Contents?: true

Size: 812 Bytes

Versions: 4

Compression:

Stored size: 812 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_preference(:download, prompt_for_download: false, default_directory: downloads_dir)
          r
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aranha-0.10.1 lib/aranha/selenium/driver_factory/chrome.rb
aranha-0.10.0 lib/aranha/selenium/driver_factory/chrome.rb
aranha-0.9.1 lib/aranha/selenium/driver_factory/chrome.rb
aranha-0.9.0 lib/aranha/selenium/driver_factory/chrome.rb