webdriver_manager 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b546e9c975bebe0b2b4c1a9cdc72a1b938423119
4
- data.tar.gz: 1f7925666c255a935d8e74c07ec7cb222393f402
2
+ SHA256:
3
+ metadata.gz: 4db41bdf6056193f150935eae93cdb91d6437f37f0c8de8e75f367b5d326405c
4
+ data.tar.gz: 7b9367d90bcb4ac43ec51c372891d15cc9faecaa121bd9ea8b5910cc870cf73f
5
5
  SHA512:
6
- metadata.gz: 52e5a2af6b99e91832cc31e3b634e2fa48ed195e039c2aae6b494128bc5f0826e031a93272105c446cc68d849b21ce3ac14f77d342a34b27708f531b1650ae1b
7
- data.tar.gz: 1b6a44a7084248257603c7bc1dca83f366d02eaa91877ae2a99a40fbcd15a97a580b90c57f99752eaf01db7428c58910a6f3ac2a5249da13e42a9fe55f8fb66d
6
+ metadata.gz: b19925b90a00db76eda16ce8598868e3c40511ea446a3e3094cc66eb4bfceaa03daac2d7137198da4bf21ad2a333fb983e69830bef1364c0552398f3e9a33ae8
7
+ data.tar.gz: c5e8fc096fbf61603ca22dc9907ca9c00a1576c2cc512f9e0213e8e80dda7dfd190a0bf49ddf9378e79f8977b3d0a07f631bdf48a0d98fb1a0f28d6a95a06506
data/.hound.yml CHANGED
@@ -65,3 +65,23 @@ Metrics/ParameterLists:
65
65
 
66
66
  Metrics/ModuleLength:
67
67
  Max: 135
68
+
69
+ Style/NumericLiterals:
70
+ Enabled: False
71
+
72
+ Metrics/LineLength:
73
+ Max: 90
74
+
75
+ # Currently only for the MSDriver. Will refactor
76
+ # to remove the need for this.
77
+ Metrics/MethodLength:
78
+ Max: 32
79
+
80
+ Metrics/AbcSize:
81
+ Max: 24
82
+
83
+ Metrics/CyclomaticComplexity:
84
+ Max: 8
85
+
86
+ Style/CommandLiteral:
87
+ Enabled: False
data/README.md CHANGED
@@ -44,7 +44,7 @@ All driver binaries are placed in a `.webdrivers` directory within the relevant
44
44
 
45
45
  ### Browser Drivers Supported
46
46
 
47
- Currently WebDriver Manager supports only Chrome (chromedriver) and Firefox (geckodriver). I will be adding support for other browsers, such as Internet Explorer and Microsoft Edge, once I'm certain I have a fully reliable means of getting the drivers.
47
+ Currently WebDriver Manager supports Chrome (chromedriver), Firefox (geckodriver), Internet Explorer (IEDriverServer), and Edge (MicrosoftWebDriver). The support for Internet Explorer and Edge is a bit of a work in progress but, overall, they should work in terms of getting the appropriate driver.
48
48
 
49
49
  ### Logging
50
50
 
