Class: Selenium::WebDriver::DriverFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/common/driver_finder.rb

Class Method Summary collapse

Class Method Details

.path(options, klass) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/selenium/webdriver/common/driver_finder.rb', line 23

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)
  rescue StandardError => e
    WebDriver.logger.warn("Unable obtain driver using Selenium Manager\n #{e.message}")
    nil
  end
  msg = "Unable to locate the #{klass::EXECUTABLE} executable; for more information on how to install drivers, " \
        'see https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/'
  raise Error::WebDriverError, msg unless path

  Platform.assert_executable path
  path
end