webdrivers 5.0.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4c9d9a6544732e58eb7a88d34e39b188b5ff658caaa14fbdff15931a69d1e2d
4
- data.tar.gz: 92a4997e99508bb79374838461cd2fee48591185b271dd6ce170628c51a02c2c
3
+ metadata.gz: abf2f2c3590d8497b09a84c7f2b55c2b8c5a5cf5752d178fcd4e4a852c0cfd2c
4
+ data.tar.gz: 422f61f2c96fa03e7d4ae5b8564d52058f13334d51ccda07b334805bb2403d6b
5
5
  SHA512:
6
- metadata.gz: fb469a584a66b14097ec87b6a8f2ad30e2cbefdaeef91efd2a50f16ff0451c8a748f8607d53d06ceed3506d61e54ef31b9997e068f9e55dfe9136f8012570234
7
- data.tar.gz: ed61ff78edd17f205673242eeba0fa76dcb2df9675a7d8dc4c813e8dd056799a44b13c1a10b238eeb36bae96cc188ca20c4edd71aebf9ec48e9a78e613136f17
6
+ metadata.gz: dad2443ef52807af22f9780064bb72c226e9101e9997bd787e6ccd3c8a2e161357eb46f476e663a046bee4b9848002f2112a3db5e03a13cd7ca87b564708f54b
7
+ data.tar.gz: 809752d1ef3e67e1fe8a5021eeafe3ab93ad1436c1c894ca6765e8f9e739caf8b4b359d2f2ced0ee61cd118cb7492a8281049f60695d2ba0ec5a51d3fa76b1f4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
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
+
1
11
  # 5.0.0 (2021-10-19)
2
12
  * Require Selenium 4+
3
13
  * Remove custom Logger and use the one in Selenium 4
@@ -8,7 +8,7 @@ module Webdrivers
8
8
  class << self
9
9
  def version
10
10
  version = send("#{System.platform}_version", location)
11
- raise VersionError, 'Failed to find Chrome version.' if version.nil? || version.empty?
11
+ raise VersionError, 'Failed to determine Chrome version.' if version.nil? || version.empty?
12
12
 
13
13
  Webdrivers.logger.debug "Browser version: #{version}"
14
14
  version[/\d+\.\d+\.\d+\.\d+/] # Google Chrome 73.0.3683.75 -> 73.0.3683.75
@@ -18,7 +18,7 @@ module Webdrivers
18
18
  chrome_bin = user_defined_location || send("#{System.platform}_location")
19
19
  return chrome_bin unless chrome_bin.nil?
20
20
 
21
- raise BrowserNotFound, 'Failed to find Chrome binary.'
21
+ raise BrowserNotFound, 'Failed to determine Chrome binary location.'
22
22
  end
23
23
 
24
24
  private
@@ -90,7 +90,17 @@ module Webdrivers
90
90
  def linux_location
91
91
  return wsl_location if System.wsl_v1?
92
92
 
93
- directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
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
+ ]
94
104
  files = %w[google-chrome chrome chromium chromium-browser]
95
105
 
96
106
  directories.each do |dir|
@@ -97,6 +97,14 @@ module Webdrivers
97
97
  false
98
98
  end
99
99
 
100
+ def apple_filename(driver_version)
101
+ if apple_m1_compatible?(driver_version)
102
+ driver_version >= normalize_version('106.0.5249.61') ? 'mac_arm64' : 'mac64_m1'
103
+ else
104
+ 'mac64'
105
+ end
106
+ end
107
+
100
108
  def direct_url(driver_version)
101
109
  "#{base_url}/#{driver_version}/chromedriver_#{driver_filename(driver_version)}.zip"
102
110
  end
@@ -107,8 +115,7 @@ module Webdrivers
107
115
  elsif System.platform == 'linux'
108
116
  'linux64'
109
117
  elsif System.platform == 'mac'
110
- apple_arch = apple_m1_compatible?(driver_version) ? '_m1' : ''
111
- "mac64#{apple_arch}"
118
+ apple_filename(driver_version)
112
119
  else
113
120
  raise 'Failed to determine driver filename to download for your OS.'
114
121
  end
@@ -69,18 +69,17 @@ module Webdrivers
69
69
  end
70
70
 
71
71
  def linux_location
72
- # directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
73
- # files = %w[microsoft-edge] # Based on Microsoft Edge 89.0.760.0 dev
74
- #
75
- # directories.each do |dir|
76
- # files.each do |file|
77
- # option = "#{dir}/#{file}"
78
- # return option if File.exist?(option)
79
- # end
80
- # end
81
- #
82
- # nil
83
- raise 'Default location not yet known'
72
+ directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/microsoft/edge]
73
+ files = %w[microsoft-edge microsoft-edge-beta microsoft-edge-dev]
74
+
75
+ directories.each do |dir|
76
+ files.each do |file|
77
+ option = "#{dir}/#{file}"
78
+ return option if File.exist?(option)
79
+ end
80
+ end
81
+
82
+ nil
84
83
  end
