class Selenium::WebDriver::Service

def chrome(**opts)

def chrome(**opts)
  Chrome::Service.new(**opts)
end

def driver_path=(path)

def driver_path=(path)
  Platform.assert_executable path if path.is_a?(String)
  @driver_path = path
end

def edge(**opts)

def edge(**opts)
  Edge::Service.new(**opts)
end

def env_path

def env_path
  ENV.fetch(self.class::DRIVER_PATH_ENV_KEY, nil)
end

def find_driver_path

def find_driver_path
  default_options = WebDriver.const_get("#{self.class.name&.split('::')&.[](2)}::Options").new
  DriverFinder.new(default_options, self).driver_path
end

def firefox(**opts)

def firefox(**opts)
  Firefox::Service.new(**opts)
end

def ie(**opts)

def ie(**opts)
  IE::Service.new(**opts)
end

def initialize(path: nil, port: nil, log: nil, args: nil)

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

def launch

def launch
  @executable_path ||= env_path || find_driver_path
  ServiceManager.new(self).tap(&:start)
end

def safari(**opts)

def safari(**opts)
  Safari::Service.new(**opts)
end

def shutdown_supported

def shutdown_supported
  self.class::SHUTDOWN_SUPPORTED
end