webdrivers 3.2.4 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/webdrivers/common.rb +16 -10
- data/lib/webdrivers/mswebdriver.rb +18 -27
- data/spec/geckodriver_spec.rb +1 -1
- data/spec/mswebdriver_spec.rb +1 -1
- data/webdrivers.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38a8045b1c217acbc4ef3163a4c5cf9c7b49f39d
|
4
|
+
data.tar.gz: c37958c1c522eaa4678052ffa59699287f182cce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f393257af259775e469647eb1d6bd3bc2afd869ffc7fbf03a9bf00188d6be30157cf214610f0398c0451f06ef99b1d3d9ff0abbe5769c1595373308e097cacf
|
7
|
+
data.tar.gz: 30e8898a5314378a9df00b15100bdb5c63e914b991d683b42fccc3422ddd351ebcf4c0f67b181df010418333ca7dfcd3c35a49045f069337dce7e02a9a768977
|
data/CHANGELOG.md
CHANGED
data/lib/webdrivers/common.rb
CHANGED
@@ -9,18 +9,24 @@ module Webdrivers
|
|
9
9
|
unless site_available?
|
10
10
|
return current.nil? ? nil : binary
|
11
11
|
end
|
12
|
-
released
|
13
|
-
location
|
12
|
+
released = latest()
|
13
|
+
location = binary()
|
14
|
+
binary_exists = File.exists?(location)
|
14
15
|
|
15
|
-
return location if released.nil? &&
|
16
|
+
return location if released.nil? && binary_exists
|
16
17
|
|
17
18
|
if released.nil?
|
18
19
|
msg = "Unable to find the latest version of #{file_name}; try downloading manually from #{base_url} and place in #{install_dir}"
|
19
20
|
raise StandardError, msg
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
if current == released && binary_exists # Already have latest/matching one
|
24
|
+
Webdrivers.logger.debug "Expected webdriver version found"
|
25
|
+
return location
|
26
|
+
end
|
27
|
+
|
28
|
+
remove if binary_exists # Remove outdated exe
|
29
|
+
download
|
24
30
|
end
|
25
31
|
|
26
32
|
def latest
|
@@ -33,7 +39,7 @@ module Webdrivers
|
|
33
39
|
end
|
34
40
|
|
35
41
|
def download(version = nil)
|
36
|
-
url
|
42
|
+
url = download_url(version)
|
37
43
|
filename = File.basename url
|
38
44
|
|
39
45
|
Dir.mkdir(install_dir) unless File.exists?(install_dir)
|
@@ -83,7 +89,7 @@ module Webdrivers
|
|
83
89
|
def http
|
84
90
|
if using_proxy
|
85
91
|
return Net::HTTP.Proxy(Webdrivers.proxy_addr, Webdrivers.proxy_port,
|
86
|
-
|
92
|
+
Webdrivers.proxy_user, Webdrivers.proxy_pass)
|
87
93
|
end
|
88
94
|
return Net::HTTP
|
89
95
|
end
|
@@ -151,7 +157,7 @@ module Webdrivers
|
|
151
157
|
tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(filename))
|
152
158
|
|
153
159
|
File.open(file_name, "w+b") do |ucf|
|
154
|
-
tar_extract.each {|entry| ucf << entry.read}
|
160
|
+
tar_extract.each { |entry| ucf << entry.read }
|
155
161
|
File.basename ucf
|
156
162
|
end
|
157
163
|
end
|
@@ -160,7 +166,7 @@ module Webdrivers
|
|
160
166
|
Zip::File.open("#{Dir.pwd}/#{filename}") do |zip_file|
|
161
167
|
zip_file.each do |f|
|
162
168
|
@top_path ||= f.name
|
163
|
-
f_path
|
169
|
+
f_path = File.join(Dir.pwd, f.name)
|
164
170
|
FileUtils.rm_rf(f_path) if File.exist?(f_path)
|
165
171
|
FileUtils.mkdir_p(File.dirname(f_path)) unless File.exist?(File.dirname(f_path))
|
166
172
|
zip_file.extract(f, f_path)
|
@@ -170,7 +176,7 @@ module Webdrivers
|
|
170
176
|
end
|
171
177
|
|
172
178
|
def install_dir
|
173
|
-
File.expand_path(File.join(ENV['HOME'], ".webdrivers")).tap {|dir| FileUtils.mkdir_p dir}
|
179
|
+
File.expand_path(File.join(ENV['HOME'], ".webdrivers")).tap { |dir| FileUtils.mkdir_p dir }
|
174
180
|
end
|
175
181
|
end
|
176
182
|
end
|
@@ -4,51 +4,42 @@ module Webdrivers
|
|
4
4
|
|
5
5
|
def current
|
6
6
|
Webdrivers.logger.debug "Checking current version"
|
7
|
-
version = %x(ver)
|
8
|
-
Webdrivers.logger.debug "Current version of Windows Build is #{version}"
|
9
|
-
version[/\d+\.\d+\.\d+/][/[^\.]\d+$/]
|
10
|
-
end
|
11
7
|
|
12
|
-
|
13
|
-
#
|
8
|
+
# current() from other webdrivers returns the version from the webdriver EXE.
|
9
|
+
# Unfortunately, MicrosoftWebDriver.exe does not have an option to get the version.
|
10
|
+
# To work around it we query the currently installed version of Microsoft Edge instead
|
11
|
+
# and compare it to the list of available downloads.
|
12
|
+
version = `powershell (Get-AppxPackage -Name Microsoft.MicrosoftEdge).Version`
|
13
|
+
raise "Failed to check Microsoft Edge version." if version.empty? # Package name changed?
|
14
|
+
Webdrivers.logger.debug "Current version of Microsoft Edge is #{version.chomp!}"
|
15
|
+
|
16
|
+
build = version.split('.')[1] # "41.16299.248.0" => "16299"
|
17
|
+
Webdrivers.logger.debug "Expecting MicrosoftWebDriver.exe version #{build}"
|
18
|
+
build.to_i
|
14
19
|
end
|
15
20
|
|
16
21
|
private
|
17
22
|
|
18
23
|
def normalize(string)
|
19
|
-
string.match(/(\d+)\.(\d+\.\d+)/).to_a.map {|v| v.tr('.', '')}[1
|
24
|
+
string.match(/(\d+)\.(\d+\.\d+)/).to_a.map { |v| v.tr('.', '') }[1 .. -1].join('.').to_f
|
20
25
|
end
|
21
26
|
|
22
27
|
def file_name
|
23
28
|
"MicrosoftWebDriver.exe"
|
24
29
|
end
|
25
30
|
|
26
|
-
def
|
31
|
+
def downloads
|
27
32
|
raise StandardError, "Can not reach site" unless site_available?
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"https://download.microsoft.com/download/8/D/0/8D0D08CF-790D-4586-B726-C6469A9ED49C/MicrosoftWebDriver.msi"
|
33
|
-
when 10586
|
34
|
-
Webdrivers.logger.debug "Attempting to Download Build for 10586"
|
35
|
-
"https://download.microsoft.com/download/C/0/7/C07EBF21-5305-4EC8-83B1-A6FCC8F93F45/MicrosoftWebDriver.msi"
|
36
|
-
when 14393
|
37
|
-
Webdrivers.logger.debug "Attempting to Download Build for 14393"
|
38
|
-
"https://download.microsoft.com/download/3/2/D/32D3E464-F2EF-490F-841B-05D53C848D15/MicrosoftWebDriver.exe"
|
39
|
-
when 15063
|
40
|
-
Webdrivers.logger.debug "Attempting to Download Build for 15063"
|
41
|
-
"https://download.microsoft.com/download/3/4/2/342316D7-EBE0-4F10-ABA2-AE8E0CDF36DD/MicrosoftWebDriver.exe"
|
42
|
-
else
|
43
|
-
Webdrivers.logger.debug "Attempting to Download Latest Insider's Version"
|
44
|
-
"https://download.microsoft.com/download/1/4/1/14156DA0-D40F-460A-B14D-1B264CA081A5/MicrosoftWebDriver.exe"
|
33
|
+
array = Nokogiri::HTML(get(base_url)).xpath("//li[@class='driver-download']/a")
|
34
|
+
array.each_with_object({}) do |link, hash|
|
35
|
+
next if link.text == 'Insiders'
|
36
|
+
hash[link.text.scan(/\d+/).first.to_i] = link['href']
|
45
37
|
end
|
46
38
|
end
|
47
39
|
|
48
40
|
def base_url
|
49
|
-
'https://
|
41
|
+
'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/'
|
50
42
|
end
|
51
|
-
|
52
43
|
end
|
53
44
|
end
|
54
45
|
end
|
data/spec/geckodriver_spec.rb
CHANGED
data/spec/mswebdriver_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Webdrivers::MSWebdriver do
|
|
19
19
|
before { allow(mswebdriver).to receive(:site_available?).and_return(false) }
|
20
20
|
|
21
21
|
it 'raises exception downloading' do
|
22
|
-
expect {mswebdriver.download}.to raise_error(StandardError, "Can not reach site")
|
22
|
+
expect { mswebdriver.download }.to raise_error(StandardError, "Can not reach site")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/webdrivers.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "webdrivers"
|
6
|
-
s.version = "3.
|
6
|
+
s.version = "3.3.0"
|
7
7
|
s.authors = ["Titus Fortner"]
|
8
8
|
s.email = ["titusfortner@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/titusfortner/webdrivers"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webdrivers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Titus Fortner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|