85
84
 
86
85
  def win_version(location)
@@ -22,8 +22,7 @@ module Webdrivers
22
22
  #
23
23
  # @return [String]
24
24
  def base_url
25
- # 'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/'
26
- 'https://msedgedriver.azureedge.net/'
25
+ 'https://msedgedriver.azureedge.net'
27
26
  end
28
27
 
29
28
  private
@@ -76,14 +75,10 @@ module Webdrivers
76
75
  false
77
76
  end
78
77
 
79
- def linux_compatible?(driver_version)
80
- System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
81
- end
82
-
83
78
  def driver_filename(driver_version)
84
79
  if System.platform == 'win' || System.wsl_v1?
85
80
  "win#{System.bitsize}" # 32 or 64-bit
86
- elsif linux_compatible?(driver_version)
81
+ elsif System.platform == 'linux'
87
82
  'linux64'
88
83
  elsif System.platform == 'mac'
89
84
  # Determine M1 or Intel architecture
@@ -51,7 +51,7 @@ module Webdrivers
51
51
  when 'linux'
52
52
  "linux#{System.bitsize}.tar.gz"
53
53
  when 'mac'
54
- 'macos.tar.gz'
54
+ System.apple_m1_architecture? ? 'macos-aarch64.tar.gz' : 'macos.tar.gz'
55
55
  when 'win'
56
56
  "win#{System.bitsize}.zip"
57
57
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'webdrivers'
4
3
  require 'rails'
5
4
 
6
5
  module Webdrivers
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrivers
4
- VERSION = '5.0.0'
4
+ VERSION = '5.2.0'
5
5
  end
@@ -168,8 +168,8 @@ describe Webdrivers::Chromedriver do
168
168
  end
169
169
 
170
170
  it 'raises VersionError for beta version' do
171
- allow(chromedriver).to receive(:browser_version).and_return Gem::Version.new('100.0.0')
172
- msg = 'Unable to find latest point release version for 100.0.0. '\
171
+ allow(chromedriver).to receive(:browser_version).and_return Gem::Version.new('999.0.0')
172
+ msg = 'Unable to find latest point release version for 999.0.0. '\
173
173
  'You appear to be using a non-production version of Chrome. '\
174
174
  'Please set `Webdrivers::Chromedriver.required_version = <desired driver version>` '\
175
175
  'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
@@ -6,7 +6,6 @@ describe Webdrivers::Edgedriver do
6
6
  let(:edgedriver) { described_class }
7
7
 
8
8
  before do
9
- skip 'Edge is not yet supported on Linux' if Webdrivers::System.platform == 'linux'
10
9
  edgedriver.remove
11
10
  end
12
11
 
@@ -123,19 +122,19 @@ describe Webdrivers::Edgedriver do
123
122
 
124
123
  context 'when required version is 0' do
125
124
  it 'downloads the latest version' do
126
- allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('77.0.207.0'))
125
+ allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('98.0.1089.1'))
127
126
  edgedriver.required_version = 0
128
127
  edgedriver.update
129
- expect(edgedriver.current_version.version).to eq('77.0.207.0')
128
+ expect(edgedriver.current_version.version).to eq('98.0.1089.1')
130
129
  end
131
130
  end
132
131
 
133
132
  context 'when required version is nil' do
134
133
  it 'downloads the latest version' do
135
- allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('77.0.207.0'))
134
+ allow(edgedriver).to receive(:latest_version).and_return(Gem::Version.new('98.0.1089.1'))
136
135
  edgedriver.required_version = nil
137
136
  edgedriver.update
138
- expect(edgedriver.current_version.version).to eq('77.0.207.0')
137
+ expect(edgedriver.current_version.version).to eq('98.0.1089.1')
139
138
  end
140
139
  end
141
140
  end
@@ -165,11 +164,11 @@ describe Webdrivers::Edgedriver do
165
164
  end
166
165
 
167
166
  it 'raises VersionError for beta version' do
168
- allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('100.0.0')
169
- msg = 'Unable to find latest point release version for 100.0.0. '\
167
+ allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('999.0.0')
168
+ msg = 'Unable to find latest point release version for 999.0.0. '\
170
169
  'You appear to be using a non-production version of Edge. '\
171
170
  'Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` '\
172
- 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net/'
171
+ 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net'
173
172
 
174
173
  expect { edgedriver.latest_version }.to raise_exception(Webdrivers::VersionError, msg)
