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 35 def driver_path(driver_name) unless %w[chromedriver geckodriver msedgedriver IEDriverServer].include?(driver_name) msg = "Unable to locate driver with name: #{driver_name}" raise Error::WebDriverError, msg end location = run("#{binary} --driver #{driver_name}") WebDriver.logger.debug("Driver found at #{location}") Platform.assert_executable location location 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 stdout, stderr, status = Open3.capture3(command) rescue StandardError => e raise Error::WebDriverError, "Unsuccessful command executed: #{command}", e.message end if status.exitstatus.positive? raise Error::WebDriverError, "Unsuccessful command executed: #{command}\n#{stdout}#{stderr}" end stdout.gsub("INFO\t", '').strip end