selenium-webdriver 4.0.0.alpha2 → 4.0.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 (113) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +338 -4
  3. data/Gemfile +3 -1
  4. data/LICENSE +1 -1
  5. data/NOTICE +2 -0
  6. data/README.md +4 -5
  7. data/lib/selenium/server.rb +21 -29
  8. data/lib/selenium/webdriver/atoms/findElements.js +122 -0
  9. data/lib/selenium/webdriver/atoms/getAttribute.js +100 -7
  10. data/lib/selenium/webdriver/atoms/isDisplayed.js +76 -78
  11. data/lib/selenium/webdriver/atoms/mutationListener.js +55 -0
  12. data/lib/selenium/webdriver/chrome/driver.rb +26 -56
  13. data/lib/selenium/webdriver/chrome/features.rb +106 -0
  14. data/lib/selenium/webdriver/chrome/options.rb +127 -52
  15. data/lib/selenium/webdriver/chrome/profile.rb +8 -5
  16. data/lib/selenium/webdriver/chrome/service.rb +4 -6
  17. data/lib/selenium/webdriver/chrome.rb +10 -9
  18. data/lib/selenium/webdriver/common/driver.rb +110 -19
  19. data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +43 -0
  20. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +51 -0
  21. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +89 -0
  22. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +77 -0
  23. data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +38 -0
  24. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +45 -0
  25. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +43 -0
  26. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +38 -0
  27. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +5 -8
  28. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +144 -0
  29. data/lib/selenium/webdriver/common/driver_extensions/has_logs.rb +30 -0
  30. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +17 -0
  31. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +6 -27
  32. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +136 -0
  33. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +11 -11
  34. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +77 -0
  35. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +1 -0
  36. data/lib/selenium/webdriver/common/driver_extensions/{rotatable.rb → prints_page.rb} +18 -20
  37. data/lib/selenium/webdriver/common/element.rb +79 -16
  38. data/lib/selenium/webdriver/common/error.rb +12 -0
  39. data/lib/selenium/webdriver/common/interactions/interaction.rb +4 -1
  40. data/lib/selenium/webdriver/common/log_entry.rb +2 -2
  41. data/lib/selenium/webdriver/common/logger.rb +50 -15
  42. data/lib/selenium/webdriver/common/manager.rb +14 -14
  43. data/lib/selenium/webdriver/common/options.rb +186 -0
  44. data/lib/selenium/webdriver/common/platform.rb +6 -1
  45. data/lib/selenium/webdriver/common/port_prober.rb +4 -6
  46. data/lib/selenium/webdriver/common/profile_helper.rb +10 -2
  47. data/lib/selenium/webdriver/common/proxy.rb +6 -3
  48. data/lib/selenium/webdriver/common/search_context.rb +7 -3
  49. data/lib/selenium/webdriver/common/service.rb +23 -113
  50. data/lib/selenium/webdriver/common/service_manager.rb +151 -0
  51. data/lib/selenium/webdriver/common/shadow_root.rb +87 -0
  52. data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
  53. data/lib/selenium/webdriver/common/takes_screenshot.rb +66 -0
  54. data/lib/selenium/webdriver/common/target_locator.rb +32 -4
  55. data/lib/selenium/webdriver/common/timeouts.rb +31 -4
  56. data/lib/selenium/webdriver/common/wait.rb +1 -1
  57. data/lib/selenium/webdriver/common/window.rb +0 -4
  58. data/lib/selenium/webdriver/common.rb +17 -2
  59. data/lib/selenium/webdriver/devtools/console_event.rb +38 -0
  60. data/lib/selenium/webdriver/devtools/exception_event.rb +36 -0
  61. data/lib/selenium/webdriver/devtools/mutation_event.rb +37 -0
  62. data/lib/selenium/webdriver/{chrome/bridge.rb → devtools/pinned_script.rb} +26 -17
  63. data/lib/selenium/webdriver/devtools/request.rb +67 -0
  64. data/lib/selenium/webdriver/devtools/response.rb +66 -0
  65. data/lib/selenium/webdriver/devtools.rb +182 -0
  66. data/lib/selenium/webdriver/edge/driver.rb +5 -31
  67. data/lib/selenium/webdriver/edge/features.rb +44 -0
  68. data/lib/selenium/webdriver/edge/options.rb +11 -48
  69. data/lib/selenium/webdriver/edge/profile.rb +33 -0
  70. data/lib/selenium/webdriver/edge/service.rb +9 -24
  71. data/lib/selenium/webdriver/edge.rb +11 -13
  72. data/lib/selenium/webdriver/firefox/driver.rb +20 -30
  73. data/lib/selenium/webdriver/firefox/extension.rb +8 -0
  74. data/lib/selenium/webdriver/firefox/{bridge.rb → features.rb} +23 -4
  75. data/lib/selenium/webdriver/firefox/options.rb +70 -49
  76. data/lib/selenium/webdriver/firefox/profile.rb +16 -77
  77. data/lib/selenium/webdriver/firefox/service.rb +1 -5
  78. data/lib/selenium/webdriver/firefox.rb +22 -16
  79. data/lib/selenium/webdriver/ie/driver.rb +1 -34
  80. data/lib/selenium/webdriver/ie/options.rb +13 -44
  81. data/lib/selenium/webdriver/ie/service.rb +9 -11
  82. data/lib/selenium/webdriver/ie.rb +8 -7
  83. data/lib/selenium/webdriver/remote/bridge.rb +112 -86
  84. data/lib/selenium/webdriver/remote/capabilities.rb +120 -62
  85. data/lib/selenium/webdriver/remote/commands.rb +7 -0
  86. data/lib/selenium/webdriver/remote/driver.rb +15 -12
  87. data/lib/selenium/webdriver/remote/http/common.rb +0 -5
  88. data/lib/selenium/webdriver/remote/http/default.rb +17 -11
  89. data/lib/selenium/webdriver/remote/http/persistent.rb +11 -6
  90. data/lib/selenium/webdriver/remote.rb +15 -9
  91. data/lib/selenium/webdriver/safari/driver.rb +3 -34
  92. data/lib/selenium/webdriver/safari/{bridge.rb → features.rb} +6 -6
  93. data/lib/selenium/webdriver/safari/options.rb +10 -29
  94. data/lib/selenium/webdriver/safari/service.rb +0 -4
  95. data/lib/selenium/webdriver/safari.rb +16 -8
  96. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -1
  97. data/lib/selenium/webdriver/support/cdp/domain.rb.erb +63 -0
  98. data/lib/selenium/webdriver/support/cdp_client_generator.rb +108 -0
  99. data/lib/selenium/webdriver/support/color.rb +2 -2
  100. data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
  101. data/lib/selenium/webdriver/support/guards/guard.rb +89 -0
  102. data/lib/selenium/webdriver/support/guards/guard_condition.rb +52 -0
  103. data/lib/selenium/webdriver/support/guards.rb +95 -0
  104. data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
  105. data/lib/selenium/webdriver/support/select.rb +2 -2
  106. data/lib/selenium/webdriver/support.rb +1 -0
  107. data/lib/selenium/webdriver/version.rb +1 -1
  108. data/lib/selenium/webdriver.rb +10 -8
  109. data/selenium-webdriver.gemspec +29 -13
  110. metadata +125 -51
  111. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +0 -64
  112. data/lib/selenium/webdriver/firefox/binary.rb +0 -110
  113. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bfdda64a93649dd407e9a99d0547280f33492826
