Class: EdgedriverDownloader

Inherits:
DriverDownloader show all
Defined in:
lib/chauffeur/downloaders/edgedriver_downloader.rb

Overview

FireFoxDriver specific functions for driver downloading.

Constant Summary collapse

EDGEDRIVER_URL =
'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/'.freeze

Instance Method Summary collapse

Methods inherited from DriverDownloader

#download_and_unzip, #install_driver, #install_driver_all_platforms, #path_for, #upgrade_driver, #upgrade_driver_all_platforms

Constructor Details

#initialize(verbose = true) ⇒ EdgedriverDownloader

Returns a new instance of EdgedriverDownloader.



5
6
7
8
# File 'lib/chauffeur/downloaders/edgedriver_downloader.rb', line 5

def initialize(verbose = true)
  @all_driver_versions = all_driver_versions
  super(verbose)
end

Instance Method Details

#all_driver_versionsObject

Returns all available versions of microsoft webdriver



31
32
33
34
35
36
37
38
39
# File 'lib/chauffeur/downloaders/edgedriver_downloader.rb', line 31

def all_driver_versions
  resp = HTTParty.get(driver_url, verify: false).parsed_response
  doc = Nokogiri::XML.parse(resp)
  output = {}
  doc.css('li.driver-download a.subtitle').each do |a|
    output[a.text.gsub('Release ', '')] = a[:href]
  end
  output
end

#all_platformsObject



18
19
20
# File 'lib/chauffeur/downloaders/edgedriver_downloader.rb', line 18

def all_platforms
  %w[win]
end

#browser_nameObject



10
11
12
# File 'lib/chauffeur/downloaders/edgedriver_downloader.rb', line 10

def browser_name
  'microsoft_webdriver'
end

#driver_download_url(version, platform) ⇒ Object

Returns the url for the desired version of microsoft webdriver version: string - must match exactly the version in the download URL platform: string - must be win



44
45
46
47
# File 'lib/chauffeur/downloaders/edgedriver_downloader.rb', line 44

def driver_download_url(version, platform)
  raise unknown_platform_error(platform) unless valid_platform?(platform)
  @all_driver_versions[version] || raise(unknown_version_error(version))
end

#driver_urlObject



14
15
16
# File 'lib/chauffeur/downloaders/edgedriver_downloader.rb', line 14

def driver_url
  EDGEDRIVER_URL
end

#latest_driver_version(platform) ⇒ Object

Returns the most recent version of edgedriver for the desired platform. platform must be one of: win



25
26
27
28
# File 'lib/chauffeur/downloaders/edgedriver_downloader.rb', line 25

def latest_driver_version(platform)
  raise unknown_platform_error(platform) unless valid_platform?(platform)
  @all_driver_versions.keys.sort.reverse.find { |k| k =~ /^\d+$/ }
end