class Browserly::Driver

Attributes

chrome_args[R]
driver[R]

Public Class Methods

new(remote, chrome_args) click to toggle source
# File lib/browserly/driver.rb, line 5
def initialize(remote, chrome_args)
  @remote = remote
  @chrome_args = chrome_args

  return remote_driver if remote
  local_driver
end

Private Instance Methods

local_driver() click to toggle source
# File lib/browserly/driver.rb, line 15
def local_driver
  @driver = Selenium::WebDriver.for :chrome, options: options
end
options() click to toggle source
# File lib/browserly/driver.rb, line 29
def options
  { args: chrome_args }
end
remote_driver() click to toggle source
# File lib/browserly/driver.rb, line 19
def remote_driver
  raise ConfigurationError, :remote_driver_url unless Browserly.configuration.remote_driver_url

  caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => options)

  @driver = Selenium::WebDriver.for :remote,
                          url: Browserly.configuration.remote_driver_url,
                          desired_capabilities: caps
end