webdrivers 4.4.0 → 4.5.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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -1
  3. data/LICENSE.txt +0 -0
  4. data/README.md +20 -1
  5. data/lib/webdrivers/Rakefile +0 -0
  6. data/lib/webdrivers/chrome_finder.rb +4 -2
  7. data/lib/webdrivers/chromedriver.rb +34 -13
  8. data/lib/webdrivers/common.rb +0 -0
  9. data/lib/webdrivers/edge_finder.rb +11 -0
  10. data/lib/webdrivers/edgedriver.rb +37 -14
  11. data/lib/webdrivers/geckodriver.rb +0 -0
  12. data/lib/webdrivers/iedriver.rb +9 -6
  13. data/lib/webdrivers/logger.rb +0 -0
  14. data/lib/webdrivers/network.rb +2 -0
  15. data/lib/webdrivers/railtie.rb +0 -0
  16. data/lib/webdrivers/system.rb +11 -1
  17. data/lib/webdrivers/tasks/chromedriver.rake +0 -0
  18. data/lib/webdrivers/tasks/edgedriver.rake +0 -0
  19. data/lib/webdrivers/tasks/geckodriver.rake +0 -0
  20. data/lib/webdrivers/tasks/iedriver.rake +0 -0
  21. data/lib/webdrivers/version.rb +1 -1
  22. data/lib/webdrivers.rb +0 -0
  23. data/spec/spec_helper.rb +0 -0
  24. data/spec/webdrivers/chrome_finder_spec.rb +1 -1
  25. data/spec/webdrivers/chromedriver_spec.rb +0 -0
  26. data/spec/webdrivers/coverage/assets/0.10.2/application.css +799 -0
  27. data/spec/webdrivers/coverage/assets/0.10.2/application.js +1707 -0
  28. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/border.png +0 -0
  29. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  30. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  31. data/spec/webdrivers/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  32. data/spec/webdrivers/coverage/assets/0.10.2/favicon_green.png +0 -0
  33. data/spec/webdrivers/coverage/assets/0.10.2/favicon_red.png +0 -0
  34. data/spec/webdrivers/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  35. data/spec/webdrivers/coverage/assets/0.10.2/loading.gif +0 -0
  36. data/spec/webdrivers/coverage/assets/0.10.2/magnify.png +0 -0
  37. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  38. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  39. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  40. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  41. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  42. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  43. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  44. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  45. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  46. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  47. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  48. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  49. data/spec/webdrivers/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  50. data/spec/webdrivers/coverage/index.html +3512 -0
  51. data/spec/webdrivers/edge_finder_spec.rb +0 -0
  52. data/spec/webdrivers/edgedriver_spec.rb +0 -0
  53. data/spec/webdrivers/geckodriver_spec.rb +0 -0
  54. data/spec/webdrivers/i_edriver_spec.rb +0 -0
  55. data/spec/webdrivers/system_spec.rb +27 -21
  56. data/spec/webdrivers/webdrivers_spec.rb +0 -0
  57. data/spec/webdrivers_proxy_support_spec.rb +0 -0
  58. metadata +85 -26
  59. data/.github/ISSUE_TEMPLATE.md +0 -16
  60. data/.gitignore +0 -8
  61. data/.rubocop.yml +0 -48
  62. data/.travis.yml +0 -41
  63. data/Gemfile +0 -6
  64. data/Rakefile +0 -11
  65. data/appveyor.yml +0 -45
  66. data/bin/console +0 -15
  67. data/bin/setup +0 -8
  68. data/gemfiles/Gemfile.edge +0 -7
  69. data/support/install_jruby.ps1 +0 -7
  70. data/support/install_msedge.ps1 +0 -11
  71. data/webdrivers.gemspec +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f905a3a4839d0f0a56317926d560cab4ee29f98b3d36d4feb1bb671e3f1b23b
