webdrivers 4.0.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +98 -0
- data/README.md +88 -34
- data/lib/webdrivers/chrome_finder.rb +77 -9
- data/lib/webdrivers/chromedriver.rb +65 -39
- data/lib/webdrivers/common.rb +31 -21
- data/lib/webdrivers/edge_finder.rb +98 -0
- data/lib/webdrivers/edgedriver.rb +99 -0
- data/lib/webdrivers/geckodriver.rb +2 -23
- data/lib/webdrivers/iedriver.rb +14 -20
- data/lib/webdrivers/logger.rb +2 -93
- data/lib/webdrivers/network.rb +2 -0
- data/lib/webdrivers/railtie.rb +0 -1
- data/lib/webdrivers/system.rb +57 -14
- data/lib/webdrivers/tasks/chromedriver.rake +0 -2
- data/lib/webdrivers/tasks/edgedriver.rake +44 -0
- data/lib/webdrivers/tasks/geckodriver.rake +0 -2
- data/lib/webdrivers/tasks/iedriver.rake +0 -2
- data/lib/webdrivers/version.rb +1 -1
- data/lib/webdrivers.rb +1 -0
- data/spec/webdrivers/chrome_finder_spec.rb +103 -0
- data/spec/webdrivers/chromedriver_spec.rb +33 -15
- data/spec/webdrivers/edge_finder_spec.rb +52 -0
- data/spec/webdrivers/edgedriver_spec.rb +273 -0
- data/spec/webdrivers/geckodriver_spec.rb +45 -10
- data/spec/webdrivers/i_edriver_spec.rb +17 -12
- data/spec/webdrivers/system_spec.rb +79 -0
- data/spec/webdrivers/webdrivers_spec.rb +38 -26
- metadata +51 -24
- data/.github/ISSUE_TEMPLATE.md +0 -14
- data/.gitignore +0 -7
- data/.rubocop.yml +0 -45
- data/.travis.yml +0 -24
- data/Gemfile +0 -6
- data/Rakefile +0 -11
- data/appveyor.yml +0 -23
- data/webdrivers.gemspec +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: abf2f2c3590d8497b09a84c7f2b55c2b8c5a5cf5752d178fcd4e4a852c0cfd2c
|
|
4
|
+
data.tar.gz: 422f61f2c96fa03e7d4ae5b8564d52058f13334d51ccda07b334805bb2403d6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dad2443ef52807af22f9780064bb72c226e9101e9997bd787e6ccd3c8a2e161357eb46f476e663a046bee4b9848002f2112a3db5e03a13cd7ca87b564708f54b
|
|
7
|
+
data.tar.gz: 809752d1ef3e67e1fe8a5021eeafe3ab93ad1436c1c894ca6765e8f9e739caf8b4b359d2f2ced0ee61cd118cb7492a8281049f60695d2ba0ec5a51d3fa76b1f4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
+
# 5.2.0 (2022-09-29)
|
|
2
|
+
* `chromedriver` - Fix downloading on M1 macs from version 106.0.5249.61 ([#237](https://github.com/titusfortner/webdrivers/issues/237), thanks jmccure)
|
|
3
|
+
|
|
4
|
+
# 5.1.0 (2022-09-19)
|
|
5
|
+
* Improve error messages (#232, thanks dan-jensen)
|
|
6
|
+
* Fix circular require bug with railtie (#233, thanks amatsuda)
|
|
7
|
+
* Support downloading correct geckodriver on Apple silicon (#234 thanks stephannv)
|
|
8
|
+
* Update linux locations for Chrome to latest chromedriver finder (thanks entretechno-jeremiah)
|
|
9
|
+
* Add support for Microsoft Edge on Linux (#236)
|
|
10
|
+
|
|
11
|
+
# 5.0.0 (2021-10-19)
|
|
12
|
+
* Require Selenium 4+
|
|
13
|
+
* Remove custom Logger and use the one in Selenium 4
|
|
14
|
+
|
|
15
|
+
# 4.7.0 (2021-10-14)
|
|
16
|
+
* Add support for Selenium 4.x #218 (thanks yahonda )
|
|
17
|
+
* Allow Edge on Linux
|
|
18
|
+
* Update required Selenium > 3.141 because of a change in 4.6
|
|
19
|
+
* Require Ruby 2.6+
|
|
20
|
+
* Fix IE downloads with the change in location of assets
|
|
21
|
+
|
|
22
|
+
# 4.6.1 (2021-08-19)
|
|
23
|
+
* Fix bug in IEdriver caused by bad formatting in recent release
|
|
24
|
+
|
|
25
|
+
# 4.6.0 (2021-02-26)
|
|
26
|
+
* Update `Edgedriver` naming to support Selenium 4 beta (([#206](https://github.com/titusfortner/webdrivers/pull/206))
|
|
27
|
+
|
|
28
|
+
# 4.5.0 (2021-01-19)
|
|
29
|
+
* Improve format of README usage section. Thanks, [okuramasafumi](https://github.com/okuramasafumi)!
|
|
30
|
+
* `chromedriver` - Add support for Apple M1 specific builds ([#193](https://github.com/titusfortner/webdrivers/pull/193)). Thanks, [MichaelHoste](https://github.com/MichaelHoste)!
|
|
31
|
+
* `msedgedriver` - Add support for Apple M1 specific builds.
|
|
32
|
+
* `msedgedriver` - Added automatic selection of 32-bit vs 64-bit builds on Windows and WSLv1.
|
|
33
|
+
* When using this gem in WSLv2, Chrome installed on the Linux filesystem will be automatically used ([#196](https://github.com/titusfortner/webdrivers/pull/196)).
|
|
34
|
+
WSLv1 continues to automatically use Chrome from the Windows filesystem though. Thanks, [fabioxgn](https://github.com/fabioxgn)!
|
|
35
|
+
* We'll aim to make the behavior consistent in a future release.
|
|
36
|
+
|
|
37
|
+
### 4.4.2 (2020-12-29)
|
|
38
|
+
* Use new powershell if available to enhance WSL support ([#176](https://github.com/titusfortner/webdrivers/issues/176),
|
|
39
|
+
[#186](https://github.com/titusfortner/webdrivers/pull/186)). Thanks, [G-Rath](https://github.com/G-Rath) and
|
|
40
|
+
[131](https://github.com/131)!
|
|
41
|
+
* Update rubocop version (development dependency only) ([#178](https://github.com/titusfortner/webdrivers/pull/178)).
|
|
42
|
+
Thanks, [utkarsh2102](https://github.com/utkarsh2102)!
|
|
43
|
+
* Replace `git ls-files` with `dir` in the gemspec for better Debian support ([#179](https://github.com/titusfortner/webdrivers/pull/179),
|
|
44
|
+
[#184](https://github.com/titusfortner/webdrivers/issues/184)).
|
|
45
|
+
Thanks again, [utkarsh2102](https://github.com/utkarsh2102)!
|
|
46
|
+
* Update README with `require: false` when adding gem to Gemfile ([#183](https://github.com/titusfortner/webdrivers/pull/183)).
|
|
47
|
+
* Make WSL detection more generic ([#187](https://github.com/titusfortner/webdrivers/pull/187)).
|
|
48
|
+
[rbclark](https://github.com/rbclark)!
|
|
49
|
+
|
|
50
|
+
### 4.4.1 (2020-06-01)
|
|
51
|
+
* Do not include binstubs used for troubleshooting only. Fixes [#174](https://github.com/titusfortner/webdrivers/issues/174).
|
|
52
|
+
|
|
53
|
+
### 4.4.0 (2020-05-31)
|
|
54
|
+
* Implement support for `chromedriver` in Windows Subsystem for Linux (WSL) v1 ([#172](https://github.com/titusfortner/webdrivers/issues/172)).
|
|
55
|
+
Thanks, [G-Rath](https://github.com/G-Rath)!
|
|
56
|
+
* Chrome/Edgedriver - Fix [#171](https://github.com/titusfortner/webdrivers/issues/171) by making sure the cached
|
|
57
|
+
driver build version matches the browser build version before using it.
|
|
58
|
+
* Chrome/Edgedriver - Driver version check now matches the driver and browser `major.minor.build` versions instead of just
|
|
59
|
+
the major version to be fully compliant with the `chromedriver` version selection
|
|
60
|
+
[document](https://chromedriver.chromium.org/downloads/version-selection).
|
|
61
|
+
|
|
62
|
+
### 4.3.0 (2020-04-14)
|
|
63
|
+
* Add support for Microsoft Edge (Chromium) stable
|
|
64
|
+
* Drop support for Ruby < 2.4.0
|
|
65
|
+
|
|
66
|
+
### 4.2.0 (2019-12-27)
|
|
67
|
+
* Add support for Microsoft Edge (Chromium) Beta releases ([#155](https://github.com/titusfortner/webdrivers/pull/155))
|
|
68
|
+
* Use tilde expansion to resolve user's home directory ([#166](https://github.com/titusfortner/webdrivers/pull/161))
|
|
69
|
+
* Add support for Chromium installed using Snap on Ubuntu ([#163](https://github.com/titusfortner/webdrivers/pull/163)). Thanks Tietew!
|
|
70
|
+
|
|
71
|
+
### 4.1.3 (2019-10-07)
|
|
72
|
+
* Require rubyzip version 1.3.0 or higher to fix [rubyzip#403](https://github.com/rubyzip/rubyzip/pull/403). Thanks rhymes! ([#153](https://github.com/titusfortner/webdrivers/pull/153))
|
|
73
|
+
* Fix a bug where the file deletion confirmation was printed even when there were no files to delete.
|
|
74
|
+
|
|
75
|
+
### 4.1.2 (2019-07-29)
|
|
76
|
+
* Fix a bug related to raising `BrowserNotFound`.
|
|
77
|
+
|
|
78
|
+
### 4.1.1 (2019-07-18)
|
|
79
|
+
* Raise `BrowserNotFound` if Chrome and Edge binary are not found (issue [#144](https://github.com/titusfortner/webdrivers/issues/144)).
|
|
80
|
+
|
|
81
|
+
### 4.1.0 (2019-07-03)
|
|
82
|
+
* Add support for `msedgedriver` (issue [#93](https://github.com/titusfortner/webdrivers/issues/93))
|
|
83
|
+
* Allow users to provide a custom binary path via `WD_CHROME_PATH`
|
|
84
|
+
and `WD_EDGE_CHROME_ATH` environment variables (issues #[137](https://github.com/titusfortner/webdrivers/issues/137)
|
|
85
|
+
and [#93](https://github.com/titusfortner/webdrivers/issues/93))
|
|
86
|
+
* Fix a bug where the user given Chrome binary path via `Selenium::WebDriver::Chrome.path`
|
|
87
|
+
was not properly escaped (issue [#139](https://github.com/titusfortner/webdrivers/issues/139))
|
|
88
|
+
* Fix miscellaneous code warnings.
|
|
89
|
+
* ~~**Announcement**: As of 06/21/2019, `heroku-buildpack-google-chrome`
|
|
90
|
+
no longer requires a [workaround](https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome)
|
|
91
|
+
to work with this gem. See [heroku-buildpack-google-chrome#73](https://github.com/heroku/heroku-buildpack-google-chrome/pull/73)
|
|
92
|
+
for more information.~~
|
|
93
|
+
|
|
94
|
+
### 4.0.1 (2019-06-12)
|
|
95
|
+
* Cache time now defaults to 86,400 Seconds (24 hours). Please note the special exception for `chromedriver` in the [README](https://github.com/titusfortner/webdrivers#special-exception-for-chromedriver-and-msedgedriver) (issue [#132](https://github.com/titusfortner/webdrivers/issues/132))
|
|
96
|
+
* Properly escape Chrome binary path when using JRuby on Windows (issue [#130](https://github.com/titusfortner/webdrivers/issues/130))
|
|
97
|
+
* Allow use of `selenium-webdriver` v4 (pre-releases only)
|
|
98
|
+
|
|
1
99
|
### 4.0.0 (2019-05-28)
|
|
2
100
|
|
|
3
101
|
No changes since rc2. Please report any issues [here](https://github.com/titusfortner/webdrivers/issues)
|
data/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Webdrivers
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/webdrivers)
|
|
4
|
-
|
|
5
|
-
[](https://ci.appveyor.com/project/titusfortner/webdrivers/branch/master)
|
|
4
|
+

|
|
6
5
|
|
|
7
6
|
Run Selenium tests more easily with automatic installation and updates for all supported webdrivers.
|
|
8
7
|
|
|
@@ -13,16 +12,18 @@ Run Selenium tests more easily with automatic installation and updates for all s
|
|
|
13
12
|
* [chromedriver](http://chromedriver.chromium.org/)
|
|
14
13
|
* [geckodriver](https://github.com/mozilla/geckodriver)
|
|
15
14
|
* [IEDriverServer](https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
|
|
15
|
+
* [msedgedriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
[here](https://developer.microsoft.com/en-us/microsoft-edge/).
|
|
17
|
+
Works on macOS, Linux, Windows, and Windows Subsystem for Linux (WSL) v1 and v2. And do see the browser and OS specific
|
|
18
|
+
notes at the bottom.
|
|
20
19
|
|
|
21
20
|
## Usage
|
|
22
21
|
|
|
23
|
-
In your Gemfile:
|
|
22
|
+
In your Gemfile:
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
```ruby
|
|
25
|
+
gem 'webdrivers', '~> 5.0', require: false
|
|
26
|
+
```
|
|
26
27
|
|
|
27
28
|
In your project:
|
|
28
29
|
|
|
@@ -31,21 +32,23 @@ require 'webdrivers'
|
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
The drivers will now be automatically downloaded or updated when you launch a browser
|
|
34
|
-
through Selenium.
|
|
35
|
+
through Selenium.
|
|
35
36
|
|
|
36
37
|
### Specific Drivers
|
|
37
38
|
|
|
38
39
|
If you want webdrivers to only manage specific drivers you can specify one or more as follows:
|
|
40
|
+
|
|
39
41
|
```ruby
|
|
40
42
|
require 'webdrivers/chromedriver'
|
|
41
43
|
require 'webdrivers/geckodriver'
|
|
42
44
|
require 'webdrivers/iedriver'
|
|
45
|
+
require 'webdrivers/edgedriver'
|
|
43
46
|
```
|
|
44
47
|
|
|
45
48
|
### Download Location
|
|
46
49
|
|
|
47
50
|
The default download location is `~/.webdrivers` directory, and this is configurable:
|
|
48
|
-
|
|
51
|
+
|
|
49
52
|
```ruby
|
|
50
53
|
Webdrivers.install_dir = '/webdrivers/install/dir'
|
|
51
54
|
```
|
|
@@ -55,7 +58,7 @@ variable.
|
|
|
55
58
|
|
|
56
59
|
### Version Pinning
|
|
57
60
|
|
|
58
|
-
If you would like to use a specific (older or beta) version, you can specify it for each driver. Otherwise,
|
|
61
|
+
If you would like to use a specific (older or beta) version, you can specify it for each driver. Otherwise,
|
|
59
62
|
the latest (stable) driver will be downloaded and passed to Selenium.
|
|
60
63
|
|
|
61
64
|
```ruby
|
|
@@ -67,6 +70,9 @@ Webdrivers::Geckodriver.required_version = '0.23.0'
|
|
|
67
70
|
|
|
68
71
|
# Internet Explorer
|
|
69
72
|
Webdrivers::IEdriver.required_version = '3.14.0'
|
|
73
|
+
|
|
74
|
+
# Edge (Chromium)
|
|
75
|
+
Webdrivers::Edgedriver.required_version = '76.0.183.0'
|
|
70
76
|
```
|
|
71
77
|
|
|
72
78
|
You can explicitly trigger the update in your code, but this will happen
|
|
@@ -82,13 +88,18 @@ You can set Webdrivers to only look for updates if the previous check
|
|
|
82
88
|
was longer ago than a specified number of seconds.
|
|
83
89
|
|
|
84
90
|
```ruby
|
|
85
|
-
Webdrivers.cache_time = 86_400
|
|
91
|
+
Webdrivers.cache_time = 86_400 # Default: 86,400 Seconds (24 hours)
|
|
86
92
|
```
|
|
87
93
|
|
|
88
94
|
Alternatively, you can define this value via the `WD_CACHE_TIME` environment
|
|
89
|
-
variable.
|
|
95
|
+
variable. **Only set one to avoid confusion**.
|
|
96
|
+
|
|
97
|
+
##### Special exception for chromedriver and msedgedriver
|
|
90
98
|
|
|
91
|
-
|
|
99
|
+
Cache time will be respected as long as a driver binary exists and the major.minor.build versions of
|
|
100
|
+
the browser and the driver match. For example, if you update Chrome or Edge to v76.0.123 and its driver is
|
|
101
|
+
still at v76.0.100, `webdrivers` will ignore the cache time and update the driver to make sure you're
|
|
102
|
+
using a compatible build version.
|
|
92
103
|
|
|
93
104
|
### Proxy
|
|
94
105
|
|
|
@@ -107,7 +118,7 @@ end
|
|
|
107
118
|
### `SSL_connect` errors
|
|
108
119
|
|
|
109
120
|
If you are getting an error like this (especially common on Windows):
|
|
110
|
-
|
|
121
|
+
|
|
111
122
|
`SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed`
|
|
112
123
|
|
|
113
124
|
Add the following to your Gemfile:
|
|
@@ -127,15 +138,34 @@ Other solutions are documented on the RubyGems [website](https://guides.rubygems
|
|
|
127
138
|
### Rake tasks
|
|
128
139
|
|
|
129
140
|
Each driver has its own set of `rake` tasks (with `Railtie` support) that
|
|
130
|
-
you can call once before executing the tests.
|
|
131
|
-
useful if you're running tests in parallel and want to avoid performing
|
|
141
|
+
you can call once before executing the tests. These are especially
|
|
142
|
+
useful if you're running tests in parallel and want to avoid performing
|
|
132
143
|
an update check per thread.
|
|
133
144
|
|
|
145
|
+
If you are using Rails default configuration the `webdrivers` gem will only be loaded in the test group
|
|
146
|
+
so you will need to specify the test environment when using the tasks:
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
RAILS_ENV=test rails webdrivers:chromedriver:update
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
If you are not using Rails, you'll need to load them into your Rakefile like this:
|
|
153
|
+
|
|
154
|
+
```ruby
|
|
155
|
+
require 'webdrivers'
|
|
156
|
+
load 'webdrivers/Rakefile'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The full list of available tasks is:
|
|
160
|
+
|
|
134
161
|
```bash
|
|
135
162
|
$ bundle exec rake -T
|
|
136
163
|
rake webdrivers:chromedriver:remove # Force remove chromedriver
|
|
137
164
|
rake webdrivers:chromedriver:update[version] # Remove and download updated chromedriver if necessary
|
|
138
165
|
rake webdrivers:chromedriver:version # Print current chromedriver version
|
|
166
|
+
rake webdrivers:edgedriver:remove # Force remove msedgedriver
|
|
167
|
+
rake webdrivers:edgedriver:update[version] # Remove and download updated msedgedriver if necessary
|
|
168
|
+
rake webdrivers:edgedriver:version # Print current msedgedriver version
|
|
139
169
|
rake webdrivers:geckodriver:remove # Force remove geckodriver
|
|
140
170
|
rake webdrivers:geckodriver:update[version] # Remove and download updated geckodriver if necessary
|
|
141
171
|
rake webdrivers:geckodriver:version # Print current geckodriver version
|
|
@@ -144,8 +174,9 @@ rake webdrivers:iedriver:update[version] # Remove and download updated IEDr
|
|
|
144
174
|
rake webdrivers:iedriver:version # Print current IEDriverServer version
|
|
145
175
|
```
|
|
146
176
|
|
|
147
|
-
These tasks respect the `WD_INSTALL_DIR
|
|
148
|
-
variables which can also be passed
|
|
177
|
+
These tasks respect the `WD_INSTALL_DIR`, `WD_CACHE_TIME`, `WD_CHROME_PATH`,
|
|
178
|
+
and `WD_EDGE_CHROME_PATH` environment variables, which can also be passed
|
|
179
|
+
through the `rake` command:
|
|
149
180
|
|
|
150
181
|
```bash
|
|
151
182
|
$ bundle exec rake webdrivers:chromedriver:update[2.46] webdrivers:geckodriver:update[0.24.0] WD_CACHE_TIME=86_400 WD_INSTALL_DIR='my_dir'
|
|
@@ -165,44 +196,67 @@ The logging level can be configured for debugging purpose:
|
|
|
165
196
|
Webdrivers.logger.level = :DEBUG
|
|
166
197
|
```
|
|
167
198
|
|
|
168
|
-
### Browser Specific Notes
|
|
199
|
+
### Browser & OS Specific Notes
|
|
169
200
|
|
|
170
201
|
#### Chrome/Chromium
|
|
171
202
|
|
|
172
203
|
The version of `chromedriver` will depend on the version of Chrome you are using it with:
|
|
173
204
|
|
|
174
|
-
* For versions >= 70, the downloaded version of `chromedriver` will match the installed version of Google Chrome.
|
|
205
|
+
* For versions >= 70, the downloaded version of `chromedriver` will match the installed version of Google Chrome.
|
|
175
206
|
More information [here](http://chromedriver.chromium.org/downloads/version-selection).
|
|
176
207
|
* For versions <= 69, `chromedriver` version 2.41 will be downloaded.
|
|
177
|
-
* For beta versions, you'll have to require the beta version of `chromedriver`
|
|
208
|
+
* For beta versions, you'll have to require the beta version of `chromedriver`
|
|
178
209
|
using `Webdrivers::Chromedriver.required_version`.
|
|
179
|
-
|
|
180
|
-
The gem looks for the Chrome/Chromium version that `chromedriver` will use by default.
|
|
210
|
+
|
|
211
|
+
The gem looks for the Chrome/Chromium version that `chromedriver` will use by default.
|
|
181
212
|
You can override this behavior by providing a path to the browser binary you want to use:
|
|
182
213
|
|
|
183
214
|
```ruby
|
|
184
215
|
Selenium::WebDriver::Chrome.path = '/chromium/install/path/to/binary'
|
|
185
216
|
```
|
|
186
217
|
|
|
187
|
-
|
|
218
|
+
Alternatively, you can define the path via the `WD_CHROME_PATH` environment
|
|
219
|
+
variable.
|
|
220
|
+
|
|
221
|
+
This is also required if Google Chrome is not installed in its
|
|
188
222
|
[default location](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver).
|
|
189
223
|
|
|
190
|
-
|
|
224
|
+
#### Chrome on Heroku
|
|
225
|
+
|
|
226
|
+
Follow the specific instructions [here](https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome) if you're using `heroku-buildpack-google-chrome`.
|
|
227
|
+
|
|
228
|
+
#### Microsoft Edge (Chromium)
|
|
229
|
+
|
|
230
|
+
Microsoft Edge (Chromium) support was added in v4.1.0. Notes
|
|
231
|
+
from the [Chrome/Chromium](https://github.com/titusfortner/webdrivers#chromechromium)
|
|
232
|
+
section apply to this browser as well.
|
|
233
|
+
|
|
234
|
+
Please note that `msedgedriver` requires `selenium-webdriver` v4.
|
|
235
|
+
|
|
236
|
+
#### WSLv1 support
|
|
237
|
+
|
|
238
|
+
While WSLv1 is not designed to run headful applications like Chrome, it can run exes; as such when found to be running
|
|
239
|
+
in WSL, `webdrivers` will use Chrome on the Windows filesystem.
|
|
240
|
+
|
|
241
|
+
It's recommended that you install the new PowerShell (PS7) to avoid [a known issue](https://github.com/microsoft/terminal/issues/367)
|
|
242
|
+
with the console font being changed when calling the old PowerShell (PS5).
|
|
243
|
+
|
|
244
|
+
#### WSLv2 support
|
|
191
245
|
|
|
192
|
-
|
|
246
|
+
Webdrivers will detect WSLv2 as running on Linux and use Chrome on the Linux filesystem.
|
|
193
247
|
|
|
194
|
-
|
|
248
|
+
WSLv2 doesn't support connecting to host ports out of the box, so it isn't possible to connect to Chromedriver on
|
|
249
|
+
Windows without extra configurations, see: https://github.com/microsoft/WSL/issues/4619. The simplest way to use
|
|
250
|
+
Chromedriver with WSLv2 is to run Chrome headless on Linux.
|
|
195
251
|
|
|
196
|
-
|
|
197
|
-
unreliable. To use Microsoft Edge, please visit the [Downloads and Installation page](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/#downloads).
|
|
252
|
+
#### Chrome and Edge on Apple M1 (`arm64`)
|
|
198
253
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
[here](https://developer.microsoft.com/en-us/microsoft-edge/).
|
|
254
|
+
If you're switching from Intel to M1, you'll have to manually delete the existing Intel (`mac64`) driver before the
|
|
255
|
+
M1 (`arm64`) build can be downloaded. Otherwise, you'll get an error: `Bad CPU type in executable - ~/.webdrivers/chromedriver (Errno::E086)`
|
|
202
256
|
|
|
203
257
|
## Wiki
|
|
204
258
|
|
|
205
|
-
Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
|
|
259
|
+
Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
|
|
206
260
|
for solutions to commonly reported issues.
|
|
207
261
|
|
|
208
262
|
Join us in the `#webdrivers-gem` channel on [Slack](https://seleniumhq.herokuapp.com/)
|
|
@@ -215,5 +269,5 @@ see LICENSE.txt for full details and copyright.
|
|
|
215
269
|
|
|
216
270
|
## Contributing
|
|
217
271
|
|
|
218
|
-
Bug reports and pull requests are welcome [on GitHub](https://github.com/titusfortner/webdrivers).
|
|
272
|
+
Bug reports and pull requests are welcome [on GitHub](https://github.com/titusfortner/webdrivers).
|
|
219
273
|
Run `bundle exec rake` and squash the commits in your PRs.
|
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Webdrivers
|
|
4
|
+
#
|
|
5
|
+
# @api private
|
|
6
|
+
#
|
|
4
7
|
class ChromeFinder
|
|
5
8
|
class << self
|
|
6
9
|
def version
|
|
7
|
-
location = Selenium::WebDriver::Chrome.path || send("#{System.platform}_location")
|
|
8
10
|
version = send("#{System.platform}_version", location)
|
|
9
|
-
|
|
10
|
-
raise VersionError, 'Failed to find Chrome binary or its version.' if version.nil? || version.empty?
|
|
11
|
+
raise VersionError, 'Failed to determine Chrome version.' if version.nil? || version.empty?
|
|
11
12
|
|
|
12
13
|
Webdrivers.logger.debug "Browser version: #{version}"
|
|
13
14
|
version[/\d+\.\d+\.\d+\.\d+/] # Google Chrome 73.0.3683.75 -> 73.0.3683.75
|
|
14
15
|
end
|
|
15
16
|
|
|
16
|
-
def
|
|
17
|
-
|
|
17
|
+
def location
|
|
18
|
+
chrome_bin = user_defined_location || send("#{System.platform}_location")
|
|
19
|
+
return chrome_bin unless chrome_bin.nil?
|
|
20
|
+
|
|
21
|
+
raise BrowserNotFound, 'Failed to determine Chrome binary location.'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def user_defined_location
|
|
27
|
+
if Selenium::WebDriver::Chrome.path
|
|
28
|
+
Webdrivers.logger.debug "Selenium::WebDriver::Chrome.path: #{Selenium::WebDriver::Chrome.path}"
|
|
29
|
+
return Selenium::WebDriver::Chrome.path
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
return if ENV['WD_CHROME_PATH'].nil?
|
|
18
33
|
|
|
34
|
+
Webdrivers.logger.debug "WD_CHROME_PATH: #{ENV['WD_CHROME_PATH']}"
|
|
35
|
+
ENV['WD_CHROME_PATH']
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def win_location
|
|
19
39
|
envs = %w[LOCALAPPDATA PROGRAMFILES PROGRAMFILES(X86)]
|
|
20
40
|
directories = ['\\Google\\Chrome\\Application', '\\Chromium\\Application']
|
|
21
41
|
file = 'chrome.exe'
|
|
@@ -26,6 +46,30 @@ module Webdrivers
|
|
|
26
46
|
return option if File.exist?(option)
|
|
27
47
|
end
|
|
28
48
|
end
|
|
49
|
+
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
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
|
|
29
73
|
end
|
|
30
74
|
|
|
31
75
|
def mac_location
|
|
@@ -39,10 +83,24 @@ module Webdrivers
|
|
|
39
83
|
return option if File.exist?(option)
|
|
40
84
|
end
|
|
41
85
|
end
|
|
86
|
+
|
|
87
|
+
nil
|
|
42
88
|
end
|
|
43
89
|
|
|
44
90
|
def linux_location
|
|
45
|
-
|
|
91
|
+
return wsl_location if System.wsl_v1?
|
|
92
|
+
|
|
93
|
+
directories = %w[
|
|
94
|
+
/usr/local/sbin
|
|
95
|
+
/usr/local/bin
|
|
96
|
+
/usr/sbin
|
|
97
|
+
/usr/bin
|
|
98
|
+
/sbin
|
|
99
|
+
/bin
|
|
100
|
+
/snap/bin
|
|
101
|
+
/opt/google/chrome
|
|
102
|
+
/opt/chromium.org/chromium
|
|
103
|
+
]
|
|
46
104
|
files = %w[google-chrome chrome chromium chromium-browser]
|
|
47
105
|
|
|
48
106
|
directories.each do |dir|
|
|
@@ -51,18 +109,28 @@ module Webdrivers
|
|
|
51
109
|
return option if File.exist?(option)
|
|
52
110
|
end
|
|
53
111
|
end
|
|
112
|
+
|
|
113
|
+
nil
|
|
54
114
|
end
|
|
55
115
|
|
|
56
116
|
def win_version(location)
|
|
57
|
-
System.call("
|
|
117
|
+
System.call("pwsh.exe -command \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
|
|
118
|
+
rescue StandardError
|
|
119
|
+
System.call("powershell.exe \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def wsl_version(location)
|
|
123
|
+
win_version(System.to_win32_path(location))
|
|
58
124
|
end
|
|
59
125
|
|
|
60
126
|
def linux_version(location)
|
|
61
|
-
|
|
127
|
+
return wsl_version(location) if System.wsl_v1?
|
|
128
|
+
|
|
129
|
+
System.call(location, '--product-version')&.strip
|
|
62
130
|
end
|
|
63
131
|
|
|
64
132
|
def mac_version(location)
|
|
65
|
-
System.call(
|
|
133
|
+
System.call(location, '--version')&.strip
|
|
66
134
|
end
|
|
67
135
|
end
|
|
68
136
|
end
|
|
@@ -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)
|
|
@@ -42,9 +47,10 @@ module Webdrivers
|
|
|
42
47
|
# Returns currently installed Chrome/Chromium version.
|
|
43
48
|
#
|
|
44
49
|
# @return [Gem::Version]
|
|
45
|
-
def
|
|
50
|
+
def browser_version
|
|
46
51
|
normalize_version ChromeFinder.version
|
|
47
52
|
end
|
|
53
|
+
alias chrome_version browser_version
|
|
48
54
|
|
|
49
55
|
#
|
|
50
56
|
# Returns url with domain for calls to get this driver.
|
|
@@ -67,64 +73,84 @@ module Webdrivers
|
|
|
67
73
|
else
|
|
68
74
|
msg
|
|
69
75
|
end
|
|
70
|
-
|
|
71
|
-
|
|
76
|
+
rescue NetworkError
|
|
77
|
+
"#{msg} A network issue is preventing determination of latest chromedriver release."
|
|
72
78
|
end
|
|
73
79
|
|
|
74
80
|
msg = "#{msg} Please set `Webdrivers::Chromedriver.required_version = <desired driver version>` "\
|
|
75
|
-
'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
|
|
76
|
-
|
|
81
|
+
'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
|
|
77
82
|
Webdrivers.logger.debug msg
|
|
78
83
|
raise VersionError, msg
|
|
79
84
|
end
|
|
80
85
|
|
|
81
86
|
def file_name
|
|
82
|
-
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
|
|
83
98
|
end
|
|
84
99
|
|
|
85
|
-
def
|
|
86
|
-
|
|
100
|
+
def apple_filename(driver_version)
|
|
101
|
+
if apple_m1_compatible?(driver_version)
|
|
102
|
+
driver_version >= normalize_version('106.0.5249.61') ? 'mac_arm64' : 'mac64_m1'
|
|
103
|
+
else
|
|
104
|
+
'mac64'
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def direct_url(driver_version)
|
|
109
|
+
"#{base_url}/#{driver_version}/chromedriver_#{driver_filename(driver_version)}.zip"
|
|
110
|
+
end
|
|
87
111
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
112
|
+
def driver_filename(driver_version)
|
|
113
|
+
if System.platform == 'win' || System.wsl_v1?
|
|
114
|
+
'win32'
|
|
115
|
+
elsif System.platform == 'linux'
|
|
116
|
+
'linux64'
|
|
117
|
+
elsif System.platform == 'mac'
|
|
118
|
+
apple_filename(driver_version)
|
|
119
|
+
else
|
|
120
|
+
raise 'Failed to determine driver filename to download for your OS.'
|
|
121
|
+
end
|
|
122
|
+
end
|
|
93
123
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
124
|
+
# Returns major.minor.build version from the currently installed chromedriver version
|
|
125
|
+
#
|
|
126
|
+
# @example
|
|
127
|
+
# 73.0.3683.68 (major.minor.build.patch) -> 73.0.3683 (major.minor.build)
|
|
128
|
+
def current_build_version
|
|
129
|
+
build_ver = if current_version.nil? # Driver not found
|
|
130
|
+
nil
|
|
131
|
+
else
|
|
132
|
+
current_version.segments[0..2].join('.')
|
|
133
|
+
end
|
|
134
|
+
normalize_version(build_ver)
|
|
98
135
|
end
|
|
99
136
|
|
|
100
|
-
# Returns
|
|
137
|
+
# Returns major.minor.build version from the currently installed Chrome version
|
|
101
138
|
#
|
|
102
139
|
# @example
|
|
103
|
-
# 73.0.3683.75 -> 73.0.3683
|
|
104
|
-
def
|
|
105
|
-
|
|
106
|
-
normalize_version(chrome.segments[0..2].join('.'))
|
|
140
|
+
# 73.0.3683.75 (major.minor.build.patch) -> 73.0.3683 (major.minor.build)
|
|
141
|
+
def browser_build_version
|
|
142
|
+
normalize_version(browser_version.segments[0..2].join('.'))
|
|
107
143
|
end
|
|
144
|
+
alias chrome_build_version browser_build_version
|
|
108
145
|
|
|
146
|
+
# Returns true if an executable driver binary exists
|
|
147
|
+
# and its build version matches the browser build version
|
|
109
148
|
def sufficient_binary?
|
|
110
149
|
super && current_version && (current_version < normalize_version('70.0.3538') ||
|
|
111
|
-
|
|
150
|
+
current_build_version == browser_build_version)
|
|
112
151
|
end
|
|
113
152
|
end
|
|
114
153
|
end
|
|
115
154
|
end
|
|
116
155
|
|
|
117
|
-
|
|
118
|
-
::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
|
|
119
|
-
else
|
|
120
|
-
# v3.141.0 and lower
|
|
121
|
-
module Selenium
|
|
122
|
-
module WebDriver
|
|
123
|
-
module Chrome
|
|
124
|
-
def self.driver_path
|
|
125
|
-
@driver_path ||= Webdrivers::Chromedriver.update
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
end
|
|
156
|
+
::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
|