Class: Selenium::WebDriver::SeleniumManager Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wrapper for getting information from the Selenium Manager binaries. This implementation is still in beta, and may change.

Constant Summary collapse

BIN_PATH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'../../../../../bin'

Class Method Summary collapse

Class Method Details

.driver_path(options) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the path to the correct driver.

Parameters:

  • options (Options)

    browser options.

Returns:

  • (String)

    the path to the correct driver.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/selenium/webdriver/common/selenium_manager.rb', line 35

def driver_path(options)
  message = 'applicable driver not found; attempting to install with Selenium Manager'
  WebDriver.logger.warn(message)

  unless options.is_a?(Options)
    raise ArgumentError, "SeleniumManager requires a WebDriver::Options instance, not #{options.inspect}"
  end

  command = [binary, '--browser', "'#{options.browser_name}'", '--output', 'json']
  if options.browser_version
    command << '--browser-version'
    command << options.browser_version
  end
  if options.respond_to?(:binary) && !options.binary.nil?
    command << '--browser-path'
    command << "\"#{options.binary.gsub('\ ', ' ').gsub(' ', '\ ')}\""
  end
  command << '--debug' if WebDriver.logger.debug?

  location = run(command.join(' '))
  WebDriver.logger.debug("Driver found at #{location}")
  Platform.assert_executable location

  location
end