Class: Selenium::WebDriver::SeleniumManager Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rb/lib/selenium/webdriver/common/selenium_manager.rb |
Overview
Wrapper for getting information from the ::Selenium
Manager binaries. This implementation is still in beta, and may change.
Class Attribute Summary
- .bin_path rw Internal use only
- .bin_path=(value) rw Internal use only
Class Method Summary
- .binary_paths(*arguments) ⇒ Hash Internal use only
- .binary ⇒ String private Internal use only
- .platform_location private Internal use only
- .run(*command) private Internal use only
Class Attribute Details
.bin_path (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/selenium_manager.rb', line 33
def bin_path @bin_path ||= '../../../../../bin' end
.bin_path=(value) (rw)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/selenium_manager.rb', line 31
attr_writer :bin_path
Class Method Details
.binary ⇒ String
(private)
# File 'rb/lib/selenium/webdriver/common/selenium_manager.rb', line 50
def binary @binary ||= begin if (location = ENV.fetch('SE_MANAGER_PATH', nil)) WebDriver.logger.debug("Selenium Manager set by ENV['SE_MANAGER_PATH']: #{location}") end location ||= platform_location Platform.assert_executable(location) WebDriver.logger.debug("Selenium Manager binary found at #{location}", id: :selenium_manager) location end end
.binary_paths(*arguments) ⇒ Hash
.platform_location (private)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/selenium_manager.rb', line 85
def platform_location directory = File. (bin_path, __FILE__) if Platform.windows? "#{directory}/windows/selenium-manager.exe" elsif Platform.mac? "#{directory}/macos/selenium-manager" elsif Platform.linux? "#{directory}/linux/selenium-manager" elsif Platform.unix? WebDriver.logger.warn('Selenium Manager binary may not be compatible with Unix', id: %i[selenium_manager unix_binary]) "#{directory}/linux/selenium-manager" else raise Error::WebDriverError, "unsupported platform: #{Platform.os}" end end
.run(*command) (private)
# File 'rb/lib/selenium/webdriver/common/selenium_manager.rb', line 63
def run(*command) WebDriver.logger.debug("Executing Process #{command}", id: :selenium_manager) begin stdout, stderr, status = Open3.capture3(*command) rescue StandardError => e raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.}" end json_output = stdout.empty? ? {'logs' => [], 'result' => {}} : JSON.parse(stdout) json_output['logs'].each do |log| level = log['level'].casecmp('info').zero? ? 'debug' : log['level'].downcase WebDriver.logger.send(level, log['message'], id: :selenium_manager) end result = json_output['result'] return result unless status.exitstatus.positive? || result.nil? raise Error::WebDriverError, "Unsuccessful command executed: #{command} - Code #{status.exitstatus}\n#{result}\n#{stderr}" end