selenium-webdriver 3.142.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +406 -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 +69 -63
  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 -70
  13. data/lib/selenium/webdriver/chrome/features.rb +106 -0
  14. data/lib/selenium/webdriver/chrome/options.rb +128 -53
  15. data/lib/selenium/webdriver/chrome/profile.rb +8 -5
  16. data/lib/selenium/webdriver/chrome/service.rb +8 -15
  17. data/lib/selenium/webdriver/chrome.rb +10 -9
  18. data/lib/selenium/webdriver/common/action_builder.rb +97 -249
  19. data/lib/selenium/webdriver/common/driver.rb +112 -23
  20. data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +43 -0
  21. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +51 -0
  22. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +89 -0
  23. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +77 -0
  24. data/lib/selenium/webdriver/common/driver_extensions/{has_touch_screen.rb → has_cdp.rb} +10 -8
  25. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +45 -0
  26. data/lib/selenium/webdriver/{firefox/util.rb → common/driver_extensions/has_devtools.rb} +16 -19
  27. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +38 -0
  28. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +5 -8
  29. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +144 -0
  30. data/lib/selenium/webdriver/common/driver_extensions/has_logs.rb +30 -0
  31. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +17 -0
  32. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +6 -27
  33. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +136 -0
  34. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +11 -11
  35. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +77 -0
  36. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +1 -0
  37. data/lib/selenium/webdriver/common/driver_extensions/{rotatable.rb → prints_page.rb} +18 -20
  38. data/lib/selenium/webdriver/common/element.rb +82 -22
  39. data/lib/selenium/webdriver/common/error.rb +32 -196
  40. data/lib/selenium/webdriver/common/interactions/interaction.rb +4 -1
  41. data/lib/selenium/webdriver/common/interactions/key_actions.rb +5 -5
  42. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +13 -13
  43. data/lib/selenium/webdriver/common/log_entry.rb +2 -2
  44. data/lib/selenium/webdriver/common/logger.rb +50 -15
  45. data/lib/selenium/webdriver/common/manager.rb +15 -15
  46. data/lib/selenium/webdriver/common/options.rb +184 -0
  47. data/lib/selenium/webdriver/common/platform.rb +6 -1
  48. data/lib/selenium/webdriver/common/port_prober.rb +4 -6
  49. data/lib/selenium/webdriver/common/profile_helper.rb +11 -9
  50. data/lib/selenium/webdriver/common/proxy.rb +6 -3
  51. data/lib/selenium/webdriver/common/search_context.rb +7 -3
  52. data/lib/selenium/webdriver/common/service.rb +27 -122
  53. data/lib/selenium/webdriver/common/service_manager.rb +151 -0
  54. data/lib/selenium/webdriver/common/shadow_root.rb +87 -0
  55. data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
  56. data/lib/selenium/webdriver/common/socket_poller.rb +2 -2
  57. data/lib/selenium/webdriver/common/takes_screenshot.rb +66 -0
  58. data/lib/selenium/webdriver/common/target_locator.rb +32 -4
  59. data/lib/selenium/webdriver/common/timeouts.rb +31 -4
  60. data/lib/selenium/webdriver/common/wait.rb +1 -1
  61. data/lib/selenium/webdriver/common/window.rb +0 -4
  62. data/lib/selenium/webdriver/common/zipper.rb +3 -9
  63. data/lib/selenium/webdriver/common.rb +24 -17
  64. data/lib/selenium/webdriver/devtools/console_event.rb +38 -0
  65. data/lib/selenium/webdriver/devtools/exception_event.rb +36 -0
  66. data/lib/selenium/webdriver/devtools/mutation_event.rb +37 -0
  67. data/lib/selenium/webdriver/devtools/pinned_script.rb +59 -0
  68. data/lib/selenium/webdriver/devtools/request.rb +67 -0
  69. data/lib/selenium/webdriver/devtools/response.rb +66 -0
  70. data/lib/selenium/webdriver/devtools.rb +193 -0
  71. data/lib/selenium/webdriver/edge/driver.rb +7 -29
  72. data/lib/selenium/webdriver/{chrome/bridge.rb → edge/features.rb} +16 -22
  73. data/lib/selenium/webdriver/edge/options.rb +11 -48
  74. data/lib/selenium/webdriver/{common/w3c_manager.rb → edge/profile.rb} +7 -19
  75. data/lib/selenium/webdriver/edge/service.rb +10 -26
  76. data/lib/selenium/webdriver/edge.rb +11 -14
  77. data/lib/selenium/webdriver/firefox/driver.rb +31 -19
  78. data/lib/selenium/webdriver/firefox/extension.rb +8 -0
  79. data/lib/selenium/webdriver/firefox/{bridge.rb → features.rb} +23 -4
  80. data/lib/selenium/webdriver/firefox/options.rb +71 -50
  81. data/lib/selenium/webdriver/firefox/profile.rb +21 -71
  82. data/lib/selenium/webdriver/firefox/service.rb +5 -9
  83. data/lib/selenium/webdriver/firefox.rb +22 -20
  84. data/lib/selenium/webdriver/ie/driver.rb +1 -47
  85. data/lib/selenium/webdriver/ie/options.rb +15 -46
  86. data/lib/selenium/webdriver/ie/service.rb +13 -15
  87. data/lib/selenium/webdriver/ie.rb +8 -7
  88. data/lib/selenium/webdriver/remote/bridge.rb +561 -86
  89. data/lib/selenium/webdriver/remote/capabilities.rb +159 -123
  90. data/lib/selenium/webdriver/remote/commands.rb +7 -0
  91. data/lib/selenium/webdriver/remote/driver.rb +22 -12
  92. data/lib/selenium/webdriver/remote/http/common.rb +0 -5
  93. data/lib/selenium/webdriver/remote/http/default.rb +17 -20
  94. data/lib/selenium/webdriver/remote/http/persistent.rb +11 -6
  95. data/lib/selenium/webdriver/remote/response.rb +16 -47
  96. data/lib/selenium/webdriver/remote.rb +15 -12
  97. data/lib/selenium/webdriver/safari/driver.rb +3 -31
  98. data/lib/selenium/webdriver/safari/{bridge.rb → features.rb} +6 -6
  99. data/lib/selenium/webdriver/safari/options.rb +10 -29
  100. data/lib/selenium/webdriver/safari/service.rb +4 -8
  101. data/lib/selenium/webdriver/safari.rb +17 -9
  102. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -1
  103. data/lib/selenium/webdriver/support/cdp/domain.rb.erb +63 -0
  104. data/lib/selenium/webdriver/support/cdp_client_generator.rb +108 -0
  105. data/lib/selenium/webdriver/support/color.rb +2 -2
  106. data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
  107. data/lib/selenium/webdriver/support/guards/guard.rb +89 -0
  108. data/lib/selenium/webdriver/{firefox/marionette/bridge.rb → support/guards/guard_condition.rb} +22 -19
  109. data/lib/selenium/webdriver/support/guards.rb +95 -0
  110. data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
  111. data/lib/selenium/webdriver/support/select.rb +3 -3
  112. data/lib/selenium/webdriver/support.rb +1 -0
  113. data/lib/selenium/webdriver/version.rb +1 -1
  114. data/lib/selenium/webdriver.rb +13 -13
  115. data/selenium-webdriver.gemspec +29 -13
  116. metadata +125 -73
  117. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  118. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +0 -64
  119. data/lib/selenium/webdriver/common/keyboard.rb +0 -70
  120. data/lib/selenium/webdriver/common/mouse.rb +0 -89
  121. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
  122. data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
  123. data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
  124. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  125. data/lib/selenium/webdriver/firefox/binary.rb +0 -187
  126. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
  127. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  128. data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
  129. data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
  130. data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
  131. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  132. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  133. data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
  134. data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
  135. data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
  136. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
  137. data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2c657055dd2ca16d14d6b0623dd69ee7de563b3b
