Class: Webdrivers::MSWebdriver

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

Class Method Summary collapse

Methods inherited from Common

download, latest, remove, update

Class Method Details

.currentObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/webdrivers/mswebdriver.rb', line 5

def current
  Webdrivers.logger.debug "Checking current version"

  # current() from other webdrivers returns the version from the webdriver EXE.
  # Unfortunately, MicrosoftWebDriver.exe does not have an option to get the version.
  # To work around it we query the currently installed version of Microsoft Edge instead
  # and compare it to the list of available downloads.
  version = `powershell (Get-AppxPackage -Name Microsoft.MicrosoftEdge).Version`
  raise "Failed to check Microsoft Edge version." if version.empty? # Package name changed?
  Webdrivers.logger.debug "Current version of Microsoft Edge is #{version.chomp!}"

  build = version.split('.')[1] # "41.16299.248.0" => "16299"
  Webdrivers.logger.debug "Expecting MicrosoftWebDriver.exe version #{build}"
  build.to_i
end