webdrivers 4.6.1 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 543fb2ae13f36325fe5fc7cfd8a4c890e27d3eabdb239abbe2d816e656db9bda
4
- data.tar.gz: f2cf830140dde3e9127e556cf46357fa6538b40425636dce02aa020000df8282
3
+ metadata.gz: 124d154092dc8915735f459f0476c7700e47300bec986e9b88ba214b2db8b92c
4
+ data.tar.gz: 9db15712e5227ef9b92db34a7d1714ba9613ca2bd30563b85cf5dbeee5322063
5
5
  SHA512:
6
- metadata.gz: 5dfa4804f4ec0342dd24df0ecbdddf8d2456e12037e73e72efc88b11b0e4c355159ab5bb818309195ab09c90fcf4a09ede79344b955763ca74c381b6d0cb378c
7
- data.tar.gz: d5e802872d42a2a8929421872563457263f610cb2f536acded38d28b03ff8986f13094bd0efbdd32223d541cd1245425f57937de7ea262849985c80409f7c89f
6
+ metadata.gz: 727a676f6b025291ecc30fff84b16159820607f4dba0c1216b3c1487f56b5bb4da8679b69b464a5234dc78d872da4b63112b11d60efd3fbb72cfbaf61ea57223
7
+ data.tar.gz: 744f5a8173676d02b2f94ff3eda885ec77d47a4e2e04cbfaa04876262e500e906313f6280d0a12e93274ba7f558886a035879d72b0264903fc695c2139b4ca83
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  # 4.6.1 (2021-08-19)
2
9
  * Fix bug in IEdriver caused by bad formatting in recent release
3
10
 
@@ -97,18 +97,8 @@ module Webdrivers
97
97
  false
98
98
  end
99
99
 
100
- def download_url
101
- return @download_url if @download_url
102
-
103
- driver_version = if required_version == EMPTY_VERSION
104
- latest_version
105
- else
106
- normalize_version(required_version)
107
- end
108
- filename = driver_filename(driver_version)
109
- url = "#{base_url}/#{driver_version}/chromedriver_#{filename}.zip"
110
- Webdrivers.logger.debug "chromedriver URL: #{url}"
111
- @download_url = url
100
+ def direct_url(driver_version)
101
+ "#{base_url}/#{driver_version}/chromedriver_#{driver_filename(driver_version)}.zip"
112
102
  end
113
103
 
114
104
  def driver_filename(driver_version)
@@ -156,17 +146,4 @@ module Webdrivers
156
146
  end
157
147
  end
158
148
 
159
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
160
- ::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
161
- else
162
- # v3.141.0 and lower
163
- module Selenium
164
- module WebDriver
165
- module Chrome
166
- def self.driver_path
167
- @driver_path ||= Webdrivers::Chromedriver.update
168
- end
169
- end
170
- end
171
- end
172
- end
149
+ ::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
@@ -118,12 +118,12 @@ module Webdrivers
118
118
 
119
119
  private
120
120
 
121
+ def download_version
122
+ required_version == EMPTY_VERSION ? latest_version : required_version
123
+ end
124
+
121
125
  def download_url
122
- @download_url ||= if required_version == EMPTY_VERSION
123
- downloads[downloads.keys.max]
124
- else
125
- downloads[normalize_version(required_version)]
126
- end
126
+ @download_url ||= direct_url(download_version).tap { |url| Webdrivers.logger.debug "#{file_name} URL: #{url}" }
127
127
  end
128
128
 
129
129
  def exists?
@@ -131,11 +131,7 @@ module Webdrivers
131
131
  end
132
132
 
133
133
  def correct_binary?
134
- current_version == if required_version == EMPTY_VERSION
135
- latest_version
136
- else
137
- normalize_version(required_version)
138
- end
134
+ current_version == download_version
139
135
  rescue ConnectionError, VersionError
140
136
  driver_path if sufficient_binary?
141
137
  end
@@ -76,15 +76,15 @@ module Webdrivers
76
76
  false
77
77
  end
78
78
 
79
- # def linux_compatible?(driver_version)
80
- # System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
81
- # end
79
+ def linux_compatible?(driver_version)
80
+ System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
81
+ end
82
82
 
83
83
  def driver_filename(driver_version)
84
84
  if System.platform == 'win' || System.wsl_v1?
85
85
  "win#{System.bitsize}" # 32 or 64-bit
