Class: Webdrivers::Geckodriver

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

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)

35
36
37
# File 'lib/webdrivers/geckodriver.rb', line 35

def base_url
  'https://github.com/mozilla/geckodriver/releases'
end

.current_versionGem::Version

Returns current geckodriver version.

Returns:

  • (Gem::Version)

13
14
15
16
17
18
19
20
21
# File 'lib/webdrivers/geckodriver.rb', line 13

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

  version = binary_version
  return nil if version.nil?

  normalize_version version.match(/geckodriver (\d+\.\d+\.\d+)/)[1]
end

.latest_versionGem::Version

Returns latest available geckodriver version.

Returns:

  • (Gem::Version)

27
28
29
# File 'lib/webdrivers/geckodriver.rb', line 27

def latest_version
  @latest_version ||= with_cache(file_name) { normalize_version(Network.get_url("#{base_url}/latest")[/[^v]*$/]) }
end