Class: Chromedriver::Binary::Finder

Inherits:
Object
  • Object
show all
Includes:
Platform, SystemHelper
Defined in:
lib/chromedriver/binary/finder.rb

Instance Method Summary collapse

Methods included from SystemHelper

#call, #exists?

Methods included from Platform

#driver_filename, #file_name, #linux_arm64?, #platform, #platform_id

Instance Method Details

#locationObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/chromedriver/binary/finder.rb', line 20

def location
  if chrome_bin_from_env
    Chromedriver::Binary.logger.debug "CHROMEDRIVER_CHROME_PATH: #{chrome_bin_from_env}"

    return chrome_bin_from_env
  end

  send("#{platform}_location").tap do |chrome_bin|
    raise Chromedriver::Binary::BrowserNotFound, "Failed to determine Chrome binary location." unless chrome_bin
  end
end

#versionObject

Raises:



12
13
14
15
16
17
18
# File 'lib/chromedriver/binary/finder.rb', line 12

def version
  version = send("#{platform}_version", location)
  raise VersionError, "Failed to determine Chrome version." if version.nil? || version.empty?

  Chromedriver::Binary.logger.debug "Browser version: #{version}"
  version[/\d+\.\d+\.\d+\.\d+/]
end