86
- # elsif linux_compatible?(driver_version)
87
- # 'linux64'
86
+ elsif linux_compatible?(driver_version)
87
+ 'linux64'
88
88
  elsif System.platform == 'mac'
89
89
  # Determine M1 or Intel architecture
90
90
  apple_arch = apple_m1_compatible?(driver_version) ? 'arm' : 'mac'
@@ -94,18 +94,8 @@ module Webdrivers
94
94
  end
95
95
  end
96
96
 
97
- def download_url
98
- return @download_url if @download_url
99
-
100
- driver_version = if required_version == EMPTY_VERSION
101
- latest_version
102
- else
103
- normalize_version(required_version)
104
- end
105
- filename = driver_filename(driver_version)
106
- url = "#{base_url}/#{driver_version}/edgedriver_#{filename}.zip"
107
- Webdrivers.logger.debug "msedgedriver URL: #{url}"
108
- @download_url = url
97
+ def direct_url(driver_version)
98
+ "#{base_url}/#{driver_version}/edgedriver_#{driver_filename(driver_version)}.zip"
109
99
  end
110
100
  end
111
101
  end
@@ -42,14 +42,6 @@ module Webdrivers
42
42
  System.platform == 'win' ? 'geckodriver.exe' : 'geckodriver'
43
43
  end
44
44
 
45
- def download_url
46
- @download_url ||= if required_version == EMPTY_VERSION
47
- direct_url(latest_version)
48
- else
49
- direct_url(required_version)
50
- end
51
- end
52
-
53
45
  def direct_url(version)
54
46
  "#{base_url}/download/v#{version}/geckodriver-v#{version}-#{platform_ext}"
55
47
  end
@@ -68,17 +60,4 @@ module Webdrivers
68
60
  end
69
61
  end
70
62
 
71
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
72
- ::Selenium::WebDriver::Firefox::Service.driver_path = proc { ::Webdrivers::Geckodriver.update }
73
- else
74
- # v3.141.0 and lower
75
- module Selenium
76
- module WebDriver
77
- module Firefox
78
- def self.driver_path
79
- @driver_path ||= Webdrivers::Geckodriver.update
80
- end
81
- end
82
- end
83
- end
84
- end
63
+ ::Selenium::WebDriver::Firefox::Service.driver_path = proc { ::Webdrivers::Geckodriver.update }
@@ -34,7 +34,7 @@ module Webdrivers
34
34
  #
35
35
  # @return [String]
36
36
  def base_url
37
- 'https://selenium-release.storage.googleapis.com/'
37
+ 'https://api.github.com/repos/seleniumhq/selenium/releases'
38
38
  end
39
39
 
40
40
  private
@@ -43,35 +43,26 @@ module Webdrivers
43
43
  'IEDriverServer.exe'
44
44
  end
45
45
 
46
+ def direct_url(version)
47
+ downloads[version]
48
+ end
49
+
46
50
  def downloads
47
51
  ds = download_manifest.each_with_object({}) do |item, hash|
48
- version = normalize_version item[/\.?([^_]+)\.zip/, 1]
49
- hash[version] = "#{base_url}#{item}"
52
+ version = normalize_version item['name'][/\.?([^_]+)\.zip/, 1]
53
+ hash[version] = item['browser_download_url']
50
54
  end
51
55
  Webdrivers.logger.debug "Versions now located on downloads site: #{ds.keys}"
52
56
  ds
53
57
  end
54
58
 
55
59
  def download_manifest
56
- doc = Nokogiri::XML.parse(Network.get(base_url))
57
- items = doc.css('Key').collect(&:text)
58
- items.select { |item| item.include?('IEDriverServer_Win32') }
60
+ json = Network.get(base_url)
61
+ all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
62
+ all_assets.select { |asset| asset['name'].include?('IEDriverServer_Win32') }
59
63
  end
60
64
  end
61
65
  end
62
66
  end
63
67
 
64
- if ::Selenium::WebDriver::Service.respond_to? :driver_path=
65
- ::Selenium::WebDriver::IE::Service.driver_path = proc { ::Webdrivers::IEdriver.update }
66
- else
67
- # v3.141.0 and lower
68
- module Selenium
69
- module WebDriver
70
- module IE
71
- def self.driver_path
72
- @driver_path ||= Webdrivers::IEdriver.update
73
- end
74
- end
75
- end
76
- end
77
- end
68
+ ::Selenium::WebDriver::IE::Service.driver_path = proc { ::Webdrivers::IEdriver.update }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrivers
4
- VERSION = '4.6.1'
4
+ VERSION = '4.7.0'
5
5
  end
