Method: Selenium::WebDriver::Remote::Driver#initialize

Defined in:
lib/selenium/webdriver/remote/driver.rb

#initialize(bridge: nil, listener: nil, **opts) ⇒ Driver

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Driver.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/selenium/webdriver/remote/driver.rb', line 33

def initialize(bridge: nil, listener: nil, **opts)
  desired_capabilities = opts[:desired_capabilities]
  if desired_capabilities.is_a?(Symbol)
    unless Remote::Capabilities.respond_to?(desired_capabilities)
      raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
    end

    opts[:desired_capabilities] = Remote::Capabilities.__send__(desired_capabilities)
  end
  opts[:url] ||= "http://#{Platform.localhost}:4444/wd/hub"
  super
  @bridge.file_detector = ->((filename, *)) { File.exist?(filename) && filename.to_s }
end