module Rakuten::Travel::Crawler

Constants

VERSION

Public Class Methods

get_selenium_driver(mode: :chrome) click to toggle source
# File lib/rakuten/travel/crawler.rb, line 13
def self.get_selenium_driver mode: :chrome
  case mode
  when :firefox_remote_capabilities
    firefox_capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
    Selenium::WebDriver.for(:remote, url: "http://hub:4444/wd/hub", desired_capabilities: firefox_capabilities)
  when :firefox
    Selenium::WebDriver.for :firefox
  else
    options = Selenium::WebDriver::Chrome::Options.new
    options.add_argument("--ignore-certificate-errors")
    options.add_argument("--disable-popup-blocking")
    options.add_argument("--disable-translate")
    options.add_argument("-headless")
    Selenium::WebDriver.for :chrome, options: options
  end
end