@@ -7,7 +7,9 @@ describe Webdrivers::EdgeFinder do
7
7
 
8
8
  before(:all) do # rubocop:disable RSpec/BeforeAfterAll
9
9
  if Selenium::WebDriver::VERSION[0].to_i < 4
10
- skip "The current selenium-webdriver doesn't include Chromium based Edge support"
10
+ skip 'The current selenium-webdriver does not include Chromium based Edge support'
11
+ elsif Webdrivers::System.platform == 'linux'
12
+ skip 'Edge is not yet supported on Linux'
11
13
  end
12
14
  end
13
15
 
@@ -7,7 +7,9 @@ describe Webdrivers::Edgedriver do
7
7
 
8
8
  before(:all) do # rubocop:disable RSpec/BeforeAfterAll
9
9
  if Selenium::WebDriver::VERSION[0].to_i < 4
10
- skip "The current selenium-webdriver doesn't include Chromium based Edge support"
10
+ skip 'The current selenium-webdriver does not include Chromium based Edge support'
11
+ elsif Webdrivers::System.platform == 'linux'
12
+ skip 'Edge is not yet supported on Linux'
11
13
  end
12
14
  end
13
15
 
@@ -178,8 +180,7 @@ describe Webdrivers::Edgedriver do
178
180
  end
179
181
 
180
182
  it 'raises VersionError for unknown version' do
181
- skip "MS doesn't yet support point release latest versioning."
182
- allow(edgedriver).to receive(:browser_version).and_return('77.0.9999.0000')
183
+ allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('77.0.9999')
183
184
  msg = 'Unable to find latest point release version for 77.0.9999. '\
184
185
  'Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` '\
185
186
  'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net/'
@@ -192,14 +192,12 @@ You can obtain a copy of the license at https://mozilla.org/MPL/2.0/"
192
192
  end
193
193
 
194
194
  it 'uses provided value' do
195
- begin
196
- install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
197
- Webdrivers.install_dir = install_dir
195
+ install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
196
+ Webdrivers.install_dir = install_dir
198
197
 
199
- expect(Webdrivers::System.install_dir).to eq install_dir
200
- ensure
201
- Webdrivers.install_dir = nil
202
- end
198
+ expect(Webdrivers::System.install_dir).to eq install_dir
199
+ ensure
200
+ Webdrivers.install_dir = nil
203
201
  end
204
202
  end
205
203
 
@@ -6,6 +6,10 @@ describe Webdrivers::IEdriver do
6
6
  let(:iedriver) { described_class }
7
7
 
8
8
  before do
9
+ if ENV['CI'] && !Selenium::WebDriver::Platform.windows?
10
+ skip('Only run IE tests on Windows on CI because rate limiting')
11
+ end
12
+
9
13
  iedriver.remove
10
14
  iedriver.required_version = nil
11
15
  end
@@ -69,7 +73,7 @@ describe Webdrivers::IEdriver do
69
73
  it 'raises ConnectionError if offline' do
70
74
  allow(Net::HTTP).to receive(:get_response).and_raise(SocketError)
71
75
 
