Class: Selenium::WebDriver::DriverFinder

Inherits:
Object
  • Object
show all
Defined in:
rb/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
41
42
# File 'rb/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 ||= 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_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