Class: Webdrivers::Chromedriver

Inherits:
Common
  • Object
show all
Defined in:
lib/webdrivers/chromedriver.rb

Direct Known Subclasses

Edgedriver

Class Method Summary collapse

Methods inherited from Common

driver_path, remove, update

Class Method Details

.base_urlString

Returns url with domain for calls to get this driver.

Returns:

  • (String)

59
60
61
# File 'lib/webdrivers/chromedriver.rb', line 59

def base_url
  'https://chromedriver.storage.googleapis.com'
end

.browser_versionGem::Version Also known as: chrome_version

Returns currently installed Chrome/Chromium version.

Returns:

  • (Gem::Version)

50
51
52
# File 'lib/webdrivers/chromedriver.rb', line 50

def browser_version
  normalize_version ChromeFinder.version
end

.current_versionGem::Version

Returns current chromedriver version.

Returns:

  • (Gem::Version)

14
15
16
17
18
19
20
21
22
23
# File 'lib/webdrivers/chromedriver.rb', line 14

def current_version
  Webdrivers.logger.debug 'Checking current version'
  return nil unless exists?

  version = binary_version
  return nil if version.nil?

  # Matches 2.46, 2.46.628411 and 73.0.3683.75
  normalize_version version[/\d+\.\d+(\.\d+)?(\.\d+)?/]
end

.latest_versionGem::Version

Returns latest available chromedriver version.

Returns:

  • (Gem::Version)

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/webdrivers/chromedriver.rb', line 29

def latest_version
  @latest_version ||= begin
    # Versions before 70 do not have a LATEST_RELEASE file
    return normalize_version('2.41') if browser_build_version < normalize_version('70')

    # Cache check
    # Cached version should exist and be compatible with the current browser version.
    # Otherwise, fetch the latest compatible driver.
    latest_applicable = with_cache(file_name,
                                   current_build_version,
                                   browser_build_version) { latest_point_release(browser_build_version) }

    Webdrivers.logger.debug "Latest version available: #{latest_applicable}"
    normalize_version(latest_applicable)
  end
end