72
- msg = %r{Can not reach https://selenium-release.storage.googleapis.com/}
76
+ msg = %r{Can not reach https://api.github.com/repos/seleniumhq/selenium/releases}
73
77
  expect { iedriver.update }.to raise_error(Webdrivers::ConnectionError, msg)
74
78
  end
75
79
  end
@@ -109,7 +113,8 @@ describe Webdrivers::IEdriver do
109
113
  end
110
114
 
111
115
  it 'creates cached file' do
112
- allow(Webdrivers::Network).to receive(:get).and_return('3.4.0')
116
+ json = '[{"assets": [{"name":"IEDriverServer_Win32_3.150.0.zip"}]}]'
117
+ allow(Webdrivers::Network).to receive(:get).and_return(json)
113
118
 
114
119
  iedriver.latest_version
115
120
  expect(File.exist?("#{Webdrivers::System.install_dir}/IEDriverServer.version")).to eq true
@@ -174,14 +179,12 @@ describe Webdrivers::IEdriver do
174
179
  end
175
180
 
176
181
  it 'uses provided value' do
177
- begin
178
- install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
179
- Webdrivers.install_dir = install_dir
182
+ install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
183
+ Webdrivers.install_dir = install_dir
180
184
 
181
- expect(Webdrivers::System.install_dir).to eq install_dir
182
- ensure
183
- Webdrivers.install_dir = nil
184
- end
185
+ expect(Webdrivers::System.install_dir).to eq install_dir
186
+ ensure
187
+ Webdrivers.install_dir = nil
185
188
  end
186
189
  end
187
190
 
@@ -49,37 +49,31 @@ describe Webdrivers do
49
49
  end
50
50
 
51
51
  it 'uses provided value' do
52
- begin
53
- install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
54
- described_class.install_dir = install_dir
52
+ install_dir = File.expand_path(File.join(ENV['HOME'], '.webdrivers2'))
53
+ described_class.install_dir = install_dir
55
54
 
56
- expect(described_class.install_dir).to eq install_dir
57
- ensure
58
- described_class.install_dir = nil
59
- end
55
+ expect(described_class.install_dir).to eq install_dir
56
+ ensure
57
+ described_class.install_dir = nil
60
58
  end
61
59
 
62
60
  context 'when ENV variable WD_INSTALL_DIR is set and Webdrivers.install_dir is not' do
63
61
  it 'uses path from the ENV variable' do
64
- begin
65
- described_class.install_dir = nil
66
- allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('custom_dir')
67
- expect(described_class.install_dir).to be('custom_dir')
68
- ensure
69
- described_class.install_dir = nil
70
- end
62
+ described_class.install_dir = nil
63
+ allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('custom_dir')
64
+ expect(described_class.install_dir).to be('custom_dir')
65
+ ensure
66
+ described_class.install_dir = nil
71
67
  end
72
68
  end
73
69
 
74
70
  context 'when both ENV variable WD_INSTALL_DIR and Webdrivers.install_dir are set' do
75
71
  it 'uses path from Webdrivers.install_dir' do
76
- begin
77
- described_class.install_dir = 'my_install_dir_path'
78
- allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('my_env_path')
79
- expect(described_class.install_dir).to be('my_install_dir_path')
80
- ensure
81
- described_class.install_dir = nil
82
- end
72
+ described_class.install_dir = 'my_install_dir_path'
73
+ allow(ENV).to receive(:[]).with('WD_INSTALL_DIR').and_return('my_env_path')
74
+ expect(described_class.install_dir).to be('my_install_dir_path')
75
+ ensure
76
+ described_class.install_dir = nil
83
77
  end
84
78
  end
85
79
  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.6.1
4
+ version: 4.7.0
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: 2021-08-20 00:00:00.000000000 Z
13
+ date: 2021-10-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi
@@ -156,22 +156,22 @@ dependencies:
156
156
  name: selenium-webdriver
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - ">="
159
+ - - ">"
160
160
  - !ruby/object:Gem::Version
161
- version: '3.0'
161
+ version: '3.141'
162
162
  - - "<"
163
163
  - !ruby/object:Gem::Version
164
- version: '4.0'
164
+ version: '5.0'
165
165
  type: :runtime
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - ">="
169
+ - - ">"
170
170
  - !ruby/object:Gem::Version
171
- version: '3.0'
171
+ version: '3.141'
172
172
  - - "<"
173
173
  - !ruby/object:Gem::Version
174
- version: '4.0'
174
+ version: '5.0'
175
175
  description: Run Selenium tests more easily with install and updates for all supported
176
176
  webdrivers.
177
177
  email:
@@ -218,8 +218,8 @@ licenses:
218
218
  metadata:
219
219
  bug_tracker_uri: https://github.com/titusfortner/webdrivers/issues
220
220
  changelog_uri: https://github.com/titusfortner/webdrivers/blob/master/CHANGELOG.md
221
- documentation_uri: https://www.rubydoc.info/gems/webdrivers/4.6.1
222
- source_code_uri: https://github.com/titusfortner/webdrivers/tree/v4.6.1
221
+ documentation_uri: https://www.rubydoc.info/gems/webdrivers/4.7.0
222
+ source_code_uri: https://github.com/titusfortner/webdrivers/tree/v4.7.0
223
223
  post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
@@ -228,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
228
  requirements:
229
229
  - - ">="
230
230
  - !ruby/object:Gem::Version
231
- version: 2.4.0
231
+ version: 2.6.0
232
232
  required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - ">="