webdrivers 4.0.1 → 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 +94 -1
- data/LICENSE.txt +23 -23
- data/README.md +86 -45
- data/lib/webdrivers/chrome_finder.rb +78 -16
- data/lib/webdrivers/chromedriver.rb +65 -39
- data/lib/webdrivers/common.rb +27 -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 +56 -19
- 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 +32 -16
- data/spec/webdrivers/edge_finder_spec.rb +52 -0
- data/spec/webdrivers/edgedriver_spec.rb +273 -0
- data/spec/webdrivers/geckodriver_spec.rb +43 -10
- data/spec/webdrivers/i_edriver_spec.rb +16 -12
- data/spec/webdrivers/system_spec.rb +79 -0
- data/spec/webdrivers/webdrivers_spec.rb +24 -18
- metadata +51 -31
- data/.github/ISSUE_TEMPLATE.md +0 -14
- data/.gitignore +0 -7
- data/.rubocop.yml +0 -47
- data/.travis.yml +0 -24
- data/Gemfile +0 -6
- data/Rakefile +0 -11
- data/appveyor.yml +0 -41
- data/support/install_jruby.ps1 +0 -7
- 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,5 +1,98 @@
|
|
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
|
+
|
1
94
|
### 4.0.1 (2019-06-12)
|
2
|
-
* 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) (issue [#132](https://github.com/titusfortner/webdrivers/issues/132))
|
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))
|
3
96
|
* Properly escape Chrome binary path when using JRuby on Windows (issue [#130](https://github.com/titusfortner/webdrivers/issues/130))
|
4
97
|
* Allow use of `selenium-webdriver` v4 (pre-releases only)
|
5
98
|
|
data/LICENSE.txt
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
(The MIT License)
|
2
|
-
|
3
|
-
Copyright (c) 2017-2019: Titus Fortner
|
4
|
-
Copyright (c) 2019: Lakshya Kapoor, Thomas Walpole
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
-
a copy of this software and associated documentation files (the
|
8
|
-
'Software'), to deal in the Software without restriction, including
|
9
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
-
permit persons to whom the Software is furnished to do so, subject to
|
12
|
-
the following conditions:
|
13
|
-
|
14
|
-
The above copyright notice and this permission notice shall be
|
15
|
-
included in all copies or substantial portions of the Software.
|
16
|
-
|
17
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2017-2019: Titus Fortner
|
4
|
+
Copyright (c) 2019: Lakshya Kapoor, Thomas Walpole
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
'Software'), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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
|
@@ -86,15 +92,14 @@ 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
|
90
|
-
**Only set one to avoid confusion**.
|
95
|
+
variable. **Only set one to avoid confusion**.
|
91
96
|
|
92
|
-
##### Special exception for chromedriver
|
97
|
+
##### Special exception for chromedriver and msedgedriver
|
93
98
|
|
94
|
-
Cache time will be respected as long as a
|
95
|
-
|
96
|
-
still at
|
97
|
-
using a compatible version.
|
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.
|
98
103
|
|
99
104
|
### Proxy
|
100
105
|
|
@@ -113,7 +118,7 @@ end
|
|
113
118
|
### `SSL_connect` errors
|
114
119
|
|
115
120
|
If you are getting an error like this (especially common on Windows):
|
116
|
-
|
121
|
+
|
117
122
|
`SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed`
|
118
123
|
|
119
124
|
Add the following to your Gemfile:
|
@@ -133,15 +138,34 @@ Other solutions are documented on the RubyGems [website](https://guides.rubygems
|
|
133
138
|
### Rake tasks
|
134
139
|
|
135
140
|
Each driver has its own set of `rake` tasks (with `Railtie` support) that
|
136
|
-
you can call once before executing the tests.
|
137
|
-
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
|
138
143
|
an update check per thread.
|
139
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
|
+
|
140
161
|
```bash
|
141
162
|
$ bundle exec rake -T
|
142
163
|
rake webdrivers:chromedriver:remove # Force remove chromedriver
|
143
164
|
rake webdrivers:chromedriver:update[version] # Remove and download updated chromedriver if necessary
|
144
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
|
145
169
|
rake webdrivers:geckodriver:remove # Force remove geckodriver
|
146
170
|
rake webdrivers:geckodriver:update[version] # Remove and download updated geckodriver if necessary
|
147
171
|
rake webdrivers:geckodriver:version # Print current geckodriver version
|
@@ -150,15 +174,9 @@ rake webdrivers:iedriver:update[version] # Remove and download updated IEDr
|
|
150
174
|
rake webdrivers:iedriver:version # Print current IEDriverServer version
|
151
175
|
```
|
152
176
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
require 'webdrivers'
|
157
|
-
load 'webdrivers/Rakefile'
|
158
|
-
```
|
159
|
-
|
160
|
-
These tasks respect the `WD_INSTALL_DIR` and `WD_CACHE_TIME` environment
|
161
|
-
variables which can also be passed through the `rake` command:
|
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:
|
162
180
|
|
163
181
|
```bash
|
164
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'
|
@@ -178,44 +196,67 @@ The logging level can be configured for debugging purpose:
|
|
178
196
|
Webdrivers.logger.level = :DEBUG
|
179
197
|
```
|
180
198
|
|
181
|
-
### Browser Specific Notes
|
199
|
+
### Browser & OS Specific Notes
|
182
200
|
|
183
201
|
#### Chrome/Chromium
|
184
202
|
|
185
203
|
The version of `chromedriver` will depend on the version of Chrome you are using it with:
|
186
204
|
|
187
|
-
* 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.
|
188
206
|
More information [here](http://chromedriver.chromium.org/downloads/version-selection).
|
189
207
|
* For versions <= 69, `chromedriver` version 2.41 will be downloaded.
|
190
|
-
* 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`
|
191
209
|
using `Webdrivers::Chromedriver.required_version`.
|
192
|
-
|
193
|
-
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.
|
194
212
|
You can override this behavior by providing a path to the browser binary you want to use:
|
195
213
|
|
196
214
|
```ruby
|
197
215
|
Selenium::WebDriver::Chrome.path = '/chromium/install/path/to/binary'
|
198
216
|
```
|
199
217
|
|
200
|
-
|
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
|
201
222
|
[default location](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver).
|
202
223
|
|
203
|
-
|
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
|
204
245
|
|
205
|
-
|
246
|
+
Webdrivers will detect WSLv2 as running on Linux and use Chrome on the Linux filesystem.
|
206
247
|
|
207
|
-
|
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.
|
208
251
|
|
209
|
-
|
210
|
-
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`)
|
211
253
|
|
212
|
-
|
213
|
-
|
214
|
-
[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)`
|
215
256
|
|
216
257
|
## Wiki
|
217
258
|
|
218
|
-
Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
|
259
|
+
Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
|
219
260
|
for solutions to commonly reported issues.
|
220
261
|
|
221
262
|
Join us in the `#webdrivers-gem` channel on [Slack](https://seleniumhq.herokuapp.com/)
|
@@ -228,5 +269,5 @@ see LICENSE.txt for full details and copyright.
|
|
228
269
|
|
229
270
|
## Contributing
|
230
271
|
|
231
|
-
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).
|
232
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
|
18
31
|
|
32
|
+
return if ENV['WD_CHROME_PATH'].nil?
|
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'
|
@@ -23,15 +43,33 @@ module Webdrivers
|
|
23
43
|
directories.each do |dir|
|
24
44
|
envs.each do |root|
|
25
45
|
option = "#{ENV[root]}\\#{dir}\\#{file}"
|
26
|
-
|
46
|
+
return option if File.exist?(option)
|
47
|
+
end
|
48
|
+
end
|
27
49
|
|
28
|
-
|
29
|
-
|
30
|
-
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def wsl_location
|
54
|
+
_, drive, user = ENV['PATH'].match(%r{/([a-z])/Users/([^/:]+)/AppData/}).to_a
|
31
55
|
|
32
|
-
|
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)
|
33
69
|
end
|
34
70
|
end
|
71
|
+
|
72
|
+
nil
|
35
73
|
end
|
36
74
|
|
37
75
|
def mac_location
|
@@ -42,33 +80,57 @@ module Webdrivers
|
|
42
80
|
directories.each do |dir|
|
43
81
|
files.each do |file|
|
44
82
|
option = "#{dir}/#{file}"
|
45
|
-
return
|
83
|
+
return option if File.exist?(option)
|
46
84
|
end
|
47
85
|
end
|
86
|
+
|
87
|
+
nil
|
48
88
|
end
|
49
89
|
|
50
90
|
def linux_location
|
51
|
-
|
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
|
+
]
|
52
104
|
files = %w[google-chrome chrome chromium chromium-browser]
|
53
105
|
|
54
106
|
directories.each do |dir|
|
55
107
|
files.each do |file|
|
56
108
|
option = "#{dir}/#{file}"
|
57
|
-
return
|
109
|
+
return option if File.exist?(option)
|
58
110
|
end
|
59
111
|
end
|
112
|
+
|
113
|
+
nil
|
60
114
|
end
|
61
115
|
|
62
116
|
def win_version(location)
|
63
|
-
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))
|
64
124
|
end
|
65
125
|
|
66
126
|
def linux_version(location)
|
67
|
-
|
127
|
+
return wsl_version(location) if System.wsl_v1?
|
128
|
+
|
129
|
+
System.call(location, '--product-version')&.strip
|
68
130
|
end
|
69
131
|
|
70
132
|
def mac_version(location)
|
71
|
-
System.call(
|
133
|
+
System.call(location, '--version')&.strip
|
72
134
|
end
|
73
135
|
end
|
74
136
|
end
|