class Selenium::WebDriver::DriverFinder

def self.path(options, klass)

def self.path(options, klass)
  path = klass.driver_path
  path = path.call if path.is_a?(Proc)
  path ||= Platform.find_binary(klass::EXECUTABLE)
  path ||= begin
    SeleniumManager.driver_path(options) unless options.is_a?(Remote::Capabilities)
  rescue StandardError => e
    raise Error::NoSuchDriverError, "Unable to obtain #{klass::EXECUTABLE} using Selenium Manager; #{e.message}"
  end
  begin
    Platform.assert_file(path)
    Platform.assert_executable(path)
  rescue TypeError
    raise Error::NoSuchDriverError, "Unable to locate or obtain #{klass::EXECUTABLE}"
  rescue Error::WebDriverError => e
    raise Error::NoSuchDriverError, "#{klass::EXECUTABLE} located, but: #{e.message}"
  end
  path
end