webdrivers 4.2.0 → 4.5.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 +38 -0
- data/LICENSE.txt +0 -0
- data/README.md +24 -5
- data/lib/webdrivers.rb +0 -0
- data/lib/webdrivers/Rakefile +0 -0
- data/lib/webdrivers/chrome_finder.rb +33 -1
- data/lib/webdrivers/chromedriver.rb +62 -21
- data/lib/webdrivers/common.rb +9 -3
- data/lib/webdrivers/edge_finder.rb +13 -1
- data/lib/webdrivers/edgedriver.rb +37 -14
- data/lib/webdrivers/geckodriver.rb +0 -0
- data/lib/webdrivers/iedriver.rb +9 -6
- data/lib/webdrivers/logger.rb +0 -0
- data/lib/webdrivers/network.rb +2 -0
- data/lib/webdrivers/railtie.rb +0 -0
- data/lib/webdrivers/system.rb +29 -0
- data/lib/webdrivers/tasks/chromedriver.rake +0 -0
- data/lib/webdrivers/tasks/edgedriver.rake +0 -0
- data/lib/webdrivers/tasks/geckodriver.rake +0 -0
- data/lib/webdrivers/tasks/iedriver.rake +0 -0
- data/lib/webdrivers/version.rb +1 -1
- data/spec/spec_helper.rb +0 -0
- data/spec/webdrivers/chrome_finder_spec.rb +53 -0
- data/spec/webdrivers/chromedriver_spec.rb +14 -9
- data/spec/webdrivers/coverage/assets/0.10.2/application.css +799 -0
- data/spec/webdrivers/coverage/assets/0.10.2/application.js +1707 -0
- data/spec/webdrivers/coverage/assets/0.10.2/colorbox/border.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/colorbox/controls.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/favicon_green.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/favicon_red.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/favicon_yellow.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/loading.gif +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/magnify.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/webdrivers/coverage/index.html +3512 -0
- data/spec/webdrivers/edge_finder_spec.rb +0 -0
- data/spec/webdrivers/edgedriver_spec.rb +16 -12
- data/spec/webdrivers/geckodriver_spec.rb +2 -1
- data/spec/webdrivers/i_edriver_spec.rb +2 -1
- data/spec/webdrivers/system_spec.rb +79 -0
- data/spec/webdrivers/webdrivers_spec.rb +0 -0
- data/spec/webdrivers_proxy_support_spec.rb +0 -0
- metadata +76 -45
- data/.github/ISSUE_TEMPLATE.md +0 -16
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -47
- data/.travis.yml +0 -41
- data/Gemfile +0 -6
- data/Rakefile +0 -11
- data/appveyor.yml +0 -45
- data/gemfiles/Gemfile.edge +0 -7
- data/support/install_jruby.ps1 +0 -7
- data/support/install_msedge.ps1 +0 -11
- data/webdrivers.gemspec +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb33edccefe82002bbea2a0ca410d050bbf12f3b8e3a7a7721147f75ffed9c97
|
4
|
+
data.tar.gz: 2a30c004082f6788096d0d18de559aeea99560a1a96a022b4e9b53c9e4232b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78187b37c392f86a3ef9b788e39c00b81f48acca6de9f9c64a619c28c4f7b29d71a57f099478786ac903ac0ea199735832324fcde5c50f32635b78ce532cddf1
|
7
|
+
data.tar.gz: 3bd31fda8f71d31238d8b73b2468677d5eb23ffe956bb82a74e382ce99a750dce5127ea8328e868c9a795015517c27f8fb208eee4fcdf0b81fa572b5200c1158
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,41 @@
|
|
1
|
+
# 4.5.0 (2021-01-19)
|
2
|
+
* Improve format of README usage section. Thanks, [okuramasafumi](https://github.com/okuramasafumi)!
|
3
|
+
* `chromedriver` - Add support for Apple M1 specific builds ([#193](https://github.com/titusfortner/webdrivers/pull/193)). Thanks, [MichaelHoste](https://github.com/MichaelHoste)!
|
4
|
+
* `msedgedriver` - Add support for Apple M1 specific builds.
|
5
|
+
* `msedgedriver` - Added automatic selection of 32-bit vs 64-bit builds on Windows and WSLv1.
|
6
|
+
* When using this gem in WSLv2, Chrome installed on the Linux filesystem will be automatically used ([#196](https://github.com/titusfortner/webdrivers/pull/196)).
|
7
|
+
WSLv1 continues to automatically use Chrome from the Windows filesystem though. Thanks, [fabioxgn](https://github.com/fabioxgn)!
|
8
|
+
* We'll aim to make the behavior consistent in a future release.
|
9
|
+
|
10
|
+
### 4.4.2 (2020-12-29)
|
11
|
+
* Use new powershell if available to enhance WSL support ([#176](https://github.com/titusfortner/webdrivers/issues/176),
|
12
|
+
[#186](https://github.com/titusfortner/webdrivers/pull/186)). Thanks, [G-Rath](https://github.com/G-Rath) and
|
13
|
+
[131](https://github.com/131)!
|
14
|
+
* Update rubocop version (development dependency only) ([#178](https://github.com/titusfortner/webdrivers/pull/178)).
|
15
|
+
Thanks, [utkarsh2102](https://github.com/utkarsh2102)!
|
16
|
+
* Replace `git ls-files` with `dir` in the gemspec for better Debian support ([#179](https://github.com/titusfortner/webdrivers/pull/179),
|
17
|
+
[#184](https://github.com/titusfortner/webdrivers/issues/184)).
|
18
|
+
Thanks again, [utkarsh2102](https://github.com/utkarsh2102)!
|
19
|
+
* Update README with `require: false` when adding gem to Gemfile ([#183](https://github.com/titusfortner/webdrivers/pull/183)).
|
20
|
+
* Make WSL detection more generic ([#187](https://github.com/titusfortner/webdrivers/pull/187)).
|
21
|
+
[rbclark](https://github.com/rbclark)!
|
22
|
+
|
23
|
+
### 4.4.1 (2020-06-01)
|
24
|
+
* Do not include binstubs used for troubleshooting only. Fixes [#174](https://github.com/titusfortner/webdrivers/issues/174).
|
25
|
+
|
26
|
+
### 4.4.0 (2020-05-31)
|
27
|
+
* Implement support for `chromedriver` in Windows Subsystem for Linux (WSL) v1 ([#172](https://github.com/titusfortner/webdrivers/issues/172)).
|
28
|
+
Thanks, [G-Rath](https://github.com/G-Rath)!
|
29
|
+
* Chrome/Edgedriver - Fix [#171](https://github.com/titusfortner/webdrivers/issues/171) by making sure the cached
|
30
|
+
driver build version matches the browser build version before using it.
|
31
|
+
* Chrome/Edgedriver - Driver version check now matches the driver and browser `major.minor.build` versions instead of just
|
32
|
+
the major version to be fully compliant with the `chromedriver` version selection
|
33
|
+
[document](https://chromedriver.chromium.org/downloads/version-selection).
|
34
|
+
|
35
|
+
### 4.3.0 (2020-04-14)
|
36
|
+
* Add support for Microsoft Edge (Chromium) stable
|
37
|
+
* Drop support for Ruby < 2.4.0
|
38
|
+
|
1
39
|
### 4.2.0 (2019-12-27)
|
2
40
|
* Add support for Microsoft Edge (Chromium) Beta releases ([#155](https://github.com/titusfortner/webdrivers/pull/155))
|
3
41
|
* Use tilde expansion to resolve user's home directory ([#166](https://github.com/titusfortner/webdrivers/pull/161))
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/webdrivers.svg)](https://badge.fury.io/rb/webdrivers)
|
4
4
|
[![Build status](https://travis-ci.org/titusfortner/webdrivers.svg?branch=master)](https://travis-ci.org/titusfortner/webdrivers)
|
5
5
|
[![AppVeyor status](https://ci.appveyor.com/api/projects/status/ejh90xqbvkphq4cy/branch/master?svg=true)](https://ci.appveyor.com/project/titusfortner/webdrivers/branch/master)
|
6
|
+
![Tests](https://github.com/titusfortner/webdrivers/workflows/Tests/badge.svg)
|
6
7
|
|
7
8
|
Run Selenium tests more easily with automatic installation and updates for all supported webdrivers.
|
8
9
|
|
@@ -15,11 +16,15 @@ Run Selenium tests more easily with automatic installation and updates for all s
|
|
15
16
|
* [IEDriverServer](https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
|
16
17
|
* [msedgedriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
|
17
18
|
|
19
|
+
Works on macOS, Linux, Windows, and Windows Subsystem for Linux (WSL) v1.
|
20
|
+
|
18
21
|
## Usage
|
19
22
|
|
20
23
|
In your Gemfile:
|
21
24
|
|
22
|
-
|
25
|
+
```ruby
|
26
|
+
gem 'webdrivers', '~> 4.0', require: false
|
27
|
+
```
|
23
28
|
|
24
29
|
In your project:
|
25
30
|
|
@@ -92,10 +97,10 @@ variable. **Only set one to avoid confusion**.
|
|
92
97
|
|
93
98
|
##### Special exception for chromedriver and msedgedriver
|
94
99
|
|
95
|
-
Cache time will be respected as long as a driver binary exists and the major versions of
|
96
|
-
the browser and the driver match. For example, if you update Chrome or Edge to v76 and its driver is
|
97
|
-
still at
|
98
|
-
using a compatible version.
|
100
|
+
Cache time will be respected as long as a driver binary exists and the major.minor.build versions of
|
101
|
+
the browser and the driver match. For example, if you update Chrome or Edge to v76.0.123 and its driver is
|
102
|
+
still at v76.0.100, `webdrivers` will ignore the cache time and update the driver to make sure you're
|
103
|
+
using a compatible build version.
|
99
104
|
|
100
105
|
### Proxy
|
101
106
|
|
@@ -192,6 +197,20 @@ The logging level can be configured for debugging purpose:
|
|
192
197
|
Webdrivers.logger.level = :DEBUG
|
193
198
|
```
|
194
199
|
|
200
|
+
### WSLv1 support
|
201
|
+
|
202
|
+
While WSLv1 is not designed to run headful applications like Chrome, it can run exes; as such when found to be running
|
203
|
+
in WSL, `webdrivers` will use the Windows `chromedriver.exe`.
|
204
|
+
|
205
|
+
It's recommended that you install the new PowerShell (PS7) to avoid [a known issue](https://github.com/microsoft/terminal/issues/367)
|
206
|
+
with the console font being changed when calling the old PowerShell (PS5).
|
207
|
+
|
208
|
+
### WSLv2 support
|
209
|
+
|
210
|
+
Webdrivers will detect WSLv2 as running on Linux.
|
211
|
+
|
212
|
+
WSLv2 doesn't support connecting to host ports out of the box, so it isn't possible to connect to Chromedriver on Windows without extra configurations, see: https://github.com/microsoft/WSL/issues/4619. The simplest way to use Chromedriver with WSLv2 is to run Chrome headless on Linux.
|
213
|
+
|
195
214
|
### Browser Specific Notes
|
196
215
|
|
197
216
|
#### Chrome/Chromium
|
data/lib/webdrivers.rb
CHANGED
File without changes
|
data/lib/webdrivers/Rakefile
CHANGED
File without changes
|
@@ -50,6 +50,28 @@ module Webdrivers
|
|
50
50
|
nil
|
51
51
|
end
|
52
52
|
|
53
|
+
def wsl_location
|
54
|
+
_, drive, user = ENV['PATH'].match(%r{/([a-z])/Users/([^/:]+)/AppData/}).to_a
|
55
|
+
|
56
|
+
roots = [
|
57
|
+
"#{drive}:\\Users\\#{user}\\AppData\\Local",
|
58
|
+
"#{drive}:\\Program Files (x86)",
|
59
|
+
"#{drive}:\\Program Files"
|
60
|
+
]
|
61
|
+
|
62
|
+
directories = %w[Google\\Chrome\\Application Chromium\\Application]
|
63
|
+
file = 'chrome.exe'
|
64
|
+
|
65
|
+
directories.each do |dir|
|
66
|
+
roots.each do |root|
|
67
|
+
option = System.to_wsl_path("#{root}\\#{dir}\\#{file}")
|
68
|
+
return option if File.exist?(option)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
|
53
75
|
def mac_location
|
54
76
|
directories = ['', File.expand_path('~')]
|
55
77
|
files = ['/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
@@ -66,6 +88,8 @@ module Webdrivers
|
|
66
88
|
end
|
67
89
|
|
68
90
|
def linux_location
|
91
|
+
return wsl_location if System.wsl_v1?
|
92
|
+
|
69
93
|
directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
|
70
94
|
files = %w[google-chrome chrome chromium chromium-browser]
|
71
95
|
|
@@ -80,10 +104,18 @@ module Webdrivers
|
|
80
104
|
end
|
81
105
|
|
82
106
|
def win_version(location)
|
83
|
-
System.call("
|
107
|
+
System.call("pwsh.exe -command \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
|
108
|
+
rescue StandardError
|
109
|
+
System.call("powershell.exe \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
|
110
|
+
end
|
111
|
+
|
112
|
+
def wsl_version(location)
|
113
|
+
win_version(System.to_win32_path(location))
|
84
114
|
end
|
85
115
|
|
86
116
|
def linux_version(location)
|
117
|
+
return wsl_version(location) if System.wsl_v1?
|
118
|
+
|
87
119
|
System.call(location, '--product-version')&.strip
|
88
120
|
end
|
89
121
|
|
@@ -29,9 +29,14 @@ module Webdrivers
|
|
29
29
|
def latest_version
|
30
30
|
@latest_version ||= begin
|
31
31
|
# Versions before 70 do not have a LATEST_RELEASE file
|
32
|
-
return normalize_version('2.41') if
|
32
|
+
return normalize_version('2.41') if browser_build_version < normalize_version('70')
|
33
33
|
|
34
|
-
|
34
|
+
# Cache check
|
35
|
+
# Cached version should exist and be compatible with the current browser version.
|
36
|
+
# Otherwise, fetch the latest compatible driver.
|
37
|
+
latest_applicable = with_cache(file_name,
|
38
|
+
current_build_version,
|
39
|
+
browser_build_version) { latest_point_release(browser_build_version) }
|
35
40
|
|
36
41
|
Webdrivers.logger.debug "Latest version available: #{latest_applicable}"
|
37
42
|
normalize_version(latest_applicable)
|
@@ -68,48 +73,84 @@ module Webdrivers
|
|
68
73
|
else
|
69
74
|
msg
|
70
75
|
end
|
71
|
-
|
72
|
-
|
76
|
+
rescue NetworkError
|
77
|
+
"#{msg} A network issue is preventing determination of latest chromedriver release."
|
73
78
|
end
|
74
79
|
|
75
80
|
msg = "#{msg} Please set `Webdrivers::Chromedriver.required_version = <desired driver version>` "\
|
76
|
-
'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
|
77
|
-
|
81
|
+
'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
|
78
82
|
Webdrivers.logger.debug msg
|
79
83
|
raise VersionError, msg
|
80
84
|
end
|
81
85
|
|
82
86
|
def file_name
|
83
|
-
System.platform == 'win' ? 'chromedriver.exe' : 'chromedriver'
|
87
|
+
System.platform == 'win' || System.wsl_v1? ? 'chromedriver.exe' : 'chromedriver'
|
88
|
+
end
|
89
|
+
|
90
|
+
def apple_m1_compatible?(driver_version)
|
91
|
+
if System.apple_m1_architecture? && driver_version >= normalize_version('87.0.4280.88')
|
92
|
+
Webdrivers.logger.debug 'chromedriver version is Apple M1 compatible.'
|
93
|
+
return true
|
94
|
+
end
|
95
|
+
|
96
|
+
Webdrivers.logger.debug 'chromedriver version is NOT Apple M1 compatible. Required >= 87.0.4280.88'
|
97
|
+
false
|
84
98
|
end
|
85
99
|
|
86
100
|
def download_url
|
87
101
|
return @download_url if @download_url
|
88
102
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
url = "#{base_url}/#{version}/chromedriver_#{file_name}.zip"
|
103
|
+
driver_version = if required_version == EMPTY_VERSION
|
104
|
+
latest_version
|
105
|
+
else
|
106
|
+
normalize_version(required_version)
|
107
|
+
end
|
108
|
+
filename = driver_filename(driver_version)
|
109
|
+
url = "#{base_url}/#{driver_version}/chromedriver_#{filename}.zip"
|
97
110
|
Webdrivers.logger.debug "chromedriver URL: #{url}"
|
98
111
|
@download_url = url
|
99
112
|
end
|
100
113
|
|
101
|
-
|
114
|
+
def driver_filename(driver_version)
|
115
|
+
if System.platform == 'win' || System.wsl_v1?
|
116
|
+
'win32'
|
117
|
+
elsif System.platform == 'linux'
|
118
|
+
'linux64'
|
119
|
+
elsif System.platform == 'mac'
|
120
|
+
apple_arch = apple_m1_compatible?(driver_version) ? '_m1' : ''
|
121
|
+
"mac64#{apple_arch}"
|
122
|
+
else
|
123
|
+
raise 'Failed to determine driver filename to download for your OS.'
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# Returns major.minor.build version from the currently installed chromedriver version
|
128
|
+
#
|
129
|
+
# @example
|
130
|
+
# 73.0.3683.68 (major.minor.build.patch) -> 73.0.3683 (major.minor.build)
|
131
|
+
def current_build_version
|
132
|
+
build_ver = if current_version.nil? # Driver not found
|
133
|
+
nil
|
134
|
+
else
|
135
|
+
current_version.segments[0..2].join('.')
|
136
|
+
end
|
137
|
+
normalize_version(build_ver)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Returns major.minor.build version from the currently installed Chrome version
|
102
141
|
#
|
103
142
|
# @example
|
104
|
-
# 73.0.3683.75 -> 73.0.3683
|
105
|
-
def
|
106
|
-
|
107
|
-
normalize_version(chrome.segments[0..2].join('.'))
|
143
|
+
# 73.0.3683.75 (major.minor.build.patch) -> 73.0.3683 (major.minor.build)
|
144
|
+
def browser_build_version
|
145
|
+
normalize_version(browser_version.segments[0..2].join('.'))
|
108
146
|
end
|
147
|
+
alias chrome_build_version browser_build_version
|
109
148
|
|
149
|
+
# Returns true if an executable driver binary exists
|
150
|
+
# and its build version matches the browser build version
|
110
151
|
def sufficient_binary?
|
111
152
|
super && current_version && (current_version < normalize_version('70.0.3538') ||
|
112
|
-
|
153
|
+
current_build_version == browser_build_version)
|
113
154
|
end
|
114
155
|
end
|
115
156
|
end
|
data/lib/webdrivers/common.rb
CHANGED
@@ -157,9 +157,15 @@ module Webdrivers
|
|
157
157
|
nil
|
158
158
|
end
|
159
159
|
|
160
|
-
|
161
|
-
|
162
|
-
|
160
|
+
# Returns cached driver version if cache is still valid and the driver binary exists.
|
161
|
+
# Otherwise caches the given version (typically the latest available)
|
162
|
+
# In case of Chrome, it also verifies that the driver build and browser build versions are compatible.
|
163
|
+
# Example usage: lib/webdrivers/chromedriver.rb:34
|
164
|
+
def with_cache(file_name, driver_build = nil, browser_build = nil)
|
165
|
+
if System.valid_cache?(file_name) && exists? && (driver_build == browser_build)
|
166
|
+
cached_version = System.cached_version(file_name)
|
167
|
+
Webdrivers.logger.debug "using cached version as latest: #{cached_version}"
|
168
|
+
normalize_version cached_version
|
163
169
|
else
|
164
170
|
version = yield
|
165
171
|
System.cache_version(file_name, version)
|
@@ -37,7 +37,8 @@ module Webdrivers
|
|
37
37
|
|
38
38
|
def win_location
|
39
39
|
envs = %w[LOCALAPPDATA PROGRAMFILES PROGRAMFILES(X86)]
|
40
|
-
directories = ['\\Microsoft\\Edge
|
40
|
+
directories = ['\\Microsoft\\Edge\\Application',
|
41
|
+
'\\Microsoft\\Edge Beta\\Application',
|
41
42
|
'\\Microsoft\\Edge Dev\\Application',
|
42
43
|
'\\Microsoft\\Edge SxS\\Application']
|
43
44
|
file = 'msedge.exe'
|
@@ -68,6 +69,17 @@ module Webdrivers
|
|
68
69
|
end
|
69
70
|
|
70
71
|
def linux_location
|
72
|
+
# directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
|
73
|
+
# files = %w[microsoft-edge] # Based on Microsoft Edge 89.0.760.0 dev
|
74
|
+
#
|
75
|
+
# directories.each do |dir|
|
76
|
+
# files.each do |file|
|
77
|
+
# option = "#{dir}/#{file}"
|
78
|
+
# return option if File.exist?(option)
|
79
|
+
# end
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
# nil
|
71
83
|
raise 'Default location not yet known'
|
72
84
|
end
|
73
85
|
|
@@ -26,10 +26,6 @@ module Webdrivers
|
|
26
26
|
'https://msedgedriver.azureedge.net/'
|
27
27
|
end
|
28
28
|
|
29
|
-
def remove
|
30
|
-
super
|
31
|
-
end
|
32
|
-
|
33
29
|
private
|
34
30
|
|
35
31
|
def latest_point_release(version)
|
@@ -58,8 +54,8 @@ module Webdrivers
|
|
58
54
|
else
|
59
55
|
msg
|
60
56
|
end
|
61
|
-
|
62
|
-
|
57
|
+
rescue NetworkError
|
58
|
+
"#{msg} A network issue is preventing determination of latest msedgedriver release."
|
63
59
|
end
|
64
60
|
|
65
61
|
"#{msg} Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` "\
|
@@ -70,17 +66,44 @@ module Webdrivers
|
|
70
66
|
System.platform == 'win' ? 'msedgedriver.exe' : 'msedgedriver'
|
71
67
|
end
|
72
68
|
|
69
|
+
def apple_m1_compatible?(driver_version)
|
70
|
+
if System.apple_m1_architecture? && driver_version >= normalize_version('87.0.669.0')
|
71
|
+
Webdrivers.logger.debug 'msedgedriver version is Apple M1 compatible.'
|
72
|
+
return true
|
73
|
+
end
|
74
|
+
|
75
|
+
Webdrivers.logger.debug 'msedgedriver version is NOT Apple M1 compatible. Required >= 87.0.669.0'
|
76
|
+
false
|
77
|
+
end
|
78
|
+
|
79
|
+
# def linux_compatible?(driver_version)
|
80
|
+
# System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
|
81
|
+
# end
|
82
|
+
|
83
|
+
def driver_filename(driver_version)
|
84
|
+
if System.platform == 'win' || System.wsl_v1?
|
85
|
+
"win#{System.bitsize}" # 32 or 64-bit
|
86
|
+
# elsif linux_compatible?(driver_version)
|
87
|
+
# 'linux64'
|
88
|
+
elsif System.platform == 'mac'
|
89
|
+
# Determine M1 or Intel architecture
|
90
|
+
apple_arch = apple_m1_compatible?(driver_version) ? 'arm' : 'mac'
|
91
|
+
"#{apple_arch}64"
|
92
|
+
else
|
93
|
+
raise 'Failed to determine driver filename to download for your OS.'
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
73
97
|
def download_url
|
74
98
|
return @download_url if @download_url
|
75
99
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
url = "#{base_url}/#{version}/edgedriver_#{file_name}.zip"
|
100
|
+
driver_version = if required_version == EMPTY_VERSION
|
101
|
+
latest_version
|
102
|
+
else
|
103
|
+
normalize_version(required_version)
|
104
|
+
end
|
105
|
+
filename = driver_filename(driver_version)
|
106
|
+
url = "#{base_url}/#{driver_version}/edgedriver_#{filename}.zip"
|
84
107
|
Webdrivers.logger.debug "msedgedriver URL: #{url}"
|
85
108
|
@download_url = url
|
86
109
|
end
|
File without changes
|
data/lib/webdrivers/iedriver.rb
CHANGED
@@ -44,16 +44,19 @@ module Webdrivers
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def downloads
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
ds = items.each_with_object({}) do |item, hash|
|
51
|
-
key = normalize_version item[/([^_]+)\.zip/, 1]
|
52
|
-
hash[key] = "#{base_url}#{item}"
|
47
|
+
ds = download_manifest.each_with_object({}) do |item, hash|
|
48
|
+
version = normalize_version item[/([^_]+)\.zip/, 1]
|
49
|
+
hash[version] = "#{base_url}#{item}"
|
53
50
|
end
|
54
51
|
Webdrivers.logger.debug "Versions now located on downloads site: #{ds.keys}"
|
55
52
|
ds
|
56
53
|
end
|
54
|
+
|
55
|
+
def download_manifest
|
56
|
+
doc = Nokogiri::XML.parse(Network.get(base_url))
|
57
|
+
items = doc.css('Key').collect(&:text)
|
58
|
+
items.select { |item| item.include?('IEDriverServer_Win32') }
|
59
|
+
end
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|