Method: Selenium::WebDriver::Service#initialize

Defined in:
lib/selenium/webdriver/common/service.rb

#initialize(path: nil, port: nil, log: nil, args: nil) ⇒ Service

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.

End users should use a class method for the desired driver, rather than using this directly.


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/selenium/webdriver/common/service.rb', line 69

def initialize(path: nil, port: nil, log: nil, args: nil)
  port ||= self.class::DEFAULT_PORT
  args ||= []
  path ||= env_path

  @executable_path = path
  @host = Platform.localhost
  @port = Integer(port)
  @log = case log
         when :stdout
           $stdout
         when :stderr
           $stderr
         else
           log
         end
  @args = args

  raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
end