4
- data.tar.gz: 44ae96f9ba7edfbb2fb1bd1fd7ef319e73643f5a43c0fce59c51e2b94c1a25c8
3
+ metadata.gz: fb33edccefe82002bbea2a0ca410d050bbf12f3b8e3a7a7721147f75ffed9c97
4
+ data.tar.gz: 2a30c004082f6788096d0d18de559aeea99560a1a96a022b4e9b53c9e4232b12
5
5
  SHA512:
6
- metadata.gz: 73d60000abc1ad06f692ee556bca7bd57403cde91f2152b5349fda2b0feaa2afb261dd87b1e16f6f8c74e843634b8dbde3da85ed666164920e78163fed764029
7
- data.tar.gz: 1c94fde9cafdb1929a3e70ada28c7dfec07cbae6f68220e247ffe62343700c5b3ca2c0556d1d028d4d25b0f6bbd76923c402f1925574ec6f117eb8c4066e6255
6
+ metadata.gz: 78187b37c392f86a3ef9b788e39c00b81f48acca6de9f9c64a619c28c4f7b29d71a57f099478786ac903ac0ea199735832324fcde5c50f32635b78ce532cddf1
7
+ data.tar.gz: 3bd31fda8f71d31238d8b73b2468677d5eb23ffe956bb82a74e382ce99a750dce5127ea8328e868c9a795015517c27f8fb208eee4fcdf0b81fa572b5200c1158
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
+ # 4.5.0 (2021-01-19)
2
+ * Improve format of README usage section. Thanks, [okuramasafumi](https://github.com/okuramasafumi)!
3
+ * `chromedriver` - Add support for Apple M1 specific builds ([#193](https://github.com/titusfortner/webdrivers/pull/193)). Thanks, [MichaelHoste](https://github.com/MichaelHoste)!
4
+ * `msedgedriver` - Add support for Apple M1 specific builds.
5
+ * `msedgedriver` - Added automatic selection of 32-bit vs 64-bit builds on Windows and WSLv1.
6
+ * When using this gem in WSLv2, Chrome installed on the Linux filesystem will be automatically used ([#196](https://github.com/titusfortner/webdrivers/pull/196)).
7
+ WSLv1 continues to automatically use Chrome from the Windows filesystem though. Thanks, [fabioxgn](https://github.com/fabioxgn)!
8
+ * We'll aim to make the behavior consistent in a future release.
9
+
10
+ ### 4.4.2 (2020-12-29)
11
+ * Use new powershell if available to enhance WSL support ([#176](https://github.com/titusfortner/webdrivers/issues/176),
12
+ [#186](https://github.com/titusfortner/webdrivers/pull/186)). Thanks, [G-Rath](https://github.com/G-Rath) and
13
+ [131](https://github.com/131)!
14
+ * Update rubocop version (development dependency only) ([#178](https://github.com/titusfortner/webdrivers/pull/178)).
15
+ Thanks, [utkarsh2102](https://github.com/utkarsh2102)!
16
+ * Replace `git ls-files` with `dir` in the gemspec for better Debian support ([#179](https://github.com/titusfortner/webdrivers/pull/179),
17
+ [#184](https://github.com/titusfortner/webdrivers/issues/184)).
18
+ Thanks again, [utkarsh2102](https://github.com/utkarsh2102)!
19
+ * Update README with `require: false` when adding gem to Gemfile ([#183](https://github.com/titusfortner/webdrivers/pull/183)).
20
+ * Make WSL detection more generic ([#187](https://github.com/titusfortner/webdrivers/pull/187)).
21
+ [rbclark](https://github.com/rbclark)!
22
+
23
+ ### 4.4.1 (2020-06-01)
24
+ * Do not include binstubs used for troubleshooting only. Fixes [#174](https://github.com/titusfortner/webdrivers/issues/174).
25
+
1
26
  ### 4.4.0 (2020-05-31)
2
- * Implement initial support for WSLv1 ([#172](https://github.com/titusfortner/webdrivers/issues/172)). Thanks G-Rath!
27
+ * Implement support for `chromedriver` in Windows Subsystem for Linux (WSL) v1 ([#172](https://github.com/titusfortner/webdrivers/issues/172)).
28
+ Thanks, [G-Rath](https://github.com/G-Rath)!
3
29
  * Chrome/Edgedriver - Fix [#171](https://github.com/titusfortner/webdrivers/issues/171) by making sure the cached
4
30
  driver build version matches the browser build version before using it.
5
31
  * Chrome/Edgedriver - Driver version check now matches the driver and browser `major.minor.build` versions instead of just
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/webdrivers.svg)](https://badge.fury.io/rb/webdrivers)
4
4
  [![Build status](https://travis-ci.org/titusfortner/webdrivers.svg?branch=master)](https://travis-ci.org/titusfortner/webdrivers)
5
5
  [![AppVeyor status](https://ci.appveyor.com/api/projects/status/ejh90xqbvkphq4cy/branch/master?svg=true)](https://ci.appveyor.com/project/titusfortner/webdrivers/branch/master)
6
+ ![Tests](https://github.com/titusfortner/webdrivers/workflows/Tests/badge.svg)
6
7
 
7
8
  Run Selenium tests more easily with automatic installation and updates for all supported webdrivers.
8
9
 
@@ -15,11 +16,15 @@ Run Selenium tests more easily with automatic installation and updates for all s
15
16
  * [IEDriverServer](https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
16
17
  * [msedgedriver](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/)
17
18
 
19
+ Works on macOS, Linux, Windows, and Windows Subsystem for Linux (WSL) v1.
20
+
18
21
  ## Usage
19
22
 
20
23
  In your Gemfile:
21
24
 
22
- `gem 'webdrivers', '~> 4.0'`
25
+ ```ruby
26
+ gem 'webdrivers', '~> 4.0', require: false
27
+ ```
23
28
 
24
29
  In your project:
25
30
 
@@ -192,6 +197,20 @@ The logging level can be configured for debugging purpose:
192
197
  Webdrivers.logger.level = :DEBUG
193
198
  ```
194
199
 
200
+ ### WSLv1 support
201
+
202
+ While WSLv1 is not designed to run headful applications like Chrome, it can run exes; as such when found to be running
203
+ in WSL, `webdrivers` will use the Windows `chromedriver.exe`.
204
+
205
+ It's recommended that you install the new PowerShell (PS7) to avoid [a known issue](https://github.com/microsoft/terminal/issues/367)
206
+ with the console font being changed when calling the old PowerShell (PS5).
207
+
208
+ ### WSLv2 support
209
+
210
+ Webdrivers will detect WSLv2 as running on Linux.
211
+
212
+ WSLv2 doesn't support connecting to host ports out of the box, so it isn't possible to connect to Chromedriver on Windows without extra configurations, see: https://github.com/microsoft/WSL/issues/4619. The simplest way to use Chromedriver with WSLv2 is to run Chrome headless on Linux.
213
+
195
214
  ### Browser Specific Notes
196
215
 
197
216
  #### Chrome/Chromium
File without changes
@@ -88,7 +88,7 @@ module Webdrivers
88
88
  end
89
89
 
90
90
  def linux_location
91
- return wsl_location if System.wsl?
91
+ return wsl_location if System.wsl_v1?
92
92
 
93
93
  directories = %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /snap/bin /opt/google/chrome]
94
94
  files = %w[google-chrome chrome chromium chromium-browser]
@@ -104,6 +104,8 @@ module Webdrivers
104
104
  end
105
105
 
106
106
  def win_version(location)
107
+ System.call("pwsh.exe -command \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
108
+ rescue StandardError
107
109
  System.call("powershell.exe \"(Get-ItemProperty '#{location}').VersionInfo.ProductVersion\"")&.strip
108
110
  end
109
111
 
@@ -112,7 +114,7 @@ module Webdrivers
112
114
  end
113
115
 
114
116
  def linux_version(location)
115
- return wsl_version(location) if System.wsl?
117
+ return wsl_version(location) if System.wsl_v1?
116
118
 
117
119
  System.call(location, '--product-version')&.strip
118
120
  end
@@ -73,36 +73,57 @@ module Webdrivers
73
73
  else
74
74
  msg
75
75
  end
76
- rescue NetworkError
77
- "#{msg} A network issue is preventing determination of latest chromedriver release."
76
+ rescue NetworkError
77
+ "#{msg} A network issue is preventing determination of latest chromedriver release."
78
78
  end
79
79
 
80
80
  msg = "#{msg} Please set `Webdrivers::Chromedriver.required_version = <desired driver version>` "\
81
- 'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
82
-
81
+ 'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
83
82
  Webdrivers.logger.debug msg
84
83
  raise VersionError, msg
85
84
  end
86
85
 
87
86
  def file_name
88
- System.platform == 'win' || System.wsl? ? 'chromedriver.exe' : 'chromedriver'
87
+ System.platform == 'win' || System.wsl_v1? ? 'chromedriver.exe' : 'chromedriver'
88
+ end
89
+
90
+ def apple_m1_compatible?(driver_version)
91
+ if System.apple_m1_architecture? && driver_version >= normalize_version('87.0.4280.88')
92
+ Webdrivers.logger.debug 'chromedriver version is Apple M1 compatible.'
93
+ return true
94
+ end
95
+
96
+ Webdrivers.logger.debug 'chromedriver version is NOT Apple M1 compatible. Required >= 87.0.4280.88'
97
+ false
89
98
  end
90
99
 
91
100
  def download_url
92
101
  return @download_url if @download_url
93
102
 
94
- version = if required_version == EMPTY_VERSION
95
- latest_version
96
- else
97
- normalize_version(required_version)
98
- end
99
-
100
- file_name = System.platform == 'win' || System.wsl? ? 'win32' : "#{System.platform}64"
101
- url = "#{base_url}/#{version}/chromedriver_#{file_name}.zip"
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"
102
110
  Webdrivers.logger.debug "chromedriver URL: #{url}"
103
111
  @download_url = url
104
112
  end
105
113
 
114
+ def driver_filename(driver_version)
115
+ if System.platform == 'win' || System.wsl_v1?
116
+ 'win32'
117
+ elsif System.platform == 'linux'
118
+ 'linux64'
119
+ elsif System.platform == 'mac'
120
+ apple_arch = apple_m1_compatible?(driver_version) ? '_m1' : ''
121
+ "mac64#{apple_arch}"
122
+ else
123
+ raise 'Failed to determine driver filename to download for your OS.'
124
+ end
125
+ end
126
+
106
127
  # Returns major.minor.build version from the currently installed chromedriver version
107
128
  #
108
129
  # @example
File without changes
@@ -69,6 +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
72
83
  raise 'Default location not yet known'
73
84
  end
74
85
 
@@ -26,10 +26,6 @@ module Webdrivers
26
26
  'https://msedgedriver.azureedge.net/'
27
27
  end
28
28
 
29
- def remove
30
- super
31
- end
32
-
33
29
  private
34
30
 
35
31
  def latest_point_release(version)
@@ -58,8 +54,8 @@ module Webdrivers
58
54
  else
59
55
  msg
60
56
  end
61
- rescue NetworkError
62
- "#{msg} A network issue is preventing determination of latest msedgedriver release."
57
+ rescue NetworkError
58
+ "#{msg} A network issue is preventing determination of latest msedgedriver release."
63
59
  end
64
60
 
65
61
  "#{msg} Please set `Webdrivers::Edgedriver.required_version = <desired driver version>` "\
@@ -70,17 +66,44 @@ module Webdrivers
70
66
  System.platform == 'win' ? 'msedgedriver.exe' : 'msedgedriver'
71
67
  end
72
68
 
69
+ def apple_m1_compatible?(driver_version)
70
+ if System.apple_m1_architecture? && driver_version >= normalize_version('87.0.669.0')
71
+ Webdrivers.logger.debug 'msedgedriver version is Apple M1 compatible.'
72
+ return true
73
+ end
74
+
75
+ Webdrivers.logger.debug 'msedgedriver version is NOT Apple M1 compatible. Required >= 87.0.669.0'
76
+ false
77
+ end
78
+
79
+ # def linux_compatible?(driver_version)
80
+ # System.platform == 'linux' && driver_version >= normalize_version('89.0.731.0')
81
+ # end
82
+
83
+ def driver_filename(driver_version)
84
+ if System.platform == 'win' || System.wsl_v1?
85
+ "win#{System.bitsize}" # 32 or 64-bit
86
+ # elsif linux_compatible?(driver_version)
87
+ # 'linux64'
88
+ elsif System.platform == 'mac'
89
+ # Determine M1 or Intel architecture
90
+ apple_arch = apple_m1_compatible?(driver_version) ? 'arm' : 'mac'
91
+ "#{apple_arch}64"
92
+ else
93
+ raise 'Failed to determine driver filename to download for your OS.'
94
+ end
95
+ end
96
+
73
97
  def download_url
74
98
  return @download_url if @download_url
75
99
 
76
- version = if required_version == EMPTY_VERSION
77
- latest_version
78
- else
79
- normalize_version(required_version)
80
- end
81
-
82
- file_name = System.platform == 'win' ? 'win32' : "#{System.platform}64"
83
- url = "#{base_url}/#{version}/edgedriver_#{file_name}.zip"
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"
84
107
  Webdrivers.logger.debug "msedgedriver URL: #{url}"
85
108
  @download_url = url
86
109
  end
File without changes
@@ -44,16 +44,19 @@ module Webdrivers
44
44
  end
45
45
 
46
46
  def downloads
47
- doc = Nokogiri::XML.parse(Network.get(base_url))
48
- items = doc.css('Key').collect(&:text)
49
- items.select! { |item| item.include?('IEDriverServer_Win32') }
50
- ds = items.each_with_object({}) do |item, hash|
51
- key = normalize_version item[/([^_]+)\.zip/, 1]
52
- hash[key] = "#{base_url}#{item}"
47
+ ds = download_manifest.each_with_object({}) do |item, hash|
48
+ version = normalize_version item[/([^_]+)\.zip/, 1]
49
+ hash[version] = "#{base_url}#{item}"
53
50
  end
54
51
  Webdrivers.logger.debug "Versions now located on downloads site: #{ds.keys}"
55
52
  ds
56
53
  end
54
+
55
+ 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') }
59
+ end
57
60
  end
58
61
  end
59
62
  end
File without changes
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'net/http'
4
+
3
5
  module Webdrivers
4
6
  #
5
7
  # @api private
File without changes
@@ -148,8 +148,18 @@ module Webdrivers
148
148
  end
149
149
  end
150
150
 
151
+ def apple_m1_architecture?
152
+ if platform == 'mac' && RUBY_PLATFORM.include?('arm64-darwin')
153
+ Webdrivers.logger.debug 'Apple architecture: M1 (arm64-darwin)'
154
+ return true
155
+ end
156
+
157
+ Webdrivers.logger.debug 'Apple architecture: Intel (mac64)'
158
+ false
159
+ end
160
+
151
161
  # @return [TrueClass, FalseClass]
152
- def wsl?
162
+ def wsl_v1?
153
163
  platform == 'linux' && File.open('/proc/version').read.include?('Microsoft')
154
164
  end
155
165
 
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webdrivers
4
- VERSION = '4.4.0'
4
+ VERSION = '4.5.0'
5
5
  end
data/lib/webdrivers.rb CHANGED
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
@@ -52,7 +52,7 @@ describe Webdrivers::ChromeFinder do
52
52
  before do
53
53
  skip "The current platform cannot be WSL, as it's not Linux" unless Selenium::WebDriver::Platform.linux?
54
54
 
55
- allow(Webdrivers::System).to receive(:wsl?).and_return(true)
55
+ allow(Webdrivers::System).to receive(:wsl_v1?).and_return(true)
56
56
  allow(Webdrivers::System).to receive(:to_wsl_path).and_return('')
57
57
  allow(Webdrivers::System).to receive(:to_win32_path).and_return('')
58
58
  end
File without changes