class Aranha::Selenium::DriverFactory::Chrome

def build

def build
  ::Selenium::WebDriver.for :chrome, options: chrome_options
end

def chrome_arguments

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

def chrome_options

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