webdrivers 2.3.2 → 4.7.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.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +204 -56
  3. data/LICENSE.txt +2 -2
  4. data/README.md +253 -17
  5. data/lib/webdrivers/Rakefile +6 -0
  6. data/lib/webdrivers/chrome_finder.rb +127 -0
  7. data/lib/webdrivers/chromedriver.rb +131 -23
  8. data/lib/webdrivers/common.rb +145 -70
  9. data/lib/webdrivers/edge_finder.rb +99 -0
  10. data/lib/webdrivers/edgedriver.rb +87 -17
  11. data/lib/webdrivers/geckodriver.rb +46 -25
  12. data/lib/webdrivers/iedriver.rb +51 -18
  13. data/lib/webdrivers/logger.rb +111 -0
  14. data/lib/webdrivers/network.rb +63 -0
  15. data/lib/webdrivers/railtie.rb +15 -0
  16. data/lib/webdrivers/system.rb +197 -0
  17. data/lib/webdrivers/tasks/chromedriver.rake +44 -0
  18. data/lib/webdrivers/tasks/edgedriver.rake +44 -0
  19. data/lib/webdrivers/tasks/geckodriver.rake +44 -0
  20. data/lib/webdrivers/tasks/iedriver.rake +44 -0
  21. data/lib/webdrivers/version.rb +5 -0
  22. data/lib/webdrivers.rb +7 -9
  23. data/spec/spec_helper.rb +18 -2
  24. data/spec/webdrivers/chrome_finder_spec.rb +103 -0
  25. data/spec/webdrivers/chromedriver_spec.rb +276 -0
  26. data/spec/webdrivers/edge_finder_spec.rb +58 -0
  27. data/spec/webdrivers/edgedriver_spec.rb +279 -0
  28. data/spec/webdrivers/geckodriver_spec.rb +211 -0
  29. data/spec/webdrivers/i_edriver_spec.rb +197 -0
  30. data/spec/webdrivers/system_spec.rb +79 -0
  31. data/spec/webdrivers/webdrivers_spec.rb +80 -0
  32. data/spec/webdrivers_proxy_support_spec.rb +53 -0
  33. metadata +157 -43
  34. data/.gitignore +0 -6
  35. data/.travis.yml +0 -3
  36. data/Gemfile +0 -4
  37. data/Rakefile +0 -6
  38. data/bin/IEDriverServer +0 -5
  39. data/bin/MicrosoftWebDriver +0 -5
  40. data/bin/chromedriver +0 -5
  41. data/bin/geckodriver +0 -5
  42. data/bin/phantomjs +0 -5
  43. data/lib/webdrivers/phantomjs.rb +0 -40
  44. data/spec/chromedriver_spec.rb +0 -36
  45. data/spec/edgedriver_spec.rb +0 -24
  46. data/spec/geckodriver_spec.rb +0 -36
  47. data/spec/iedriver_spec.rb +0 -27
  48. data/spec/phantomjs_spec.rb +0 -36
  49. data/webdrivers.gemspec +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: be63f40b8706535bc265158e0f481b2620886679
4
- data.tar.gz: 7f6f4c8584e86f1f7826ffaf24c596bcaa8e6f5d
2
+ SHA256:
3
+ metadata.gz: 124d154092dc8915735f459f0476c7700e47300bec986e9b88ba214b2db8b92c
4
+ data.tar.gz: 9db15712e5227ef9b92db34a7d1714ba9613ca2bd30563b85cf5dbeee5322063
5
5
  SHA512:
6
- metadata.gz: bda8a2749978eda9c85b2e2f7373844f8a45764f4803cfa64211cae6b0e14c0d80fcfb9fa8055b89089a84ace9c0822055947845242a196e7dac0a0079b312af
7
- data.tar.gz: 9b7be7499c0807a35ddca73705d275dcd062427450b6bd3001f53030d4b6f8d3123e0c5e86a174aedd0a1f9bc5c02928db5da1813cf0bf6f371bdc85590dde2c
6
+ metadata.gz: 727a676f6b025291ecc30fff84b16159820607f4dba0c1216b3c1487f56b5bb4da8679b69b464a5234dc78d872da4b63112b11d60efd3fbb72cfbaf61ea57223
7
+ data.tar.gz: 744f5a8173676d02b2f94ff3eda885ec77d47a4e2e04cbfaa04876262e500e906313f6280d0a12e93274ba7f558886a035879d72b0264903fc695c2139b4ca83
data/CHANGELOG.md CHANGED
@@ -1,106 +1,254 @@
1
- Changelog
2
- ==========
1
+ # 4.7.0 (2021-10-14)
2
+ * Add support for Selenium 4.x #218 (thanks yahonda )
3
+ * Allow Edge on Linux
4
+ * Update required Selenium > 3.141 because of a change in 4.6
5
+ * Require Selenium 2.6+
6
+ * Fix IE downloads with the change in location of assets
7
+
8
+ # 4.6.1 (2021-08-19)
9
+ * Fix bug in IEdriver caused by bad formatting in recent release
10
+
11
+ # 4.6.0 (2021-02-26)
12
+ * Update `Edgedriver` naming to support Selenium 4 beta (([#206](https://github.com/titusfortner/webdrivers/pull/206))
13
+
14
+ # 4.5.0 (2021-01-19)
15
+ * Improve format of README usage section. Thanks, [okuramasafumi](https://github.com/okuramasafumi)!
16
+ * `chromedriver` - Add support for Apple M1 specific builds ([#193](https://github.com/titusfortner/webdrivers/pull/193)). Thanks, [MichaelHoste](https://github.com/MichaelHoste)!
17
+ * `msedgedriver` - Add support for Apple M1 specific builds.
18
+ * `msedgedriver` - Added automatic selection of 32-bit vs 64-bit builds on Windows and WSLv1.
19
+ * When using this gem in WSLv2, Chrome installed on the Linux filesystem will be automatically used ([#196](https://github.com/titusfortner/webdrivers/pull/196)).
20
+ WSLv1 continues to automatically use Chrome from the Windows filesystem though. Thanks, [fabioxgn](https://github.com/fabioxgn)!
21
+ * We'll aim to make the behavior consistent in a future release.
22
+
23
+ ### 4.4.2 (2020-12-29)
24
+ * Use new powershell if available to enhance WSL support ([#176](https://github.com/titusfortner/webdrivers/issues/176),
25
+ [#186](https://github.com/titusfortner/webdrivers/pull/186)). Thanks, [G-Rath](https://github.com/G-Rath) and
26
+ [131](https://github.com/131)!
27
+ * Update rubocop version (development dependency only) ([#178](https://github.com/titusfortner/webdrivers/pull/178)).
28
+ Thanks, [utkarsh2102](https://github.com/utkarsh2102)!
29
+ * Replace `git ls-files` with `dir` in the gemspec for better Debian support ([#179](https://github.com/titusfortner/webdrivers/pull/179),
30
+ [#184](https://github.com/titusfortner/webdrivers/issues/184)).
31
+ Thanks again, [utkarsh2102](https://github.com/utkarsh2102)!
32
+ * Update README with `require: false` when adding gem to Gemfile ([#183](https://github.com/titusfortner/webdrivers/pull/183)).
33
+ * Make WSL detection more generic ([#187](https://github.com/titusfortner/webdrivers/pull/187)).
34
+ [rbclark](https://github.com/rbclark)!
35
+
36
+ ### 4.4.1 (2020-06-01)
37
+ * Do not include binstubs used for troubleshooting only. Fixes [#174](https://github.com/titusfortner/webdrivers/issues/174).
38
+
39
+ ### 4.4.0 (2020-05-31)
40
+ * Implement support for `chromedriver` in Windows Subsystem for Linux (WSL) v1 ([#172](https://github.com/titusfortner/webdrivers/issues/172)).
41
+ Thanks, [G-Rath](https://github.com/G-Rath)!
42
+ * Chrome/Edgedriver - Fix [#171](https://github.com/titusfortner/webdrivers/issues/171) by making sure the cached
43
+ driver build version matches the browser build version before using it.
44
+ * Chrome/Edgedriver - Driver version check now matches the driver and browser `major.minor.build` versions instead of just
45
+ the major version to be fully compliant with the `chromedriver` version selection
46
+ [document](https://chromedriver.chromium.org/downloads/version-selection).
47
+
48
+ ### 4.3.0 (2020-04-14)
49
+ * Add support for Microsoft Edge (Chromium) stable
50
+ * Drop support for Ruby < 2.4.0
51
+
52
+ ### 4.2.0 (2019-12-27)
53
+ * Add support for Microsoft Edge (Chromium) Beta releases ([#155](https://github.com/titusfortner/webdrivers/pull/155))
54
+ * Use tilde expansion to resolve user's home directory ([#166](https://github.com/titusfortner/webdrivers/pull/161))
55
+ * Add support for Chromium installed using Snap on Ubuntu ([#163](https://github.com/titusfortner/webdrivers/pull/163)). Thanks Tietew!
56
+
57
+ ### 4.1.3 (2019-10-07)
58
+ * 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))
59
+ * Fix a bug where the file deletion confirmation was printed even when there were no files to delete.
60
+
61
+ ### 4.1.2 (2019-07-29)
62
+ * Fix a bug related to raising `BrowserNotFound`.
63
+
64
+ ### 4.1.1 (2019-07-18)
65
+ * Raise `BrowserNotFound` if Chrome and Edge binary are not found (issue [#144](https://github.com/titusfortner/webdrivers/issues/144)).
66
+
67
+ ### 4.1.0 (2019-07-03)
68
+ * Add support for `msedgedriver` (issue [#93](https://github.com/titusfortner/webdrivers/issues/93))
69
+ * Allow users to provide a custom binary path via `WD_CHROME_PATH`
70
+ and `WD_EDGE_CHROME_ATH` environment variables (issues #[137](https://github.com/titusfortner/webdrivers/issues/137)
71
+ and [#93](https://github.com/titusfortner/webdrivers/issues/93))
72
+ * Fix a bug where the user given Chrome binary path via `Selenium::WebDriver::Chrome.path`
73
+ was not properly escaped (issue [#139](https://github.com/titusfortner/webdrivers/issues/139))
74
+ * Fix miscellaneous code warnings.
75
+ * ~~**Announcement**: As of 06/21/2019, `heroku-buildpack-google-chrome`
76
+ no longer requires a [workaround](https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome)
77
+ to work with this gem. See [heroku-buildpack-google-chrome#73](https://github.com/heroku/heroku-buildpack-google-chrome/pull/73)
78
+ for more information.~~
79
+
80
+ ### 4.0.1 (2019-06-12)
81
+ * 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))
82
+ * Properly escape Chrome binary path when using JRuby on Windows (issue [#130](https://github.com/titusfortner/webdrivers/issues/130))
83
+ * Allow use of `selenium-webdriver` v4 (pre-releases only)
84
+
85
+ ### 4.0.0 (2019-05-28)
86
+
87
+ No changes since rc2. Please report any issues [here](https://github.com/titusfortner/webdrivers/issues)
88
+ or join us in the `#webdrivers-gem` channel on [Slack](https://seleniumhq.herokuapp.com/) if you
89
+ have questions.
90
+
91
+ ### 4.0.0.rc2 (2019-05-21)
92
+ * Fix a bug with `WD_CACHE_TIME` when using the rake tasks (issue [#123](https://github.com/titusfortner/webdrivers/pull/123))
93
+
94
+ ### 4.0.0.rc1 (2019-05-20)
95
+ * Locate Chrome binary the same way as chromedriver to ensure the correct browser version is
96
+ obtained by default (issue [#45](https://github.com/titusfortner/webdrivers/issues/45))
97
+ * Add rake tasks for update, remove and version
98
+ (issues [#28](https://github.com/titusfortner/webdrivers/issues/28)
99
+ [#77](https://github.com/titusfortner/webdrivers/issues/77))
100
+ * Removed all deprecated code
101
+
102
+ ### 3.9.4 (2019-05-20)
103
+ * Fix bug from bug fix that warned users about setting cache time when it was already set (issue [#118](https://github.com/titusfortner/webdrivers/pull/118))
104
+ * Make #base_url public for easier mocking (issue [#109](https://github.com/titusfortner/webdrivers/issues/109))
3
105
 
4
- 2.3.2 - 2016-11-26
5
- ----------
106
+ ### 3.9.3 (2019-05-17)
107
+ * Fix the bug that warned users about setting cache time when it was already set
108
+ ([#118](https://github.com/titusfortner/webdrivers/pull/118), thanks Eduardo Gutierrez)
6
109
 
7
- * Bug fixes for Windows
110
+ ### 3.9.2 (2019-05-14)
111
+ * Allow webdrivers to handle network mocking ([#116](https://github.com/titusfortner/webdrivers/pull/116))
112
+ * Fix a Windows specific bug when decompressing the driver packages
113
+ ([#114](https://github.com/titusfortner/webdrivers/pull/114))
8
114
 
115
+ ### 3.9.1 (2019-05-09)
116
+ * Fix bug throwing nil warnings (issue #107)
117
+ * Fix bug preventing running on older versions of Selenium
9
118
 
10
- 2.3.1 - 2016-11-26
11
- ----------
119
+ ### 3.9.0 (2019-05-07)
120
+ * Make public methods more obvious and deprecate unnecessary methods (issue #36)
121
+ * Allow geckodriver binaries to be downloaded directly (issue #30)
122
+ * Allow drivers to be cached to reduce unnecessary network calls (issue #29)
123
+ * MSWebdriver class is removed as no longer supported
124
+ * Refactored to minimize network calls (issue #80)
125
+ * Fix warnings about instance variables not initialized
126
+ * Add support for managing specific drivers (issue #95)
12
127
 
13
- * Bug fixes for Windows
128
+ ### 3.8.1 (2019-05-04)
129
+ * Downloads chromedriver with direct URL instead of parsing the downloads page
130
+ * Raises exception if version of Chrome does not have a known version of the driver (issue #79)
131
+ * Fixed bug warning of non-initialized variables (issue #62)
132
+ * Fixed bug with threads/processes colliding by downloading to temp files
133
+ * Fixed bug for file locking issue on Windows
14
134
 
135
+ ### 3.8.0 (2019-04-17)
136
+ * Add support for `selenium-webdriver` v4. See [#69](https://github.com/titusfortner/webdrivers/pull/69).
137
+ * Remove dependency on `net_http_ssl_fix` gem. `Webdrivers.net_http_ssl_fix` now raises an exception and
138
+ points to other solutions. See [#60](https://github.com/titusfortner/webdrivers/pull/60) and
139
+ [#68](https://github.com/titusfortner/webdrivers/pull/68) (thanks Samuel Williams & Maik Arnold).
15
140
 
16
- 2.3.0 - 2016-11-26
17
- ----------
141
+ ### 3.7.2 (2019-04-01)
142
+ * Fix bugs in methods that retrieve Chrome/Chromium version.
143
+ See [#43](https://github.com/titusfortner/webdrivers/pull/43)
144
+ and [#52](https://github.com/titusfortner/webdrivers/issues/52) (Thanks Ochko).
145
+ * Add workaround for a Jruby bug when retrieving Chrome version on Windows.
146
+ See [#41](https://github.com/titusfortner/webdrivers/issues/41).
147
+ * Update README with more information.
18
148
 
19
- * Implement IEDriver support
20
- * Implement MicrosoftWebDriver support
149
+ ### 3.7.1 (2019-03-25)
150
+ * Use `Selenium::WebDriver::Chrome#path` to check for a user given browser executable
151
+ before defaulting to Google Chrome. Addresses [#38](https://github.com/titusfortner/webdrivers/issues/38).
152
+ * Download `chromedriver` v2.46 if Chrome/Chromium version is less than 70.
21
153
 
154
+ ### 3.7.0 (2019-03-19)
22
155
 
23
- 2.2.1 - 2016-11-26
24
- ----------
156
+ * `chromedriver` version now matches the installed Chrome version.
157
+ See [#32](https://github.com/titusfortner/webdrivers/pull/32).
25
158
 
26
- * Bug fixes for Windows
159
+ ### 3.6.0 (2018-12-30)
27
160
 
161
+ * Put net_http_ssl_fix inside a toggle since it can cause other issues
28
162
 
29
- 2.2.0 - 2016-11-26
30
- ----------
163
+ ### 3.5.2 (2018-12-16)
31
164
 
32
- * Implement phantomjs support
165
+ * Use net_http_ssl_fix to address Net::HTTP issues on windows
33
166
 
167
+ ### 3.5.1 (2018-12-16)
34
168
 
35
- 2.1.1 - 2016-11-26
36
- ----------
169
+ ### 3.5.0 (2018-12-15)
37
170
 
38
- * Improve Decompression Approach
171
+ ### 3.5.0.beta1 (2018-12-15)
39
172
 
173
+ * Allow version to be specified
40
174
 
41
- 2.1.0 - 2016-11-25
42
- ----------
175
+ ### 3.4.3 (2018-10-22)
43
176
 
44
- * Implemented geckodriver support
177
+ * Fix bug with JRuby and geckodriver (thanks twalpole)
45
178
 
179
+ ### 3.4.2 (2018-10-15)
46
180
 
47
- 2.0.0 - 2016-11-25
48
- ----------
181
+ * Use chromedriver latest version
49
182
 
50
- * Renamed fork from chromedriver-helper to webdrivers
51
- * Re-implemented chromedriver usage
183
+ ### 3.4.1 (2018-09-17)
52
184
 
185
+ * Hardcode latest chromedriver version to 2.42 until we figure out chromedriver 70
53
186
 
54
- 1.0.0 - 2015-06-06
55
- ----------
187
+ ### 3.4.0 (2018-09-07)
56
188
 
57
- * Updated gemspec info. Happy 1.0!
189
+ * Allow public access to `#install_dir` and `#binary`
190
+ * Allow user to set the default download directory
191
+ * Improve version comparisons with use of `Gem::Version`
58
192
 
193
+ ### 3.3.3 (2018-08-14)
59
194
 
60
- 0.0.9 - 2015-06-06
61
- ----------
195
+ * Fix Geckodriver since Github changed its html again
62
196
 
63
- * No longer require 'curl' or 'wget', or 'unzip' utilities to be installed. You know, for Windows. (Thanks, @elementc!)
64
- * Support JRuby by removing dependency on native-C-extension gem. (Thanks, Marques Lee!)
197
+ ### 3.3.2 (2018-05-04)
65
198
 
199
+ * Fix bug with IEDriver versioning (Thanks Aleksei Gusev)
66
200
 
67
- 0.0.8 - 2015-01-23
68
- ----------
201
+ ### 3.3.1 (2018-05-04)
69
202
 
70
- * Guaranteeing that we get the *latest* version of chromedriver. (#15) (Thanks, @AlexRiedler!)
203
+ * Fix bug with MSWebdriver to fetch the correct driver instead of latest (Thanks kapoorlakshya)
71
204
 
205
+ ### 3.3.0 (2018-04-29)
72
206
 
73
- 0.0.7 - 26 Aug 2014
74
- ----------
207
+ * Ensures downloading correct MSWebdriver version (Thanks kapoorlakshya)
75
208
 
76
- * Added support for windows binaries. (Thanks, @elementc!)
209
+ ### 3.2.4 (2017-01-04)
77
210
 
211
+ * Improve error message when unable to find the latest driver
78
212
 
79
- 0.0.6 - 26 Aug 2014
80
- ----------
213
+ ### 3.2.3 (2017-12-12)
81
214
 
82
- * Fixed to work with new Google download page. #7 (Thanks, @mars!)
215
+ * Fixed bug with finding geckodriver on updated Github release pages
83
216
 
217
+ ### 3.2.2 (2017-11-20)
84
218
 
85
- 0.0.5 - 15 Aug 2012
86
- ----------
219
+ * Fixed bug in `#untargz_file` (thanks Jake Goulding)
87
220
 
88
- * Fixed support for JRuby on non-Windows platforms. #4 (Thanks, Tim Olsen!)
221
+ ### 3.2.1 (2017-09-06)
89
222
 
223
+ * Fixed Proxy support so it actually works (thanks Cheezy)
90
224
 
91
- 0.0.4 - 1 Aug 2012
92
- ----------
225
+ ### 3.2.0 (2017-08-21)
93
226
 
94
- * Including `chromedriver-update` to easily allow people to force-upgrade. #3
227
+ * Implemented Proxy support
95
228
 
229
+ ### 3.1.0 (2017-08-21)
96
230
 
97
- 0.0.3 - 20 Mar 2012
98
- ----------
231
+ * Implemented Logging functionality
99
232
 
100
- * Updated download URL. #2 (Thanks, Alistair Hutchison!)
233
+ ### 3.0.1 (2017-08-18)
101
234
 
235
+ * Create ~/.webdrivers directory if doesn't already exist
102
236
 
103
- 0.0.2 - 6 December 2011
104
- ----------
237
+ ### 3.0.0 (2017-08-17)
105
238
 
106
- * Birthday!
239
+ * Removes unnecessary downloads
240
+
241
+ ### 3.0.0.beta3 (2017-08-17)
242
+
243
+ * Supports Windows
244
+ * Supports mswebdriver and iedriver
245
+
246
+ ### 3.0.0.beta2 (2017-08-16)
247
+
248
+ * Supports geckodriver on Mac and Linux
249
+
250
+ ### 3.0.0.beta1 (2017-08-15)
251
+
252
+ * Complete Rewrite of 2.x
253
+ * Implemented with Monkey Patch not Shims
254
+ * Supports chromedriver on Mac and Linux
data/LICENSE.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2011,2012,2013,2014,2015: [Mike Dalessio](http://mike.daless.io)
4
- Copyright (c) 2016: Titus Fortner
3
+ Copyright (c) 2017-2019: Titus Fortner
4
+ Copyright (c) 2019: Lakshya Kapoor, Thomas Walpole
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining
7
7
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,37 +1,273 @@
1
1
  # Webdrivers
2
2
 
3
- [![Build status](https://api.travis-ci.org/titusfortner/webdrivers.svg)](https://travis-ci.org/titusfortner/webdrivers)
3
+ [![Gem Version](https://badge.fury.io/rb/webdrivers.svg)](https://badge.fury.io/rb/webdrivers)
4
+ ![Tests](https://github.com/titusfortner/webdrivers/workflows/Tests/badge.svg)
4
5
 
5
- Run Selenium tests more easily with install and updates for all supported webdrivers.
6
+ Run Selenium tests more easily with automatic installation and updates for all supported webdrivers.
6
7
 
7
- # Description
8
+ ## Description
8
9
 
9
- `webdrivers` installs driver executables, in your gem path.
10
- `chromedriver` and `geckodriver` are currently supported.
10
+ `webdrivers` downloads drivers and directs Selenium to use them. Currently supports:
11
11
 
12
- Drivers are stored in `~/.webdrivers` directory and used within the context of your gem path
12
+ * [chromedriver](http://chromedriver.chromium.org/)
13
+ * [geckodriver](https://github.com/mozilla/geckodriver)
14
+ * [IEDriverServer](https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
15
+ * [msedgedriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
13
16
 
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.
14
19
 
15
- # Usage
20
+ ## Usage
16
21
 
17
- `gem install webdrivers`
22
+ In your Gemfile:
18
23
 
19
- or in your Gemfile:
24
+ ```ruby
25
+ gem 'webdrivers', '~> 4.0', require: false
26
+ ```
20
27
 
21
- `gem "webdrivers", "~> 2.1"`
28
+ In your project:
22
29
 
30
+ ```ruby
31
+ require 'webdrivers'
32
+ ```
23
33
 
24
- # License
34
+ The drivers will now be automatically downloaded or updated when you launch a browser
35
+ through Selenium.
25
36
 
26
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT),
27
- see LICENSE.txt for full details and copyright.
37
+ ### Specific Drivers
28
38
 
39
+ If you want webdrivers to only manage specific drivers you can specify one or more as follows:
29
40
 
30
- # Contributing
41
+ ```ruby
42
+ require 'webdrivers/chromedriver'
43
+ require 'webdrivers/geckodriver'
44
+ require 'webdrivers/iedriver'
45
+ require 'webdrivers/edgedriver'
46
+ ```
31
47
 
32
- Bug reports and pull requests are welcome [on GitHub](https://github.com/titusfortner/webdrivers).
48
+ ### Download Location
49
+
50
+ The default download location is `~/.webdrivers` directory, and this is configurable:
51
+
52
+ ```ruby
53
+ Webdrivers.install_dir = '/webdrivers/install/dir'
54
+ ```
55
+
56
+ Alternatively, you can define the path via the `WD_INSTALL_DIR` environment
57
+ variable.
58
+
59
+ ### Version Pinning
60
+
61
+ If you would like to use a specific (older or beta) version, you can specify it for each driver. Otherwise,
62
+ the latest (stable) driver will be downloaded and passed to Selenium.
63
+
64
+ ```ruby
65
+ # Chrome
66
+ Webdrivers::Chromedriver.required_version = '2.46'
67
+
68
+ # Firefox
69
+ Webdrivers::Geckodriver.required_version = '0.23.0'
70
+
71
+ # Internet Explorer
72
+ Webdrivers::IEdriver.required_version = '3.14.0'
73
+
74
+ # Edge (Chromium)
75
+ Webdrivers::Edgedriver.required_version = '76.0.183.0'
76
+ ```
77
+
78
+ You can explicitly trigger the update in your code, but this will happen
79
+ automatically when the driver is initialized:
80
+
81
+ ```ruby
82
+ Webdrivers::Chromedriver.update
83
+ ```
84
+
85
+ ### Caching Drivers
86
+
87
+ You can set Webdrivers to only look for updates if the previous check
88
+ was longer ago than a specified number of seconds.
89
+
90
+ ```ruby
91
+ Webdrivers.cache_time = 86_400 # Default: 86,400 Seconds (24 hours)
92
+ ```
93
+
94
+ Alternatively, you can define this value via the `WD_CACHE_TIME` environment
95
+ variable. **Only set one to avoid confusion**.
96
+
97
+ ##### Special exception for chromedriver and msedgedriver
98
+
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.
103
+
104
+ ### Proxy
105
+
106
+ If there is a proxy between you and the Internet then you will need to configure
107
+ the gem to use the proxy. You can do this by calling the `configure` method.
108
+
109
+ ````ruby
110
+ Webdrivers.configure do |config|
111
+ config.proxy_addr = 'myproxy_address.com'
112
+ config.proxy_port = '8080'
113
+ config.proxy_user = 'username'
114
+ config.proxy_pass = 'password'
115
+ end
116
+ ````
117
+
118
+ ### `SSL_connect` errors
119
+
120
+ If you are getting an error like this (especially common on Windows):
121
+
122
+ `SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed`
123
+
124
+ Add the following to your Gemfile:
125
+
126
+ ```ruby
127
+ gem "net_http_ssl_fix"
128
+ ```
129
+
130
+ Add the following to your code:
131
+
132
+ ````ruby
133
+ require 'net_http_ssl_fix'
134
+ ````
135
+
136
+ Other solutions are documented on the RubyGems [website](https://guides.rubygems.org/ssl-certificate-update/).
137
+
138
+ ### Rake tasks
139
+
140
+ Each driver has its own set of `rake` tasks (with `Railtie` support) that
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
143
+ an update check per thread.
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
+ ```
33
158
 
159
+ The full list of available tasks is:
34
160
 
35
- # Credit
161
+ ```bash
162
+ $ bundle exec rake -T
163
+ rake webdrivers:chromedriver:remove # Force remove chromedriver
164
+ rake webdrivers:chromedriver:update[version] # Remove and download updated chromedriver if necessary
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
169
+ rake webdrivers:geckodriver:remove # Force remove geckodriver
170
+ rake webdrivers:geckodriver:update[version] # Remove and download updated geckodriver if necessary
171
+ rake webdrivers:geckodriver:version # Print current geckodriver version
172
+ rake webdrivers:iedriver:remove # Force remove IEDriverServer
173
+ rake webdrivers:iedriver:update[version] # Remove and download updated IEDriverServer if necessary
174
+ rake webdrivers:iedriver:version # Print current IEDriverServer version
175
+ ```
36
176
 
37
- This is a fork of [chromedriver-helper](https://github.com/flavorjones/chromedriver-helper) gem
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:
180
+
181
+ ```bash
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'
183
+ 2019-05-20 19:03:01 INFO Webdrivers Updated to chromedriver 2.46.628388
184
+ 2019-05-20 19:03:04 INFO Webdrivers Updated to geckodriver 0.24.0
185
+ ```
186
+
187
+ Please note that these tasks do not use any of the configurations from your
188
+ project (code) and only respect the `ENV` variables and the version (optional)
189
+ passed to the `rake` tasks.
190
+
191
+ ### Logging
192
+
193
+ The logging level can be configured for debugging purpose:
194
+
195
+ ```ruby
196
+ Webdrivers.logger.level = :DEBUG
197
+ ```
198
+
199
+ ### Browser & OS Specific Notes
200
+
201
+ #### Chrome/Chromium
202
+
203
+ The version of `chromedriver` will depend on the version of Chrome you are using it with:
204
+
205
+ * For versions >= 70, the downloaded version of `chromedriver` will match the installed version of Google Chrome.
206
+ More information [here](http://chromedriver.chromium.org/downloads/version-selection).
207
+ * For versions <= 69, `chromedriver` version 2.41 will be downloaded.
208
+ * For beta versions, you'll have to require the beta version of `chromedriver`
209
+ using `Webdrivers::Chromedriver.required_version`.
210
+
211
+ The gem looks for the Chrome/Chromium version that `chromedriver` will use by default.
212
+ You can override this behavior by providing a path to the browser binary you want to use:
213
+
214
+ ```ruby
215
+ Selenium::WebDriver::Chrome.path = '/chromium/install/path/to/binary'
216
+ ```
217
+
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
222
+ [default location](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver).
223
+
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
245
+
246
+ Webdrivers will detect WSLv2 as running on Linux and use Chrome on the Linux filesystem.
247
+
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.
251
+
252
+ #### Chrome and Edge on Apple M1 (`arm64`)
253
+
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)`
256
+
257
+ ## Wiki
258
+
259
+ Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
260
+ for solutions to commonly reported issues.
261
+
262
+ Join us in the `#webdrivers-gem` channel on [Slack](https://seleniumhq.herokuapp.com/)
263
+ if you have any questions.
264
+
265
+ ## License
266
+
267
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT),
268
+ see LICENSE.txt for full details and copyright.
269
+
270
+ ## Contributing
271
+
272
+ Bug reports and pull requests are welcome [on GitHub](https://github.com/titusfortner/webdrivers).
273
+ Run `bundle exec rake` and squash the commits in your PRs.
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'webdrivers'
4
+
5
+ path = File.expand_path(__dir__)
6
+ Dir.glob("#{path}/tasks/*.rake").each { |f| import f }