4
- data.tar.gz: 440612d6a75c57b84e00b8665ca95be9fbbd1df1
2
+ SHA256:
3
+ metadata.gz: 40e4bef1fdee7ae817c56466ec231be400d677d56a8c8f46b797c6b3eba28de9
4
+ data.tar.gz: a9c1af31f12db6096f06c2a89e487e40ea2bb53b8f6e46e5f77a3046f149bb34
5
5
  SHA512:
6
- metadata.gz: 0fb071b1de096c35e05363ee76f2732a4a8b6101b5442da8ef511e21d59b8025429661314ceec35348604dc703451b5b2ce191aac1612e07cede6fe739ef4b85
7
- data.tar.gz: f321a58fb2e9de33d686a3bfd8acb3b9f9c4e96741380cd9114d9070971b6c59ce098cc551bb3ec757283dfbf3f36d3cfbd94ae547a484abf183aae390543bcd
6
+ metadata.gz: b5325d0fe9f5fdb721ed4a6daa1384d7876dc7a072dd52f46c73d76b1614434c123fff2b4a9d7de01538968eddfbad57f2e1a87f4dce0e560a850dcf21988840
7
+ data.tar.gz: 3b345ac66d051c32267d1c4ef9b2dd70aea36e2c4e5bb35ce30197d748effca8fed460824d1961ad5a39340358fc9be3f200708a38557e5e878b09be1b0d61c0
data/CHANGES CHANGED
@@ -1,3 +1,405 @@
1
+ 4.1.0 (2021-11-18)
2
+ =========================
3
+
4
+ DevTools:
5
+ * Released selenium-devtools 0.95.0 (supports CDP v85, v93, v94, v95)
6
+ * Released selenium-devtools 0.96.0 (supports CDP v85, v94, v95, v96)
7
+ * Added support for secure websockets (#10017)
8
+
9
+ Ruby:
10
+ * Execute Script supports ShadowRoots (#10019)
11
+ * Fixed bug preventing zipping temp files on Windows (#9987)
12
+ * Sang Pumpkin Carol (thanks Jari!)
13
+
14
+ 4.0.3 (2021-10-20)
15
+ =========================
16
+
17
+ Firefox:
18
+ * Fixed bug avoiding camel casing prefs (#9944 thanks @glaszig)
19
+
20
+ Ruby:
21
+ * Fixed bug in Select class for finding by index (#9945)
22
+
23
+ Remote:
24
+ * Fixed bug preventing sending keys with an empty value
25
+
26
+ 4.0.2 (2021-10-19)
27
+ =========================
28
+
29
+ Server:
30
+ * Fixed bug in new download code.
31
+
32
+ 4.0.1 (2021-10-19)
33
+ =========================
34
+
35
+ Server:
36
+ * Fixed download by pointing to new storage location.
37
+ - Only supports Selenium 4 versions
38
+ * Added default value for Server::get and Server::download to use the latest server version
39
+
40
+ 4.0.0 (2021-10-13)
41
+ =========================
42
+
43
+ Ruby:
44
+ * Updated minimum required Ruby version to 2.6
45
+ * Updated minimum required rexml gem version due to vulnerability
46
+
47
+ Chrome:
48
+ * Added default values for Network Conditions so no longer need to specify everything
49
+
50
+ Firefox:
51
+ * Fixed bug where Firefox prefs were converting snake case to camel case
52
+
53
+ 4.0.0.rc3 (2021-10-08)
54
+ =========================
55
+
56
+ Ruby:
57
+ * Added support for getting timeout values from the driver
58
+
59
+ 4.0.0.rc2 (2021-09-30)
60
+ =========================
61
+
62
+ DevTools:
63
+ * Released selenium-devtools 0.93.0 (2021-09-01)
64
+ - adds CDP version 93
65
+ - removes CDP version 91
66
+ * Released selenium-devtools 0.94.0 (2021-09-22)
67
+ - adds CDP version 94
68
+ - removes CDP version 92
69
+ * Added support for mutating responses in network interception
70
+
71
+ Ruby:
72
+ * Implemented Options#add_option to work for vendor extension capabilities
73
+ * Fixed bug for requiring uri (#9825 thanks @flanger001)
74
+ * Moved New Window functionality to TargetLocator#new_window to be used with Driver#switch_to
75
+ * Deprecated using Manager#new_window
76
+ * Changed order of logging output (#9850)
77
+ * Added support for web_socket_url capability
78
+
79
+ Chromium:
80
+ * Implemented casting functionality
81
+ * Implemented ability to launch chromium app
82
+ * Implemented support for specifying permissions
83
+ * Added support for Chrome-specific Android functionality with #enable_android
84
+
85
+ Firefox:
86
+ * Implemented context functionality
87
+ * Added support for Firefox-specific Android functionality with #enable_android
88
+
89
+ Remote:
90
+ * Added support for file detector to install Firefox addons from client machine
91
+
92
+ 4.0.0.rc1 (2021-09-01)
93
+ =========================
94
+
95
+ DevTools:
96
+ * Released selenium-devtools 0.92.0 (2021-08-21) which:
97
+ - adds CDP versions 92
98
+ - removes CDP versions 88, 89, 90
99
+
100
+ IE:
101
+ * Added options for running Microsoft Edge in IE mode with IE Driver
102
+
103
+ Remote:
104
+ * Added default file detector for remote driver
105
+
106
+ Ruby:
107
+ * Fixed bug for getting valid capability that has not been set
108
+ * Fixed bug preventing loading of ServerError class
109
+
110
+ 4.0.0.beta4 (2021-06-07)
111
+ =========================
112
+
113
+ Chrome:
114
+ * Fixed bug with camel casing of localState object
115
+
116
+ Firefox:
117
+ * Added support for Full Page Screenshots
118
+
119
+ Remote:
120
+ * Added support for #execute_cdp on Chrome and Edge
121
+
122
+ Ruby:
123
+ * Changed capabilities to use alwaysMatch instead of firstMatch by default
124
+ * Fixed bug preventing Options classes from handling Proxy instances
125
+
126
+ 4.0.0.beta3 (2021-04-13)
127
+ =========================
128
+
129
+ Chrome:
130
+ * Fixed a regression with prefs hash keys being converted to camelCase.
131
+ * Fixed an issue when passing Profile object to Options would fail.
132
+
133
+ DevTools:
134
+ * Released selenium-devtools 0.91.0 which:
135
+ - adds CDP versions 90 and 91
136
+ - removes CDP versions 86 and 87
137
+
138
+ Remote:
139
+ * Added support for setting alwaysMatch/firstMatch capabilities per W3C
140
+ WebDriver specification. It's done using the following methods where
141
+ `caps` is either a Ruby hash with desired capabilities or an instance
142
+ of Remote::Capabilities:
143
+ * Selenium::WebDriver::Remote::Capabilities.always_match(caps)
144
+ * Selenium::WebDriver::Remote::Capabilities.first_match(caps)
145
+ * Added support for Driver#save_print_page.
146
+ * Fixed an issue with Driver#print_page.
147
+ * Added support for setting timeouts capabilities in Remote::Capabilities
148
+ per W3C WebDriver specification.
149
+ * Added support for Element#aria_role which returns WAI-ARIA role of the element.
150
+ * Added support for Element#accessible name which returns WAI-ARIA label of the element.
151
+ * Added support for using DevTools version provided by Grid instead of
152
+ calculating it manually
153
+
154
+ Ruby:
155
+ * Remove JRuby-specific socket poller. Note that this requires JRuby 9.2.8.0+.
156
+
157
+ 4.0.0.beta2 (2021-03-16)
158
+ =========================
159
+
160
+ DevTools:
161
+ * Separated out DevTools methods into selenium-devtools gem to better manage versioning
162
+ * Updated supported versions to 85-89
163
+ * Add support for intercepting browser requests
164
+
165
+ Firefox:
166
+ * Add support for using DevTools commands with Firefox Nightly
167
+
168
+ Remote:
169
+ * Provide access to browser specific driver extensions as appropriate for designated browser
170
+ * Add support for using DevTools commands via Grid
171
+
172
+ Ruby:
173
+ * Spec Guard implementation moved into lib directory for other projects to use
174
+ * Implemented `Element#dom_attribute` to obtain attribute value as defined by w3c specification
175
+ * Implemented `Options#eq?`
176
+ * Allow Options subclass instances to be created from class methods in superclass
177
+
178
+ Safari:
179
+ * Fix bug that prevented usage of Safari Technology Preview
180
+
181
+ 4.0.0.beta1 (2021-02-15)
182
+ =========================
183
+
184
+ DevTools:
185
+ * Updated supported versions to 85-88
186
+
187
+ Edge:
188
+ * Removed support for legacy Edge HTML
189
+
190
+ Firefox:
191
+ * Fixed support for default profile settings
192
+ * Added support for Devtools for Firefox v87+
193
+
194
+ Safari:
195
+ * Removed default platformName specification so it works with Grid
196
+
197
+ Ruby:
198
+ * Added support for httpOnly attribute in Cookies
199
+ * Implemented `#print_page` method (thanks @raju249)
200
+ * Fixed support for missing libraries in Ruby 3.0 (thanks @znz)
201
+ * Deprecated `HTTP::Persistent` class
202
+ * Fixed support for accessors in options classes
203
+ * Added support for status endpoint for all browsers
204
+ * Fix support for Browser, Driver, and Performance Logging in Chrome and Edge
205
+
206
+ 4.0.0.alpha7 (2020-11-10)
207
+ =========================
208
+
209
+ Chrome:
210
+ * Fixed a link to download ChromeDriver when it's not found (thanks @masakazutakewaka).
211
+ * Fixed an issue when passing instance of Profile to an Options in capabilities
212
+ (thanks @masakazutakewaka).
213
+
214
+ DevTools:
215
+ * Added support for multiple version of CDP. Currently supported versions are
216
+ 84-87. The proper version is automatically selected when the browser is started
217
+ based on its version. The implementation is Chromium-based and is confirmed
218
+ to work in Chrome and Edge at least.
219
+ * Added support for basic authentication (see HasAuthentication).
220
+ * Added support for listening to JavaScript console messages (see HasLogEvents).
221
+ * Added support for listening to JavaScript exceptions (see HasLogEvents).
222
+ * Added support for listening to DOM mutations (see HasLogEvents).
223
+
224
+ Edge:
225
+ * Switched default Edge implementation to Chromium-based. To use older versions
226
+ of Edge, pass :edge_html when initializing the driver.
227
+
228
+ Firefox:
229
+ * Fixed an issue whereby using the new capabilities structure in local drivers
230
+ would cause the W3C check to complain that `browser_name` was an invalid
231
+ capability key name (thanks @luke-hill)
232
+
233
+ Ruby:
234
+ * Added support for taking screenshots of individual elements using Element#screenshot
235
+ (thanks @johndouthat).
236
+ * Fixed deprecation message of using Net::HTTP::Proxy (thanks @masakazutakewaka).
237
+ * Fixed false negative detection of Linux on WSL2 (thanks @snsten).
238
+ * Support ChildProcess 4.x versions (thanks @boutil).
239
+
240
+ Safari:
241
+ * Fixed browser name in capabilities for Safari Technology Preview.
242
+
243
+ 4.0.0.alpha6 (2020-05-28)
244
+ =========================
245
+
246
+ Chrome:
247
+ * Added DevTools classes and methods generated from the CDP specification.
248
+ It currently supports commands and events and provides Rubyish API:
249
+ driver.devtools.page.navigate(url: 'http://google.com')
250
+ driver.devtools.console.clear_messages
251
+ driver.devtools.page.enable
252
+ driver.devtools.page.on(:load_event_fired) do |params|
253
+ puts("Page loaded in #{params['timestamp']}")
254
+ end
255
+ Check https://chromedevtools.github.io/devtools-protocol/ for more information
256
+ about possible commands and events. Please note that this API is considered
257
+ to be experimental and may change any time before stable 4.0 release.
258
+ * Fixed an issue when passing :prompt_for_download (or similar snake_cased
259
+ symbols) in Options#prefs would be ignored by Chrome because Selenium
260
+ would internally convert it to camelCased format (:promptForDownload).
261
+ Now :prefs are left intact.
262
+
263
+ Edge:
264
+ * Fixed an issue when Driver#execute_cdp would not work for Chromium-based
265
+ Edge browser.
266
+
267
+ Ruby:
268
+ * Deprecated passing :desired_capabilities and :options to driver initialization
269
+ in favor of :capabilities. They now can be combined in an array to make
270
+ custom capabilities requirements:
271
+ caps = Selenium::WebDriver::Remote::Capabilities.chrome
272
+ opts = Selenium::WebDriver::Chrome::Options.new
273
+ Selenium::WebDriver.for(:remote, capabilities: :chrome)
274
+ Selenium::WebDriver.for(:remote, capabilities: caps)
275
+ Selenium::WebDriver.for(:remote, capabilities: opts)
276
+ Selenium::WebDriver.for(:remote, capabilities: [caps, opts])
277
+ * Deprecated passing Hash to :capabilities in favor of Remote::Capabilities object.
278
+ * Updated minimum require Ruby version to 2.5.
279
+ * Improved keyword arguments handling to avoid warnings in Ruby 2.7.
280
+
281
+ 4.0.0.alpha5 (2020-03-18)
282
+ =========================
283
+
284
+ The release is just to synchronize version with other bindings and does not
285
+ include any changes.
286
+
287
+ 4.0.0.alpha4 (2020-01-09)
288
+ =========================
289
+
290
+ Ruby:
291
+ * Added initial support for relative locators, which allow to find elements
292
+ above/below/left/right/near another element. For example, you can find all
293
+ the cells in a table to the right of your starting cell:
294
+ start_cell = driver.find_element(css: 'td')
295
+ right_cells = driver.find_elements(relative: {tag_name: 'td', right: start_cell})
296
+ The documentation is still lacking so refer to examples in df6be2e962.
297
+ * Added ability to silence certain logger messages by using it's identifiers:
298
+ Selenium::WebDriver.logger.ignore(:driver_path)
299
+ * Added new dependency: websocket. It's used for communicating with Chrome DevTools.
300
+ * Loosened childprocess dependency to allow using version 2.0+.
301
+ * Loosened rubyzip dependency to allow using version 2.0+.
302
+ * Fixed Errno::EACCES error on Linux DeX and similar distributes
303
+
304
+ Chrome:
305
+ * Added initial support for communicating with Chrome DevTools. The implementation
306
+ is very basic and lacks CDP domains, events and types - those will be added
307
+ in future releases. Still, it allows to execute simple commands to DevTools:
308
+ driver.devtools.send('Page.navigate', {url: 'https://google.com'})
309
+
310
+ 4.0.0.alpha3 (2019-07-08)
311
+ =========================
312
+
313
+ Ruby:
314
+ * All documented driver capabilities supported in respective browser Options class by constructor and accessor
315
+ * Driver constructor :options and :desired_capabilities generate the same capabilities for local and remote execution
316
+ * Deprecated :options as keyword for initializing browser Options classes
317
+
318
+ Chrome:
319
+ * Add support for browser logging with latest versions of chromedriver
320
+
321
+ Edge:
322
+ * Add support for Chromium based implementation
323
+
324
+ 4.0.0.alpha2 (2019-05-02)
325
+ =========================
326
+
327
+ Ruby:
328
+ * Fixed an issue with previous alpha release which lead to removed files
329
+ being packaged inside the gem
330
+
331
+ 4.0.0.alpha1 (2019-05-01)
332
+ =========================
333
+
334
+ Ruby:
335
+ * Removed Mouse and Keyboard as their implementations are not compliant to WebDriver specification
336
+ * Removed TouchActionBuilder as its implementation is not compliant to WebDriver specification
337
+ * Change ActionBuilder to be fully compliant to WebDriver specification
338
+ * Change Manager to be fully compliant to WebDriver specification
339
+ * Removed all deprecated errors that are not compliant to WebDriver specification
340
+ * Update minimum required Ruby version to 2.4
341
+ * Changed capabilities to use only those that are compliant to WebDriver specification
342
+ * Removed deprecated timeout setter on default HTTP client
343
+ * Removed deprecated Remote::W3C::Capabilities
344
+ * Fixed an issue when services are not shutdown properly
345
+
346
+ Chrome:
347
+ * Removed support for OSS mode - use W3C mode instead by using
348
+ Selenium::WebDriver::Chrome::Options.new(options: {w3c: true})
349
+
350
+ PhantomJS:
351
+ * Removed support for PhantomJS driver
352
+
353
+ Firefox:
354
+ * Removed support for legacy Firefox driver - use GeckoDriver instead
355
+ * Removed deprecated outdated capabilities
356
+ * Fixed an issue when passing :profile string to Firefox::Options.new would
357
+ result in NoMethodError. Now it will find a profile with such name on your
358
+ system and use it accordingly (issue #7119)
359
+
360
+ 3.142.7 (2019-12-27)
361
+ ====================
362
+
363
+ Ruby:
364
+ * Fix keyword argument deprecations in Ruby 2.7 (thanks @connorshea)
365
+
366
+ 3.142.6 (2019-10-04)
367
+ ====================
368
+
369
+ Ruby:
370
+ * Loosen ChildProcess dependency so that 3.0+ can be used (thanks @jaredbeck)
371
+
372
+ 3.142.5 (2019-10-01)
373
+ ====================
374
+
375
+ Ruby:
376
+ * Loosen RubyZip dependency so that 1.3+ can be used (thanks @vtamara)
377
+
378
+ 3.142.4 (2019-09-02)
379
+ ====================
380
+
381
+ Chrome:
382
+ * Added support for new command for getting logs in ChromeDriver 76+
383
+ with W3C mode on
384
+
385
+ 3.142.3 (2019-05-21)
386
+ ====================
387
+
388
+ Firefox:
389
+ * Fixed a regression when Firefox binary path was not sent to GeckoDriver
390
+ by default and browser could not be located (issue #7219)
391
+
392
+ 3.142.2 (2019-05-11)
393
+ ====================
394
+
395
+ Chrome:
396
+ * Fixed an issue when getting/setting network conditions and sending CDP
397
+ commands didn't work with Grid (issue #7174)
398
+
399
+ Safari:
400
+ * Fixed an issue when getting/setting permissions and attaching debugger
401
+ didn't work with Grid (issue #7174)
402
+
1
403
  3.142.1 (2019-05-07)
2
404
  ====================
3
405
 
@@ -537,11 +939,11 @@ Ruby:
537
939
  * Fix bug in auto detection of drivers which allowed selection of non-executable binaries
538
940
 
539
941
  W3C:
540
- * Implement #cookie_named and #delete_all_cookies methods (thanks lmtierney)
541
- * Implement element #property method (thanks lmtierney)
942
+ * Implement #cookie_named and #delete_all_cookies methods (thanks lmtierney)
943
+ * Implement element #property method (thanks lmtierney)
542
944
 
543
945
  Chrome:
544
- * Fix bug in switches (thanks danvine)
946
+ * Fix bug in switches (thanks danvine)
545
947
 
546
948
  3.0.1 (2016-11-06)
547
949
  ===================
@@ -563,7 +965,7 @@ Ruby:
563
965
  * Add support for latest driver options
564
966
  * Add support for :port parameter for launching driver
565
967
  * Add support for :service_args parameter for driver command line switches
566
- * Improve reliability by increasing service shutdown timeout (#2815; thanks John Barbuto )
968
+ * Improve reliability by increasing service shutdown timeout (#2815; thanks John Barbuto )
567
969
 
568
970
  Firefox:
569
971
  * 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
@@ -57,47 +57,41 @@ module Selenium
57
57
 
58
58
  CL_RESET = WebDriver::Platform.windows? ? '' : "\r\e[0K"
59
59
 
60
- def self.get(required_version, opts = {})
61
- new(download(required_version), opts)
62
- end
60
+ class << self
61
+ #
62
+ # Download the given version of the selenium-server jar and return instance
63
+ #
64
+ # @param [String, Symbol] required_version X.Y.Z defaults to ':latest'
65
+ # @param [Hash] opts
66
+ # @return [Selenium::Server]
67
+ #
63
68
 
64
- #
65
- # Download the given version of the selenium-server-standalone jar.
66
- #
69
+ def get(required_version = :latest, opts = {})
70
+ new(download(required_version), opts)
71
+ end
67
72
 
68
- class << self
69
- def download(required_version)
73
+ #
74
+ # Download the given version of the selenium-server jar and return location
75
+ #
76
+ # @param [String, Symbol] required_version X.Y.Z defaults to ':latest'
77
+ # @return [String] location of downloaded file
78
+ #
79
+
80
+ def download(required_version = :latest)
70
81
  required_version = latest if required_version == :latest
71
- download_file_name = "selenium-server-standalone-#{required_version}.jar"
82
+ download_file_name = "selenium-server-#{required_version}.jar"
72
83
 
73
84
  return download_file_name if File.exist? download_file_name
74
85
 
75
86
  begin
76
- File.open(download_file_name, 'wb') do |destination|
77
- net_http.start('selenium-release.storage.googleapis.com') do |http|
78
- resp = http.request_get("/#{required_version[/(\d+\.\d+)\./, 1]}/#{download_file_name}") do |response|
79
- total = response.content_length
80
- progress = 0
81
- segment_count = 0
82
-
83
- response.read_body do |segment|
84
- progress += segment.length
85
- segment_count += 1
87
+ server = 'https://github.com/seleniumhq/selenium/releases/download'
88
+ released = Net::HTTP.get_response(URI.parse("#{server}/selenium-#{required_version}/#{download_file_name}"))
89
+ redirected = URI.parse released.header['location']
86
90
 
87
- if (segment_count % 15).zero?
88
- percent = (progress.to_f / total.to_f) * 100
89
- print "#{CL_RESET}Downloading #{download_file_name}: #{percent.to_i}% (#{progress} / #{total})"
90
- segment_count = 0
91
- end
92
-
93
- destination.write(segment)
94
- end
95
- end
96
-
97
- raise Error, "#{resp.code} for #{download_file_name}" unless resp.is_a? Net::HTTPSuccess
98
- end
91
+ File.open(download_file_name, 'wb') do |destination|
92
+ download_server(redirected, destination)
99
93
  end
100
- rescue
94
+ rescue StandardError
101
95
  FileUtils.rm download_file_name if File.exist? download_file_name
102
96
  raise
103
97
  end
@@ -106,57 +100,67 @@ module Selenium
106
100
  end
107
101
 
108
102
  #
109
- # Ask Google Code what the latest selenium-server-standalone version is.
103
+ # Ask GitHub what the latest selenium-server version is.
110
104
  #
111
105
 
112
106
  def latest
113
- require 'rexml/document'
114
- net_http.start('selenium-release.storage.googleapis.com') do |http|
115
- versions = REXML::Document.new(http.get('/').body).root.get_elements('//Contents/Key').map do |e|
116
- e.text[/selenium-server-standalone-(\d+\.\d+\.\d+)\.jar/, 1]
107
+ @latest ||= begin
108
+ net_http_start('api.github.com') do |http|
109
+ json = http.get('/repos/seleniumhq/selenium/releases').body
110
+ all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
111
+ server_assets = all_assets.map { |asset| asset['name'][/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1] }.compact
112
+ server_assets.map { |version| Gem::Version.new(version) }.max.version
117
113
  end
118
-
119
- versions.compact.map { |version| Gem::Version.new(version) }.max.version
120
114
  end
121
115
  end
122
116
 
123
- def net_http
124
- http_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
117
+ # @api private
125
118
 
119
+ def net_http_start(address, &block)
120
+ http_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
126
121
  if http_proxy
127
122
  http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?('http://')
128
123
  uri = URI.parse(http_proxy)
129
124
 
130
- Net::HTTP::Proxy(uri.host, uri.port)
125
+ Net::HTTP.start(address, nil, uri.host, uri.port, &block)
131
126
  else
132
- Net::HTTP
127
+ Net::HTTP.start(address, use_ssl: true, &block)
133
128
  end
134
129
  end
135
- end
136
-
137
- #
138
- # The server port
139
- #
140
-
141
- attr_accessor :port
142
-
143
- #
144
- # The server timeout
145
- #
146
130
 
147
- attr_accessor :timeout
131
+ def download_server(uri, destination)
132
+ net_http_start('github-releases.githubusercontent.com') do |http|
133
+ request = Net::HTTP::Get.new uri
134
+ resp = http.request(request) do |response|
135
+ total = response.content_length
136
+ progress = 0
137
+ segment_count = 0
138
+
139
+ response.read_body do |segment|
140
+ progress += segment.length
141
+ segment_count += 1
142
+
143
+ if (segment_count % 15).zero?
144
+ percent = progress.fdiv(total) * 100
145
+ print "#{CL_RESET}Downloading #{destination.path}: #{percent.to_i}% (#{progress} / #{total})"
146
+ segment_count = 0
147
+ end
148
148
 
149
- #
150
- # Whether to launch the server in the background
151
- #
149
+ destination.write(segment)
150
+ end
151
+ end
152
152
 
153
- attr_accessor :background
153
+ raise Error, "#{resp.code} for #{destination.path}" unless resp.is_a? Net::HTTPSuccess
154
+ end
155
+ end
156
+ end
154
157
 
155
158
  #
156
- # Path to log file, or 'true' for stdout.
159
+ # The Mode of the Server
160
+ # :standalone, #hub, #node
157
161
  #
158
162
 
159
- attr_accessor :log
163
+ attr_accessor :role, :port, :timeout, :background, :log
160
164
 
161
165
  #
162
166
  # @param [String] jar Path to the server jar.
@@ -175,11 +179,12 @@ module Selenium
175
179
 
176
180
  @jar = jar
177
181
  @host = '127.0.0.1'
182
+ @role = opts.fetch(:role, 'standalone')
178
183
  @port = opts.fetch(:port, 4444)
179
184
  @timeout = opts.fetch(:timeout, 30)
180
185
  @background = opts.fetch(:background, false)
181
186
  @log = opts[:log]
182
-
187
+ @log_file = nil
183
188
  @additional_args = []
184
189
  end
185
190
 
@@ -234,7 +239,8 @@ module Selenium
234
239
  @process ||= begin
235
240
  # extract any additional_args that start with -D as options
236
241
  properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
237
- server_command = ['java'] + properties + ['-jar', @jar, '-port', @port.to_s] + @additional_args
242
+ args = ['-jar', @jar, @role, '--port', @port.to_s]
243
+ server_command = ['java'] + properties + args + @additional_args
238
244
  cp = ChildProcess.build(*server_command)
239
245
  WebDriver.logger.debug("Executing Process #{server_command}")
240
246