Module: Rakuten::Travel::Crawler

Defined in:
lib/rakuten/travel/crawler.rb,
lib/rakuten/travel/crawler/api.rb,
lib/rakuten/travel/crawler/web.rb,
lib/rakuten/travel/crawler/console.rb,
lib/rakuten/travel/crawler/version.rb

Defined Under Namespace

Classes: Api, Console, Error, Web

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.get_selenium_driver(mode: :chrome) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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