@@ -0,0 +1,63 @@
1
+ require "nokogiri"
2
+
3
+ module WebDriverManager
4
+ class IEDriver
5
+ extend Support
6
+
7
+ class << self
8
+ def current_binary
9
+ WebDriverManager.logger.debug("Checking Current Driver Version")
10
+ return nil unless driver_is_downloaded?
11
+ binary_version = `#{driver_binary} --version`
12
+ WebDriverManager.logger.debug(
13
+ "Current version of #{driver_binary} is #{binary_version}"
14
+ )
15
+ normalize(
16
+ binary_version.match(/IEDriverServer.exe (\d\.\d+\.\d*\.\d*)/)[1]
17
+ )
18
+ end
19
+
20
+ def normalize(string)
21
+ string.to_f
22
+ end
23
+
24
+ def driver_name
25
+ "IEDriverServer.exe"
26
+ end
27
+
28
+ def driver_base_url
29
+ "http://selenium-release.storage.googleapis.com"
30
+ end
31
+
32
+ def driver_binary_list
33
+ unless driver_url_is_reachable?
34
+ raise StandardError, "Unable to Access the Driver URL"
35
+ end
36
+
37
+ @binaries ||= begin
38
+ files = process_binary_files
39
+ process_binary_versions(files)
40
+ end
41
+ end
42
+
43
+ def process_binary_files
44
+ resource = Nokogiri::XML.parse(get(driver_base_url))
45
+ files = resource.css("Key").collect(&:text)
46
+ files.select! { |file| file.include?("IEDriverServer_Win32") }
47
+ end
48
+
49
+ def process_binary_versions(files)
50
+ binary_list = files.each_with_object({}) do |file, binary|
51
+ version = normalize(file[%r{^[^\/]+}])
52
+ binary[version] = "#{driver_base_url}/#{file}"
53
+ end
54
+
55
+ WebDriverManager.logger.debug(
56
+ "Versions Located at Driver URL: #{binary_list.keys}"
57
+ )
58
+
59
+ binary_list
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,61 @@
1
+ module WebDriverManager
2
+ class MSDriver
3
+ extend Support
4
+
5
+ class << self
6
+ def current_binary
7
+ WebDriverManager.logger.debug("Checking Current Driver Version")
8
+ windows_version = %x(ver)
9
+ WebDriverManager.logger.debug(
10
+ "Current version of Windows is #{windows_version}"
11
+ )
12
+ windows_version[/\d+\.\d+\.\d+/][/[^\.]\d+$/]
13
+ end
14
+
15
+ def driver_name
16
+ "MicrosoftWebDriver.exe"
17
+ end
18
+
19
+ def driver_base_url
20
+ "https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/#downloads"
21
+ end
22
+
23
+ def driver_binary_list
24
+ unless driver_url_is_reachable?
25
+ raise StandardError, "Unable to Access the Driver URL"
26
+ end
27
+
28
+ url = ""
29
+
30
+ case current_binary.to_i
31
+ when 10240
32
+ WebDriverManager.logger.debug("Downloading 10240 MS WebDriver.")
33
+ build = "8D0D08CF-790D-4586-B726-C6469A9ED49C/MicrosoftWebDriver.msi"
34
+ url = "https://download.microsoft.com/download/8/D/0/#{build}"
35
+ when 10586
36
+ WebDriverManager.logger.debug("Downloading 10586 MS WebDriver.")
37
+ build = "C07EBF21-5305-4EC8-83B1-A6FCC8F93F45/MicrosoftWebDriver.msi"
38
+ url = "https://download.microsoft.com/download/C/0/7/#{build}"
39
+ when 14393
40
+ WebDriverManager.logger.debug("Downloading 14393 MS WebDriver.")
41
+ build = "32D3E464-F2EF-490F-841B-05D53C848D15/MicrosoftWebDriver.exe"
42
+ url = "https://download.microsoft.com/download/3/2/D/#{build}"
43
+ when 15063
44
+ WebDriverManager.logger.debug("Downloading 15063 MS WebDriver.")
45
+ build = "342316D7-EBE0-4F10-ABA2-AE8E0CDF36DD/MicrosoftWebDriver.exe"
46
+ url = "https://download.microsoft.com/download/3/4/2/#{build}"
47
+ when 16299
48
+ WebDriverManager.logger.debug("Downloading 16299 MS WebDriver.")
49
+ build = "D417998A-58EE-4EFE-A7CC-39EF9E020768/MicrosoftWebDriver.exe"
50
+ url = "https://download.microsoft.com/download/D/4/1/#{build}"
51
+ else
52
+ WebDriverManager.logger.debug("Downloading latest Insider driver.")
53
+ build = "14156DA0-D40F-460A-B14D-1B264CA081A5/MicrosoftWebDriver.exe"
54
+ url = "https://download.microsoft.com/download/1/4/1/#{build}"
55
+ end
56
+
57
+ @binaries = { current_binary.to_i => url }
58
+ end
59
+ end
60
+ end
61
+ end
@@ -3,6 +3,8 @@ require "selenium-webdriver"
3
3
  require "webdriver_manager/support"
4
4
  require "webdriver_manager/drivers/driver_chrome"
5
5
  require "webdriver_manager/drivers/driver_gecko"
6
+ require "webdriver_manager/drivers/driver_ie"
7
+ require "webdriver_manager/drivers/driver_ms"
6
8
 
7
9
  module Selenium
8
10
  module WebDriver
@@ -17,5 +19,17 @@ module Selenium
17
19
  @driver_path ||= WebDriverManager::GeckoDriver.provision
18
20
  end
19
21
  end
22
+
23
+ module IE
24
+ def self.driver_path
25
+ @driver_path ||= WebDriverManager::IEDriver.provision
26
+ end
27
+ end
28
+
29
+ module Edge
30
+ def self.driver_path
31
+ @driver_path ||= WebDriverManager::MSDriver.provision
32
+ end
33
+ end
20
34
  end
21
35
  end
@@ -1,3 +1,3 @@
1
1
  module WebDriverManager
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.5.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdriver_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Nyman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -144,6 +144,8 @@ files:
144
144
  - lib/webdriver_manager.rb
145
145
  - lib/webdriver_manager/drivers/driver_chrome.rb
146
146
  - lib/webdriver_manager/drivers/driver_gecko.rb
147
+ - lib/webdriver_manager/drivers/driver_ie.rb
148
+ - lib/webdriver_manager/drivers/driver_ms.rb
147
149
  - lib/webdriver_manager/logger.rb
148
150
  - lib/webdriver_manager/selenium.rb
149
151
  - lib/webdriver_manager/support.rb
@@ -154,7 +156,7 @@ licenses:
154
156
  - MIT
155
157
  metadata: {}
156
158
  post_install_message: "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n
157
- \ WebDriver Manager 0.4.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::)
159
+ \ WebDriver Manager 0.5.0 has been installed.\n(::) (::) (::) (::) (::) (::) (::)
158
160
  (::) (::) (::) (::) (::)\n "
159
161
  rdoc_options: []
160
162
  require_paths:
@@ -171,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
173
  version: '0'
172
174
  requirements: []
173
175
  rubyforge_project:
174
- rubygems_version: 2.6.13
176
+ rubygems_version: 2.7.3
175
177
  signing_key:
176
178
  specification_version: 4
177
179
  summary: Provides a method of automatically downloading WebDriver binaries.