Sha256: 6e801dc2182fe4b699c985ec6b499b700fa38223f8076eead7668a47bcefa0cf
Contents?: true
Size: 1.04 KB
Versions: 9
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require 'aranha/selenium/driver_factory/base' require 'selenium-webdriver' 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 chrome_arguments.each { |arg| r.add_argument(arg) } r.add_preference(:download, prompt_for_download: false, default_directory: downloads_dir) r end def chrome_arguments r = %w[--disable-popup-blocking --disable-translate --disable-blink-features=AutomationControlled] r << '--ignore-certificate-errors' if accept_insecure_certs? r << '--headless' if headless? r << "--user-agent=#{user_agent}" if user_agent.present? r << "--user-data-dir=#{profile_dir}" if profile_dir.present? r end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems