module Munchsrb::Gather

Munchsrb::Gather

Constants

DEFAULT_MAX_WAIT_TIME

Attributes

driver[R]

Public Class Methods

init() click to toggle source
# File lib/munchsrb/gather/config.rb, line 10
def init
  Capybara.register_driver :chrome do |app|
    prepare(app)
  end

  Capybara.configure do |config|
    config.run_server = false
    config.default_driver = :chrome
    config.javascript_driver = :chrome
    config.default_max_wait_time = DEFAULT_MAX_WAIT_TIME
  end
end

Private Class Methods

arguments() click to toggle source
# File lib/munchsrb/gather/config.rb, line 42
def arguments
  [
    '--no-sandbox',
    '--verbose',
    '--window-size=1280,800',
    '--disable-save-password-bubble',
    '--lang=ja',
    '--disable-gpu',
    'incognito',
    '--headless'
  ]
end
options() click to toggle source
# File lib/munchsrb/gather/config.rb, line 33
def options
  {
    chrome_options: {
      args: arguments,
      prefs: preferences
    }
  }
end
preferences() click to toggle source
# File lib/munchsrb/gather/config.rb, line 55
def preferences
  { credentials_enable_service: false, password_manager_enabled: false }
end
prepare(app) click to toggle source
# File lib/munchsrb/gather/config.rb, line 25
def prepare(app)
  @driver = Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(options)
  )
end