175
174
  end
@@ -178,7 +177,7 @@ describe Webdrivers::Edgedriver do
178
177
  allow(edgedriver).to receive(:browser_version).and_return Gem::Version.new('77.0.9999')
179
178
  msg = 'Unable to find latest point release version for 77.0.9999. '\
180
179
  'Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` '\
181
- 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net/'
180
+ 'to a known edgedriver version: Can not reach https://msedgedriver.azureedge.net'
182
181
 
183
182
  expect { edgedriver.latest_version }.to raise_exception(Webdrivers::VersionError, msg)
184
183
  end
@@ -92,6 +92,40 @@ describe Webdrivers::Geckodriver do
92
92
  msg = /Net::HTTPServerException: 404 "Not Found"/
93
93
  expect { geckodriver.update }.to raise_error(StandardError, msg)
94
94
  end
95
+
96
+ context 'when platform is Apple Sillicon' do
97
+ it 'downloads aarch64 binary' do
98
+ allow(Webdrivers::System).to receive(:platform).and_return('mac')
99
+ allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(true)
100
+ base = 'https://github.com/mozilla/geckodriver/releases/download'
101
+ binary = 'geckodriver-v0.31.0-macos-aarch64.tar.gz'
102
+ url = "#{base}/v0.31.0/#{binary}"
103
+
104
+ allow(Webdrivers::System).to receive(:download).with(url, geckodriver.driver_path)
105
+
106
+ geckodriver.required_version = '0.31.0'
107
+ geckodriver.update
108
+
109
+ expect(Webdrivers::System).to have_received(:download).with(url, geckodriver.driver_path)
110
+ end
111
+ end
112
+
113
+ context 'when platform isn\'t Apple Sillicon' do
114
+ it 'downloads default binary' do
115
+ allow(Webdrivers::System).to receive(:platform).and_return('mac')
116
+ allow(Webdrivers::System).to receive(:apple_m1_architecture?).and_return(false)
117
+ base = 'https://github.com/mozilla/geckodriver/releases/download'
118
+ binary = 'geckodriver-v0.31.0-macos.tar.gz'
119
+ url = "#{base}/v0.31.0/#{binary}"
120
+
121
+ allow(Webdrivers::System).to receive(:download).with(url, geckodriver.driver_path)
122
+
123
+ geckodriver.required_version = '0.31.0'
124
+ geckodriver.update
125
+
126
+ expect(Webdrivers::System).to have_received(:download).with(url, geckodriver.driver_path)
127
+ end
128
+ end
95
129
  end
96
130
 
97
131
  describe '#current_version' do
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdrivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner
8
8
  - Lakshya Kapoor
9
9
  - Thomas Walpole
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-10-20 00:00:00.000000000 Z
13
+ date: 2022-09-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi
@@ -212,9 +212,9 @@ licenses:
212
212
  metadata:
213
213
  bug_tracker_uri: https://github.com/titusfortner/webdrivers/issues
214
214
  changelog_uri: https://github.com/titusfortner/webdrivers/blob/master/CHANGELOG.md
215
- documentation_uri: https://www.rubydoc.info/gems/webdrivers/5.0.0
216
- source_code_uri: https://github.com/titusfortner/webdrivers/tree/v5.0.0
217
- post_install_message:
215
+ documentation_uri: https://www.rubydoc.info/gems/webdrivers/5.2.0
216
+ source_code_uri: https://github.com/titusfortner/webdrivers/tree/v5.2.0
217
+ post_install_message:
218
218
  rdoc_options: []
219
219
  require_paths:
220
220
  - lib
@@ -229,18 +229,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
- rubygems_version: 3.2.22
233
- signing_key:
232
+ rubygems_version: 3.3.22
233
+ signing_key:
234
234
  specification_version: 4
235
235
  summary: Easy download and use of browser drivers.
236
236
  test_files:
237
237
  - spec/spec_helper.rb
238
238
  - spec/webdrivers/chrome_finder_spec.rb
239
- - spec/webdrivers/chromedriver_spec.rb
240
239
  - spec/webdrivers/edge_finder_spec.rb
240
+ - spec/webdrivers/webdrivers_spec.rb
241
+ - spec/webdrivers/system_spec.rb
241
242
  - spec/webdrivers/edgedriver_spec.rb
242
- - spec/webdrivers/geckodriver_spec.rb
243
243
  - spec/webdrivers/i_edriver_spec.rb
244
- - spec/webdrivers/system_spec.rb
245
- - spec/webdrivers/webdrivers_spec.rb
244
+ - spec/webdrivers/geckodriver_spec.rb
245
+ - spec/webdrivers/chromedriver_spec.rb
246
246
  - spec/webdrivers_proxy_support_spec.rb