class Selenium::WebDriver::SeleniumManager
Wrapper for getting information from the Selenium
Manager
binaries. This implementation is still in beta, and may change. @api private
Constants
- BIN_PATH
Public Class Methods
driver_path(driver_name)
click to toggle source
@param [String] driver_name which driver to use. @return [String] the path to the correct driver.
# File lib/selenium/webdriver/common/selenium_manager.rb, line 33 def driver_path(driver_name) @driver_path ||= begin unless %w[chromedriver geckodriver msedgedriver].include?(driver_name) msg = "Unable to locate driver with name: #{driver_name}" raise Error::WebDriverError, msg end location = run("#{binary} --driver #{driver_name}").split("\t").last.strip WebDriver.logger.debug("Driver found at #{location}") Platform.assert_executable location location end end
Private Class Methods
binary()
click to toggle source
@return [String] the path to the correct selenium manager
# File lib/selenium/webdriver/common/selenium_manager.rb, line 51 def binary @binary ||= begin path = File.expand_path(BIN_PATH, __FILE__) path << if Platform.windows? '/windows/selenium-manager.exe' elsif Platform.mac? '/macos/selenium-manager' elsif Platform.linux? '/linux/selenium-manager' end location = File.expand_path(path, __FILE__) unless location.is_a?(String) && File.exist?(location) && File.executable?(location) raise Error::WebDriverError, "Unable to obtain Selenium Manager" end WebDriver.logger.debug("Selenium Manager found at #{location}") location end end
run(command)
click to toggle source
# File lib/selenium/webdriver/common/selenium_manager.rb, line 71 def run(command) WebDriver.logger.debug("Executing Process #{command}") begin result = `#{command}` return result if result.match?(/^INFO\t/) rescue StandardError => e raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}" end raise Error::WebDriverError, "Unsuccessful command executed: #{command}" end