4
- data.tar.gz: 7c643c63e461f17cabb016812cffa21e3001f813
2
+ SHA256:
3
+ metadata.gz: c06a2d4e78b10cc31c89baf7ac72014ca43bf4425b0825ede55d942ef90ae47a
4
+ data.tar.gz: f3d005b5469d38ab07c6a35a032c65b69f97c54ecbd648bbaf5217f43e1a9457
5
5
  SHA512:
6
- metadata.gz: a5b8faba158cabc734b9f0fa8e7fc00bdea0b127bafc2b6f363cefd3bc2aea78d176cc5d042eda9c2271d1dd52d951bd93c8449fdb381e7fa35ebafab3ffe88f
7
- data.tar.gz: 113f4c13373c915447172e43cc5da4435bc785693c06e6a119f9ecdd5fcd3efc01a43b8d295f655be00e5176e3a901f721d6cfa053a606639e5c0b5d5092ecc5
6
+ metadata.gz: dba83257a6a44f2a68fdea7f7c7ae30b2d27802407d22b42bd4262b3ba8a71be00b90de4a1850428a208392ce6ecc63db20b30af8b2b14d910d5a7c20be9c32e
7
+ data.tar.gz: f9bf4b3098e9e9b5487c766e33ccdebda51f4854f3aaf896af12b26875644ab691530700af80d84fc15b73369e27742568aba375800975da9c81fc8e46beeb9d
data/CHANGES CHANGED
@@ -1,3 +1,287 @@
1
+ 4.0.0 (2021-10-13)
2
+ =========================
3
+
4
+ Ruby:
5
+ * Updated minimum required Ruby version to 2.6
6
+ * Updated minimum required rexml gem version due to vulnerability
7
+
8
+ Chrome:
9
+ * Added default values for Network Conditions so no longer need to specify everything
10
+
11
+ Firefox:
12
+ * Fixed bug where Firefox prefs were converting snake case to camel case
13
+
14
+ 4.0.0.rc3 (2021-10-08)
15
+ =========================
16
+
17
+ Ruby:
18
+ * Added support for getting timeout values from the driver
19
+
20
+ 4.0.0.rc2 (2021-09-30)
21
+ =========================
22
+
23
+ DevTools:
24
+ * Released selenium-devtools 0.93.0 (2021-09-01)
25
+ - adds CDP version 93
26
+ - removes CDP version 91
27
+ * Released selenium-devtools 0.94.0 (2021-09-22)
28
+ - adds CDP version 94
29
+ - removes CDP version 92
30
+ * Added support for mutating responses in network interception
31
+
32
+ Ruby:
33
+ * Implemented Options#add_option to work for vendor extension capabilities
34
+ * Fixed bug for requiring uri (#9825 thanks @flanger001)
35
+ * Moved New Window functionality to TargetLocator#new_window to be used with Driver#switch_to
36
+ * Deprecated using Manager#new_window
37
+ * Changed order of logging output (#9850)
38
+ * Added support for web_socket_url capability
39
+
40
+ Chromium:
41
+ * Implemented casting functionality
42
+ * Implemented ability to launch chromium app
43
+ * Implemented support for specifying permissions
44
+ * Added support for Chrome-specific Android functionality with #enable_android
45
+
46
+ Firefox:
47
+ * Implemented context functionality
48
+ * Added support for Firefox-specific Android functionality with #enable_android
49
+
50
+ Remote:
51
+ * Added support for file detector to install Firefox addons from client machine
52
+
53
+ 4.0.0.rc1 (2021-09-01)
54
+ =========================
55
+
56
+ DevTools:
57
+ * Released selenium-devtools 0.92.0 (2021-08-21) which:
58
+ - adds CDP versions 92
59
+ - removes CDP versions 88, 89, 90
60
+
61
+ IE:
62
+ * Added options for running Microsoft Edge in IE mode with IE Driver
63
+
64
+ Remote:
65
+ * Added default file detector for remote driver
66
+
67
+ Ruby:
68
+ * Fixed bug for getting valid capability that has not been set
69
+ * Fixed bug preventing loading of ServerError class
70
+
71
+ 4.0.0.beta4 (2021-06-07)
72
+ =========================
73
+
74
+ Chrome:
75
+ * Fixed bug with camel casing of localState object
76
+
77
+ Firefox:
78
+ * Added support for Full Page Screenshots
79
+
80
+ Remote:
81
+ * Added support for #execute_cdp on Chrome and Edge
82
+
83
+ Ruby:
84
+ * Changed capabilities to use alwaysMatch instead of firstMatch by default
85
+ * Fixed bug preventing Options classes from handling Proxy instances
86
+
87
+ 4.0.0.beta3 (2021-04-13)
88
+ =========================
89
+
90
+ Chrome:
91
+ * Fixed a regression with prefs hash keys being converted to camelCase.
92
+ * Fixed an issue when passing Profile object to Options would fail.
93
+
94
+ DevTools:
95
+ * Released selenium-devtools 0.91.0 which:
96
+ - adds CDP versions 90 and 91
97
+ - removes CDP versions 86 and 87
98
+
99
+ Remote:
100
+ * Added support for setting alwaysMatch/firstMatch capabilities per W3C
101
+ WebDriver specification. It's done using the following methods where
102
+ `caps` is either a Ruby hash with desired capabilities or an instance
103
+ of Remote::Capabilities:
104
+ * Selenium::WebDriver::Remote::Capabilities.always_match(caps)
105
+ * Selenium::WebDriver::Remote::Capabilities.first_match(caps)
106
+ * Added support for Driver#save_print_page.
107
+ * Fixed an issue with Driver#print_page.
108
+ * Added support for setting timeouts capabilities in Remote::Capabilities
109
+ per W3C WebDriver specification.
110
+ * Added support for Element#aria_role which returns WAI-ARIA role of the element.
111
+ * Added support for Element#accessible name which returns WAI-ARIA label of the element.
112
+ * Added support for using DevTools version provided by Grid instead of
113
+ calculating it manually
114
+
115
+ Ruby:
116
+ * Remove JRuby-specific socket poller. Note that this requires JRuby 9.2.8.0+.
117
+
118
+ 4.0.0.beta2 (2021-03-16)
119
+ =========================
120
+
121
+ DevTools:
122
+ * Separated out DevTools methods into selenium-devtools gem to better manage versioning
123
+ * Updated supported versions to 85-89
124
+ * Add support for intercepting browser requests
125
+
126
+ Firefox:
127
+ * Add support for using DevTools commands with Firefox Nightly
128
+
129
+ Remote:
130
+ * Provide access to browser specific driver extensions as appropriate for designated browser
131
+ * Add support for using DevTools commands via Grid
132
+
133
+ Ruby:
134
+ * Spec Guard implementation moved into lib directory for other projects to use
135
+ * Implemented `Element#dom_attribute` to obtain attribute value as defined by w3c specification
136
+ * Implemented `Options#eq?`
137
+ * Allow Options subclass instances to be created from class methods in superclass
138
+
139
+ Safari:
140
+ * Fix bug that prevented usage of Safari Technology Preview
141
+
142
+ 4.0.0.beta1 (2021-02-15)
143
+ =========================
144
+
145
+ DevTools:
146
+ * Updated supported versions to 85-88
147
+
148
+ Edge:
149
+ * Removed support for legacy Edge HTML
150
+
151
+ Firefox:
152
+ * Fixed support for default profile settings
153
+ * Added support for Devtools for Firefox v87+
154
+
155
+ Safari:
156
+ * Removed default platformName specification so it works with Grid
157
+
158
+ Ruby:
159
+ * Added support for httpOnly attribute in Cookies
160
+ * Implemented `#print_page` method (thanks @raju249)
161
+ * Fixed support for missing libraries in Ruby 3.0 (thanks @znz)
162
+ * Deprecated `HTTP::Persistent` class
163
+ * Fixed support for accessors in options classes
164
+ * Added support for status endpoint for all browsers
165
+ * Fix support for Browser, Driver, and Performance Logging in Chrome and Edge
166
+
167
+ 4.0.0.alpha7 (2020-11-10)
168
+ =========================
169
+
170
+ Chrome:
171
+ * Fixed a link to download ChromeDriver when it's not found (thanks @masakazutakewaka).
172
+ * Fixed an issue when passing instance of Profile to an Options in capabilities
173
+ (thanks @masakazutakewaka).
174
+
175
+ DevTools:
176
+ * Added support for multiple version of CDP. Currently supported versions are
177
+ 84-87. The proper version is automatically selected when the browser is started
178
+ based on its version. The implementation is Chromium-based and is confirmed
179
+ to work in Chrome and Edge at least.
180
+ * Added support for basic authentication (see HasAuthentication).
181
+ * Added support for listening to JavaScript console messages (see HasLogEvents).
182
+ * Added support for listening to JavaScript exceptions (see HasLogEvents).
183
+ * Added support for listening to DOM mutations (see HasLogEvents).
184
+
185
+ Edge:
186
+ * Switched default Edge implementation to Chromium-based. To use older versions
187
+ of Edge, pass :edge_html when initializing the driver.
188
+
189
+ Firefox:
190
+ * Fixed an issue whereby using the new capabilities structure in local drivers
191
+ would cause the W3C check to complain that `browser_name` was an invalid
192
+ capability key name (thanks @luke-hill)
193
+
194
+ Ruby:
195
+ * Added support for taking screenshots of individual elements using Element#screenshot
196
+ (thanks @johndouthat).
197
+ * Fixed deprecation message of using Net::HTTP::Proxy (thanks @masakazutakewaka).
198
+ * Fixed false negative detection of Linux on WSL2 (thanks @snsten).
199
+ * Support ChildProcess 4.x versions (thanks @boutil).
200
+
201
+ Safari:
202
+ * Fixed browser name in capabilities for Safari Technology Preview.
203
+
204
+ 4.0.0.alpha6 (2020-05-28)
205
+ =========================
206
+
207
+ Chrome:
208
+ * Added DevTools classes and methods generated from the CDP specification.
209
+ It currently supports commands and events and provides Rubyish API:
210
+ driver.devtools.page.navigate(url: 'http://google.com')
211
+ driver.devtools.console.clear_messages
212
+ driver.devtools.page.enable
213
+ driver.devtools.page.on(:load_event_fired) do |params|
214
+ puts("Page loaded in #{params['timestamp']}")
215
+ end
216
+ Check https://chromedevtools.github.io/devtools-protocol/ for more information
217
+ about possible commands and events. Please note that this API is considered
218
+ to be experimental and may change any time before stable 4.0 release.
219
+ * Fixed an issue when passing :prompt_for_download (or similar snake_cased
220
+ symbols) in Options#prefs would be ignored by Chrome because Selenium
221
+ would internally convert it to camelCased format (:promptForDownload).
222
+ Now :prefs are left intact.
223
+
224
+ Edge:
225
+ * Fixed an issue when Driver#execute_cdp would not work for Chromium-based
226
+ Edge browser.
227
+
228
+ Ruby:
229
+ * Deprecated passing :desired_capabilities and :options to driver initialization
230
+ in favor of :capabilities. They now can be combined in an array to make
231
+ custom capabilities requirements:
232
+ caps = Selenium::WebDriver::Remote::Capabilities.chrome
233
+ opts = Selenium::WebDriver::Chrome::Options.new
234
+ Selenium::WebDriver.for(:remote, capabilities: :chrome)
235
+ Selenium::WebDriver.for(:remote, capabilities: caps)
236
+ Selenium::WebDriver.for(:remote, capabilities: opts)
237
+ Selenium::WebDriver.for(:remote, capabilities: [caps, opts])
238
+ * Deprecated passing Hash to :capabilities in favor of Remote::Capabilities object.
239
+ * Updated minimum require Ruby version to 2.5.
240
+ * Improved keyword arguments handling to avoid warnings in Ruby 2.7.
241
+
242
+ 4.0.0.alpha5 (2020-03-18)
243
+ =========================
244
+
245
+ The release is just to synchronize version with other bindings and does not
246
+ include any changes.
247
+
248
+ 4.0.0.alpha4 (2020-01-09)
249
+ =========================
250
+
251
+ Ruby:
252
+ * Added initial support for relative locators, which allow to find elements
253
+ above/below/left/right/near another element. For example, you can find all
254
+ the cells in a table to the right of your starting cell:
255
+ start_cell = driver.find_element(css: 'td')
256
+ right_cells = driver.find_elements(relative: {tag_name: 'td', right: start_cell})
257
+ The documentation is still lacking so refer to examples in df6be2e962.
258
+ * Added ability to silence certain logger messages by using it's identifiers:
259
+ Selenium::WebDriver.logger.ignore(:driver_path)
260
+ * Added new dependency: websocket. It's used for communicating with Chrome DevTools.
261
+ * Loosened childprocess dependency to allow using version 2.0+.
262
+ * Loosened rubyzip dependency to allow using version 2.0+.
263
+ * Fixed Errno::EACCES error on Linux DeX and similar distributes
264
+
265
+ Chrome:
266
+ * Added initial support for communicating with Chrome DevTools. The implementation
267
+ is very basic and lacks CDP domains, events and types - those will be added
268
+ in future releases. Still, it allows to execute simple commands to DevTools:
269
+ driver.devtools.send('Page.navigate', {url: 'https://google.com'})
270
+
271
+ 4.0.0.alpha3 (2019-07-08)
272
+ =========================
273
+
274
+ Ruby:
275
+ * All documented driver capabilities supported in respective browser Options class by constructor and accessor
276
+ * Driver constructor :options and :desired_capabilities generate the same capabilities for local and remote execution
277
+ * Deprecated :options as keyword for initializing browser Options classes
278
+
279
+ Chrome:
280
+ * Add support for browser logging with latest versions of chromedriver
281
+
282
+ Edge:
283
+ * Add support for Chromium based implementation
284
+
1
285
  4.0.0.alpha2 (2019-05-02)
2
286
  =========================
3
287
 
@@ -34,6 +318,56 @@ Firefox:
34
318
  result in NoMethodError. Now it will find a profile with such name on your
35
319
  system and use it accordingly (issue #7119)
36
320
 
321
+ 3.142.7 (2019-12-27)
322
+ ====================
323
+
324
+ Ruby:
325
+ * Fix keyword argument deprecations in Ruby 2.7 (thanks @connorshea)
326
+
327
+ 3.142.6 (2019-10-04)
328
+ ====================
329
+
330
+ Ruby:
331
+ * Loosen ChildProcess dependency so that 3.0+ can be used (thanks @jaredbeck)
332
+
333
+ 3.142.5 (2019-10-01)
334
+ ====================
335
+
336
+ Ruby:
337
+ * Loosen RubyZip dependency so that 1.3+ can be used (thanks @vtamara)
338
+
339
+ 3.142.4 (2019-09-02)
340
+ ====================
341
+
342
+ Chrome:
343
+ * Added support for new command for getting logs in ChromeDriver 76+
344
+ with W3C mode on
345
+
346
+ 3.142.3 (2019-05-21)
347
+ ====================
348
+
349
+ Firefox:
350
+ * Fixed a regression when Firefox binary path was not sent to GeckoDriver
351
+ by default and browser could not be located (issue #7219)
352
+
353
+ 3.142.2 (2019-05-11)
354
+ ====================
355
+
356
+ Chrome:
357
+ * Fixed an issue when getting/setting network conditions and sending CDP
358
+ commands didn't work with Grid (issue #7174)
359
+
360
+ Safari:
361
+ * Fixed an issue when getting/setting permissions and attaching debugger
362
+ didn't work with Grid (issue #7174)
363
+
364
+ 3.142.1 (2019-05-07)
365
+ ====================
366
+
367
+ Firefox:
368
+ * Fixed an issue when processing error in legacy driver would result
369
+ in NoMethodError (issue #7178)
370
+
37
371
  3.142.0 (2019-04-24)
38
372
  ====================
39
373
 
@@ -566,11 +900,11 @@ Ruby:
566
900
  * Fix bug in auto detection of drivers which allowed selection of non-executable binaries
567
901
 
568
902
  W3C:
569
- * Implement #cookie_named and #delete_all_cookies methods (thanks lmtierney)
570
- * Implement element #property method (thanks lmtierney)
903
+ * Implement #cookie_named and #delete_all_cookies methods (thanks lmtierney)
904
+ * Implement element #property method (thanks lmtierney)
571
905
 
572
906
  Chrome:
573
- * Fix bug in switches (thanks danvine)
907
+ * Fix bug in switches (thanks danvine)
574
908
 
575
909
  3.0.1 (2016-11-06)
576
910
  ===================
@@ -592,7 +926,7 @@ Ruby:
592
926
  * Add support for latest driver options
593
927
  * Add support for :port parameter for launching driver
594
928
  * Add support for :service_args parameter for driver command line switches
595
- * Improve reliability by increasing service shutdown timeout (#2815; thanks John Barbuto )
929
+ * Improve reliability by increasing service shutdown timeout (#2815; thanks John Barbuto )
596
930
 
597
931
  Firefox:
598
932
  * Add support for :firefox_options in geckodriver
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  source 'https://rubygems.org'
4
- gemspec
4
+ Dir["#{__dir__}/*.gemspec"].each do |spec|
5
+ gemspec name: File.basename(spec, '.gemspec')
6
+ end
data/LICENSE CHANGED
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright 2019 Software Freedom Conservancy (SFC)
190
+ Copyright 2021 Software Freedom Conservancy (SFC)
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
data/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ Copyright 2011-2021 Software Freedom Conservancy
2
+ Copyright 2004-2011 Selenium committers
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # selenium-webdriver
2
2
 
3
- This gem provides Ruby bindings for WebDriver
4
- and has been tested to work on MRI (2.0 through 2.2),
3
+ This gem provides Ruby bindings for Selenium and supports MRI >= 2.6
5
4
 
6
5
  ## Install
7
6
 
@@ -9,14 +8,14 @@ and has been tested to work on MRI (2.0 through 2.2),
9
8
 
10
9
  ## Links
11
10
 
12
- * http://rubygems.org/gems/selenium-webdriver
13
- * http://seleniumhq.github.io/selenium/docs/api/rb/index.html
11
+ * https://rubygems.org/gems/selenium-webdriver
12
+ * https://www.selenium.dev/selenium/docs/api/rb/index.html
14
13
  * https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings
15
14
  * https://github.com/SeleniumHQ/selenium/issues
16
15
 
17
16
  ## License
18
17
 
19
- Copyright 2009-2018 Software Freedom Conservancy
18
+ Copyright 2009-2021 Software Freedom Conservancy
20
19
 
21
20
  Licensed to the Software Freedom Conservancy (SFC) under one
22
21
  or more contributor license agreements. See the NOTICE file
@@ -74,7 +74,7 @@ module Selenium
74
74
 
75
75
  begin
76
76
  File.open(download_file_name, 'wb') do |destination|
77
- net_http.start('selenium-release.storage.googleapis.com') do |http|
77
+ net_http_start('selenium-release.storage.googleapis.com') do |http|
78
78
  resp = http.request_get("/#{required_version[/(\d+\.\d+)\./, 1]}/#{download_file_name}") do |response|
79
79
  total = response.content_length
80
80
  progress = 0
@@ -85,7 +85,7 @@ module Selenium
85
85
  segment_count += 1
86
86
 
87
87
  if (segment_count % 15).zero?
88
- percent = (progress.to_f / total.to_f) * 100
88
+ percent = progress.fdiv(total) * 100
89
89
  print "#{CL_RESET}Downloading #{download_file_name}: #{percent.to_i}% (#{progress} / #{total})"
90
90
  segment_count = 0
91
91
  end
@@ -97,7 +97,7 @@ module Selenium
97
97
  raise Error, "#{resp.code} for #{download_file_name}" unless resp.is_a? Net::HTTPSuccess
98
98
  end
99
99
  end
100
- rescue
100
+ rescue StandardError
101
101
  FileUtils.rm download_file_name if File.exist? download_file_name
102
102
  raise
103
103
  end
@@ -111,7 +111,7 @@ module Selenium
111
111
 
112
112
  def latest
113
113
  require 'rexml/document'
114
- net_http.start('selenium-release.storage.googleapis.com') do |http|
114
+ net_http_start('selenium-release.storage.googleapis.com') do |http|
115
115
  versions = REXML::Document.new(http.get('/').body).root.get_elements('//Contents/Key').map do |e|
116
116
  e.text[/selenium-server-standalone-(\d+\.\d+\.\d+)\.jar/, 1]
117
117
  end
@@ -120,43 +120,26 @@ module Selenium
120
120
  end
121
121
  end
122
122
 
123
- def net_http
123
+ def net_http_start(address, &block)
124
124
  http_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
125
125
 
126
126
  if http_proxy
127
127
  http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?('http://')
128
128
  uri = URI.parse(http_proxy)
129
129
 
130
- Net::HTTP::Proxy(uri.host, uri.port)
130
+ Net::HTTP.start(address, nil, uri.host, uri.port, &block)
131
131
  else
132
- Net::HTTP
132
+ Net::HTTP.start(address, &block)
133
133
  end
134
134
  end
135
135
  end
136
136
 
137
137
  #
138
- # The server port
138
+ # The Mode of the Server
139
+ # :standalone, #hub, #node
139
140
  #
140
141
 
141
- attr_accessor :port
142
-
143
- #
144
- # The server timeout
145
- #
146
-
147
- attr_accessor :timeout
148
-
149
- #
150
- # Whether to launch the server in the background
151
- #
152
-
153
- attr_accessor :background
154
-
155
- #
156
- # Path to log file, or 'true' for stdout.
157
- #
158
-
159
- attr_accessor :log
142
+ attr_accessor :role, :port, :timeout, :background, :log
160
143
 
161
144
  #
162
145
  # @param [String] jar Path to the server jar.
@@ -175,11 +158,12 @@ module Selenium
175
158
 
176
159
  @jar = jar
177
160
  @host = '127.0.0.1'
161
+ @role = opts.fetch(:role, 'standalone')
178
162
  @port = opts.fetch(:port, 4444)
179
163
  @timeout = opts.fetch(:timeout, 30)
180
164
  @background = opts.fetch(:background, false)
181
165
  @log = opts[:log]
182
-
166
+ @log_file = nil
183
167
  @additional_args = []
184
168
  end
185
169
 
@@ -216,6 +200,10 @@ module Selenium
216
200
 
217
201
  private
218
202
 
203
+ def selenium4?
204
+ @jar.match?(/[^.]4\./) || @jar.include?('deploy')
205
+ end
206
+
219
207
  def stop_process
220
208
  return unless @process.alive?
221
209
 
@@ -234,7 +222,11 @@ module Selenium
234
222
  @process ||= begin
235
223
  # extract any additional_args that start with -D as options
236
224
  properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
237
- server_command = ['java'] + properties + ['-jar', @jar, '-port', @port.to_s] + @additional_args
225
+ args = ['-jar', @jar]
226
+ args << @role if selenium4?
227
+ args << (selenium4? ? '--port' : '-port')
228
+ args << @port.to_s
229
+ server_command = ['java'] + properties + args + @additional_args
238
230
  cp = ChildProcess.build(*server_command)
239
231
  WebDriver.logger.debug("Executing Process #{server_command}")
240
232