webdrivers 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +4 -1
- data/README.md +39 -30
- data/lib/webdrivers/chrome_finder.rb +5 -3
- data/lib/webdrivers/common.rb +3 -0
- data/lib/webdrivers/edge_finder.rb +5 -3
- data/lib/webdrivers/version.rb +1 -1
- data/spec/webdrivers/chrome_finder_spec.rb +28 -22
- data/spec/webdrivers/edge_finder_spec.rb +58 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9d16f809899161b5099baae7ca53e6d71d376083fe3cecf0278acef552605ec
|
4
|
+
data.tar.gz: 3c4dcab7d0e285716adfe50d0e78a172e9cab65202192c02726df3790d7b96b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9123c087f485c843954414de9004c137bb5a7fc1619ad4bc4fc9ec79ce5ed2433f6377994347a46bd06d96f7dd69049192c8631363608088f30159f2fae2b33b
|
7
|
+
data.tar.gz: af36c0d87ffad38e87dea124abc387e79bdc2fc5127fee456d3992e6c19f912a8943d5cdb11ec8d6600ed41f92c2fa8f3f018a2a4a34e76c1338cf5ee25b5068
|
data/.travis.yml
CHANGED
@@ -24,6 +24,7 @@ matrix:
|
|
24
24
|
- rvm: 2.4.6
|
25
25
|
env: RAKE_TASK=rubocop
|
26
26
|
- rvm: jruby-9.2.7.0
|
27
|
+
jdk: openjdk8
|
27
28
|
env: RAKE_TASK=spec
|
28
29
|
- rvm: 2.6
|
29
30
|
env: RAKE_TASK=spec
|
@@ -35,6 +36,6 @@ matrix:
|
|
35
36
|
homebrew:
|
36
37
|
taps: homebrew/cask-versions
|
37
38
|
casks:
|
38
|
-
- microsoft-edge-
|
39
|
+
- microsoft-edge-dev
|
39
40
|
allow_failures:
|
40
41
|
- gemfile: gemfiles/Gemfile.edge
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
### 4.1.
|
1
|
+
### 4.1.1 (2019-07-18)
|
2
|
+
* Raise `BrowserNotFound` if Chrome and Edge binary are not found (issue [#144](https://github.com/titusfortner/webdrivers/issues/144)).
|
3
|
+
|
4
|
+
### 4.1.0 (2019-07-03)
|
2
5
|
* Add support for `msedgedriver` (issue [#93](https://github.com/titusfortner/webdrivers/issues/93))
|
3
6
|
* Allow users to provide a custom binary path via `WD_CHROME_PATH`
|
4
7
|
and `WD_EDGE_CHROME_ATH` environment variables (issues #[137](https://github.com/titusfortner/webdrivers/issues/137)
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ Run Selenium tests more easily with automatic installation and updates for all s
|
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
20
|
-
In your Gemfile:
|
20
|
+
In your Gemfile:
|
21
21
|
|
22
22
|
`gem 'webdrivers', '~> 4.0'`
|
23
23
|
|
@@ -28,7 +28,7 @@ require 'webdrivers'
|
|
28
28
|
```
|
29
29
|
|
30
30
|
The drivers will now be automatically downloaded or updated when you launch a browser
|
31
|
-
through Selenium.
|
31
|
+
through Selenium.
|
32
32
|
|
33
33
|
### Specific Drivers
|
34
34
|
|
@@ -44,7 +44,7 @@ require 'webdrivers/edgedriver'
|
|
44
44
|
### Download Location
|
45
45
|
|
46
46
|
The default download location is `~/.webdrivers` directory, and this is configurable:
|
47
|
-
|
47
|
+
|
48
48
|
```ruby
|
49
49
|
Webdrivers.install_dir = '/webdrivers/install/dir'
|
50
50
|
```
|
@@ -54,7 +54,7 @@ variable.
|
|
54
54
|
|
55
55
|
### Version Pinning
|
56
56
|
|
57
|
-
If you would like to use a specific (older or beta) version, you can specify it for each driver. Otherwise,
|
57
|
+
If you would like to use a specific (older or beta) version, you can specify it for each driver. Otherwise,
|
58
58
|
the latest (stable) driver will be downloaded and passed to Selenium.
|
59
59
|
|
60
60
|
```ruby
|
@@ -92,9 +92,9 @@ variable. **Only set one to avoid confusion**.
|
|
92
92
|
|
93
93
|
##### Special exception for chromedriver and msedgedriver
|
94
94
|
|
95
|
-
Cache time will be respected as long as a driver binary exists and the major versions of
|
96
|
-
the browser and the driver match. For example, if you update Chrome or Edge to v76 and its driver is
|
97
|
-
still at v75, `webdrivers` will ignore the cache time and update the driver to make sure you're
|
95
|
+
Cache time will be respected as long as a driver binary exists and the major versions of
|
96
|
+
the browser and the driver match. For example, if you update Chrome or Edge to v76 and its driver is
|
97
|
+
still at v75, `webdrivers` will ignore the cache time and update the driver to make sure you're
|
98
98
|
using a compatible version.
|
99
99
|
|
100
100
|
### Proxy
|
@@ -114,7 +114,7 @@ end
|
|
114
114
|
### `SSL_connect` errors
|
115
115
|
|
116
116
|
If you are getting an error like this (especially common on Windows):
|
117
|
-
|
117
|
+
|
118
118
|
`SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed`
|
119
119
|
|
120
120
|
Add the following to your Gemfile:
|
@@ -134,10 +134,26 @@ Other solutions are documented on the RubyGems [website](https://guides.rubygems
|
|
134
134
|
### Rake tasks
|
135
135
|
|
136
136
|
Each driver has its own set of `rake` tasks (with `Railtie` support) that
|
137
|
-
you can call once before executing the tests. These are especially
|
138
|
-
useful if you're running tests in parallel and want to avoid performing
|
137
|
+
you can call once before executing the tests. These are especially
|
138
|
+
useful if you're running tests in parallel and want to avoid performing
|
139
139
|
an update check per thread.
|
140
140
|
|
141
|
+
If you are using Rails default configuration the `webdrivers` gem will only be loaded in the test group
|
142
|
+
so you will need to specify the test environment when using the tasks:
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
RAILS_ENV=test rails webdrivers:chromedriver:update
|
146
|
+
```
|
147
|
+
|
148
|
+
If you are not using Rails, you'll need to load them into your Rakefile like this:
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
require 'webdrivers'
|
152
|
+
load 'webdrivers/Rakefile'
|
153
|
+
```
|
154
|
+
|
155
|
+
The full list of available tasks is:
|
156
|
+
|
141
157
|
```bash
|
142
158
|
$ bundle exec rake -T
|
143
159
|
rake webdrivers:chromedriver:remove # Force remove chromedriver
|
@@ -154,15 +170,8 @@ rake webdrivers:iedriver:update[version] # Remove and download updated IEDr
|
|
154
170
|
rake webdrivers:iedriver:version # Print current IEDriverServer version
|
155
171
|
```
|
156
172
|
|
157
|
-
If you are not using Rails, you'll need to load them into your Rakefile like this:
|
158
|
-
|
159
|
-
```ruby
|
160
|
-
require 'webdrivers'
|
161
|
-
load 'webdrivers/Rakefile'
|
162
|
-
```
|
163
|
-
|
164
173
|
These tasks respect the `WD_INSTALL_DIR`, `WD_CACHE_TIME`, `WD_CHROME_PATH`,
|
165
|
-
and `WD_EDGE_CHROME_PATH` environment variables, which can also be passed
|
174
|
+
and `WD_EDGE_CHROME_PATH` environment variables, which can also be passed
|
166
175
|
through the `rake` command:
|
167
176
|
|
168
177
|
```bash
|
@@ -185,17 +194,17 @@ Webdrivers.logger.level = :DEBUG
|
|
185
194
|
|
186
195
|
### Browser Specific Notes
|
187
196
|
|
188
|
-
#### Chrome/Chromium
|
197
|
+
#### Chrome/Chromium
|
189
198
|
|
190
199
|
The version of `chromedriver` will depend on the version of Chrome you are using it with:
|
191
200
|
|
192
|
-
* For versions >= 70, the downloaded version of `chromedriver` will match the installed version of Google Chrome.
|
201
|
+
* For versions >= 70, the downloaded version of `chromedriver` will match the installed version of Google Chrome.
|
193
202
|
More information [here](http://chromedriver.chromium.org/downloads/version-selection).
|
194
203
|
* For versions <= 69, `chromedriver` version 2.41 will be downloaded.
|
195
|
-
* For beta versions, you'll have to require the beta version of `chromedriver`
|
204
|
+
* For beta versions, you'll have to require the beta version of `chromedriver`
|
196
205
|
using `Webdrivers::Chromedriver.required_version`.
|
197
|
-
|
198
|
-
The gem looks for the Chrome/Chromium version that `chromedriver` will use by default.
|
206
|
+
|
207
|
+
The gem looks for the Chrome/Chromium version that `chromedriver` will use by default.
|
199
208
|
You can override this behavior by providing a path to the browser binary you want to use:
|
200
209
|
|
201
210
|
```ruby
|
@@ -205,26 +214,26 @@ Selenium::WebDriver::Chrome.path = '/chromium/install/path/to/binary'
|
|
205
214
|
Alternatively, you can define the path via the `WD_CHROME_PATH` environment
|
206
215
|
variable.
|
207
216
|
|
208
|
-
This is also required if Google Chrome is not installed in its
|
217
|
+
This is also required if Google Chrome is not installed in its
|
209
218
|
[default location](https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver).
|
210
219
|
|
211
220
|
##### CircleCI Users
|
212
221
|
|
213
|
-
Follow the specific instructions [here](https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome) if your CI environment provides custom shims for Chrome or Chromium.
|
222
|
+
Follow the specific instructions [here](https://github.com/titusfortner/webdrivers/wiki/Heroku-buildpack-google-chrome) if your CI environment provides custom shims for Chrome or Chromium.
|
214
223
|
|
215
224
|
Please note that as of 06/21/2019, [`heroku-buildpack-google-chrome`](https://github.com/heroku/heroku-buildpack-google-chrome/pull/73) no longer requires this workaround.
|
216
225
|
|
217
226
|
#### Microsoft Edge (Chromium)
|
218
227
|
|
219
|
-
Microsoft Edge (Chromium) support was added in v4.1.0. Notes
|
220
|
-
from the [Chrome/Chromium](https://github.com/titusfortner/webdrivers#chromechromium)
|
228
|
+
Microsoft Edge (Chromium) support was added in v4.1.0. Notes
|
229
|
+
from the [Chrome/Chromium](https://github.com/titusfortner/webdrivers#chromechromium)
|
221
230
|
section apply to this browser as well.
|
222
|
-
|
231
|
+
|
223
232
|
Please note that `msedgedriver` requires `selenium-webdriver` v4.
|
224
233
|
|
225
234
|
## Wiki
|
226
235
|
|
227
|
-
Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
|
236
|
+
Please see the [wiki](https://github.com/titusfortner/webdrivers/wiki)
|
228
237
|
for solutions to commonly reported issues.
|
229
238
|
|
230
239
|
Join us in the `#webdrivers-gem` channel on [Slack](https://seleniumhq.herokuapp.com/)
|
@@ -237,5 +246,5 @@ see LICENSE.txt for full details and copyright.
|
|
237
246
|
|
238
247
|
## Contributing
|
239
248
|
|
240
|
-
Bug reports and pull requests are welcome [on GitHub](https://github.com/titusfortner/webdrivers).
|
249
|
+
Bug reports and pull requests are welcome [on GitHub](https://github.com/titusfortner/webdrivers).
|
241
250
|
Run `bundle exec rake` and squash the commits in your PRs.
|
@@ -8,15 +8,17 @@ module Webdrivers
|
|
8
8
|
class << self
|
9
9
|
def version
|
10
10
|
version = send("#{System.platform}_version", location)
|
11
|
-
|
12
|
-
raise VersionError, 'Failed to find Chrome binary or its version.' if version.nil? || version.empty?
|
11
|
+
raise VersionError, 'Failed to find Chrome version.' if version.nil? || version.empty?
|
13
12
|
|
14
13
|
Webdrivers.logger.debug "Browser version: #{version}"
|
15
14
|
version[/\d+\.\d+\.\d+\.\d+/] # Google Chrome 73.0.3683.75 -> 73.0.3683.75
|
16
15
|
end
|
17
16
|
|
18
17
|
def location
|
19
|
-
user_defined_location || send("#{System.platform}_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 find Chrome binary.'
|
20
22
|
end
|
21
23
|
|
22
24
|
private
|
data/lib/webdrivers/common.rb
CHANGED
@@ -8,15 +8,17 @@ module Webdrivers
|
|
8
8
|
class << self
|
9
9
|
def version
|
10
10
|
version = send("#{System.platform}_version", location)
|
11
|
-
|
12
|
-
raise VersionError, 'Failed to find Edge binary or its version.' if version.nil? || version.empty?
|
11
|
+
raise VersionError, 'Failed to find Edge version.' if version.nil? || version.empty?
|
13
12
|
|
14
13
|
Webdrivers.logger.debug "Browser version: #{version}"
|
15
14
|
version[/\d+\.\d+\.\d+\.\d+/] # Microsoft Edge 73.0.3683.75 -> 73.0.3683.75
|
16
15
|
end
|
17
16
|
|
18
17
|
def location
|
19
|
-
user_defined_location || send("#{System.platform}_location")
|
18
|
+
edge_bin = user_defined_location || send("#{System.platform}_location")
|
19
|
+
return edge_bin unless edge_bin.nil?
|
20
|
+
|
21
|
+
raise BrowserNotFound, 'Failed to find Edge binary.'
|
20
22
|
end
|
21
23
|
|
22
24
|
private
|
data/lib/webdrivers/version.rb
CHANGED
@@ -7,38 +7,44 @@ describe Webdrivers::ChromeFinder do
|
|
7
7
|
|
8
8
|
context 'when the user relies on the gem to figure out the location of Chrome' do
|
9
9
|
it 'determines the location correctly based on the current OS' do
|
10
|
-
expect
|
10
|
+
expect { chrome_finder.location }.not_to raise_error
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when the user provides a path to the Chrome binary' do
|
15
15
|
it 'uses Selenium::WebDriver::Chrome.path when it is defined' do
|
16
16
|
Selenium::WebDriver::Chrome.path = chrome_finder.location
|
17
|
-
|
18
|
-
allow(chrome_finder).to
|
19
|
-
allow(chrome_finder).to receive(:linux_location)
|
20
|
-
expect(chrome_finder.version).not_to be_nil
|
21
|
-
expect(chrome_finder).not_to have_received(:win_location)
|
22
|
-
expect(chrome_finder).not_to have_received(:mac_location)
|
23
|
-
expect(chrome_finder).not_to have_received(:linux_location)
|
24
|
-
end
|
17
|
+
locations = %i[win_location mac_location linux_location]
|
18
|
+
allow(chrome_finder).to receive_messages(locations)
|
25
19
|
|
26
|
-
it "uses ENV['WD_CHROME_PATH'] when it is defined" do
|
27
|
-
allow(ENV).to receive(:[]).with('WD_CHROME_PATH').and_return(chrome_finder.location)
|
28
|
-
allow(chrome_finder).to receive(:win_location)
|
29
|
-
allow(chrome_finder).to receive(:mac_location)
|
30
|
-
allow(chrome_finder).to receive(:linux_location)
|
31
20
|
expect(chrome_finder.version).not_to be_nil
|
32
|
-
expect(chrome_finder).not_to have_received(
|
33
|
-
expect(chrome_finder).not_to have_received(:mac_location)
|
34
|
-
expect(chrome_finder).not_to have_received(:linux_location)
|
21
|
+
locations.each { |loc| expect(chrome_finder).not_to have_received(loc) }
|
35
22
|
end
|
23
|
+
end
|
36
24
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
25
|
+
it "uses ENV['WD_CHROME_PATH'] when it is defined" do
|
26
|
+
allow(ENV).to receive(:[]).with('WD_CHROME_PATH').and_return(chrome_finder.location)
|
27
|
+
locations = %i[win_location mac_location linux_location]
|
28
|
+
allow(chrome_finder).to receive_messages(locations)
|
29
|
+
|
30
|
+
expect(chrome_finder.version).not_to be_nil
|
31
|
+
locations.each { |loc| expect(chrome_finder).not_to have_received(loc) }
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'uses Selenium::WebDriver::Chrome.path over WD_CHROME_PATH' do
|
35
|
+
Selenium::WebDriver::Chrome.path = chrome_finder.location
|
36
|
+
allow(ENV).to receive(:[]).with('WD_CHROME_PATH').and_return('my_wd_chrome_path')
|
37
|
+
expect(chrome_finder.version).not_to be_nil
|
38
|
+
expect(ENV).not_to have_received(:[]).with('WD_CHROME_PATH')
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when Chrome is not installed' do
|
42
|
+
it 'raises BrowserNotFound' do
|
43
|
+
locations = %i[win_location mac_location linux_location]
|
44
|
+
allow(chrome_finder).to receive_messages(locations)
|
45
|
+
allow(chrome_finder).to receive(:user_defined_location).and_return(nil)
|
46
|
+
|
47
|
+
expect { chrome_finder.version }.to raise_error(Webdrivers::BrowserNotFound)
|
42
48
|
end
|
43
49
|
end
|
44
50
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Webdrivers::EdgeFinder do
|
6
|
+
let(:edge_finder) { described_class }
|
7
|
+
|
8
|
+
before(:all) do # rubocop:disable RSpec/BeforeAfterAll
|
9
|
+
# Skip these tests if version of selenium-webdriver being tested with doesn't
|
10
|
+
# have Chromium based Edge support
|
11
|
+
unless defined?(Selenium::WebDriver::EdgeChrome)
|
12
|
+
skip "The current selenium-webdriver doesn't include Chromium based Edge support"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when the user relies on the gem to figure out the location of Edge' do
|
17
|
+
it 'determines the location correctly based on the current OS' do
|
18
|
+
expect { edge_finder.location }.not_to raise_error
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when the user provides a path to the Edge binary' do
|
23
|
+
it 'uses Selenium::WebDriver::EdgeChrome.path when it is defined' do
|
24
|
+
Selenium::WebDriver::EdgeChrome.path = edge_finder.location
|
25
|
+
locations = %i[win_location mac_location linux_location]
|
26
|
+
allow(edge_finder).to receive_messages(locations)
|
27
|
+
|
28
|
+
expect(edge_finder.version).not_to be_nil
|
29
|
+
locations.each { |loc| expect(edge_finder).not_to have_received(loc) }
|
30
|
+
end
|
31
|
+
|
32
|
+
it "uses ENV['WD_EDGE_CHROME_PATH'] when it is defined" do
|
33
|
+
allow(ENV).to receive(:[]).with('WD_EDGE_CHROME_PATH').and_return(edge_finder.location)
|
34
|
+
locations = %i[win_location mac_location linux_location]
|
35
|
+
allow(edge_finder).to receive_messages(locations)
|
36
|
+
|
37
|
+
expect(edge_finder.version).not_to be_nil
|
38
|
+
locations.each { |loc| expect(edge_finder).not_to have_received(loc) }
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'uses Selenium::WebDriver::EdgeChrome.path over WD_EDGE_CHROME_PATH' do
|
42
|
+
Selenium::WebDriver::EdgeChrome.path = edge_finder.location
|
43
|
+
allow(ENV).to receive(:[]).with('WD_EDGE_CHROME_PATH').and_return('my_wd_chrome_path')
|
44
|
+
expect(edge_finder.version).not_to be_nil
|
45
|
+
expect(ENV).not_to have_received(:[]).with('WD_EDGE_CHROME_PATH')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'when Edge is not installed' do
|
50
|
+
it 'raises BrowserNotFound' do
|
51
|
+
locations = %i[win_location mac_location linux_location]
|
52
|
+
allow(edge_finder).to receive_messages(locations)
|
53
|
+
allow(edge_finder).to receive(:user_defined_location).and_return(nil)
|
54
|
+
|
55
|
+
expect { edge_finder.version }.to raise_error(Webdrivers::BrowserNotFound)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webdrivers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Titus Fortner
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-07-
|
13
|
+
date: 2019-07-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ffi
|
@@ -213,6 +213,7 @@ files:
|
|
213
213
|
- spec/spec_helper.rb
|
214
214
|
- spec/webdrivers/chrome_finder_spec.rb
|
215
215
|
- spec/webdrivers/chromedriver_spec.rb
|
216
|
+
- spec/webdrivers/edge_finder_spec.rb
|
216
217
|
- spec/webdrivers/edgedriver_spec.rb
|
217
218
|
- spec/webdrivers/geckodriver_spec.rb
|
218
219
|
- spec/webdrivers/i_edriver_spec.rb
|