Class: Webdrivers::MSWebdriver

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

Class Method Summary collapse

Methods inherited from Common

latest, remove, update

Class Method Details

.currentObject



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

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

.download(version = current) ⇒ Object

Webdriver binaries for Microsoft Edge are not backwards compatible. For this reason, instead of downloading the latest binary we download the correct one for the currently installed browser version.



25
26
27
# File 'lib/webdrivers/mswebdriver.rb', line 25

def download(version = current)
  super
end