selenium-webdriver 4.1.0 → 4.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +271 -1
  3. data/Gemfile +2 -0
  4. data/LICENSE +1 -1
  5. data/NOTICE +1 -1
  6. data/README.md +2 -2
  7. data/bin/linux/selenium-manager +0 -0
  8. data/bin/macos/selenium-manager +0 -0
  9. data/bin/windows/selenium-manager.exe +0 -0
  10. data/lib/selenium/server.rb +36 -39
  11. data/lib/selenium/webdriver/atoms/findElements.js +4 -5
  12. data/lib/selenium/webdriver/atoms/getAttribute.js +1 -1
  13. data/lib/selenium/webdriver/atoms/isDisplayed.js +1 -1
  14. data/lib/selenium/webdriver/atoms/mutationListener.js +0 -0
  15. data/lib/selenium/webdriver/atoms.rb +2 -3
  16. data/lib/selenium/webdriver/bidi/browsing_context.rb +88 -0
  17. data/lib/selenium/webdriver/bidi/browsing_context_info.rb +35 -0
  18. data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +35 -0
  19. data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +35 -0
  20. data/lib/selenium/webdriver/bidi/log/filter_by.rb +40 -0
  21. data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +33 -0
  22. data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +33 -0
  23. data/lib/selenium/webdriver/bidi/log_inspector.rb +143 -0
  24. data/lib/selenium/webdriver/bidi/navigate_result.rb +33 -0
  25. data/lib/selenium/webdriver/bidi/session.rb +51 -0
  26. data/lib/selenium/webdriver/bidi.rb +56 -0
  27. data/lib/selenium/webdriver/chrome/driver.rb +9 -29
  28. data/lib/selenium/webdriver/chrome/features.rb +6 -68
  29. data/lib/selenium/webdriver/chrome/options.rb +3 -223
  30. data/lib/selenium/webdriver/chrome/profile.rb +3 -83
  31. data/lib/selenium/webdriver/chrome/service.rb +0 -22
  32. data/lib/selenium/webdriver/chrome.rb +0 -16
  33. data/lib/selenium/webdriver/chromium/driver.rb +61 -0
  34. data/lib/selenium/webdriver/chromium/features.rb +103 -0
  35. data/lib/selenium/webdriver/chromium/options.rb +243 -0
  36. data/lib/selenium/webdriver/chromium/profile.rb +113 -0
  37. data/lib/selenium/webdriver/chromium.rb +29 -0
  38. data/lib/selenium/webdriver/common/action_builder.rb +64 -22
  39. data/lib/selenium/webdriver/common/child_process.rb +124 -0
  40. data/lib/selenium/webdriver/common/driver.rb +31 -81
  41. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
  42. data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +0 -1
  43. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
  44. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +0 -2
  45. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +0 -2
  46. data/lib/selenium/webdriver/common/driver_extensions/{has_remote_status.rb → has_bidi.rb} +10 -5
  47. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +10 -1
  48. data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +0 -2
  49. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +1 -4
  50. data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
  51. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +0 -2
  52. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +0 -2
  53. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +1 -2
  54. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +1 -2
  55. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +0 -2
  56. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +2 -69
  57. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +0 -2
  58. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +1 -3
  59. data/lib/selenium/webdriver/common/driver_finder.rb +45 -0
  60. data/lib/selenium/webdriver/common/element.rb +8 -8
  61. data/lib/selenium/webdriver/common/error.rb +28 -5
  62. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
  63. data/lib/selenium/webdriver/common/interactions/input_device.rb +10 -4
  64. data/lib/selenium/webdriver/common/interactions/interaction.rb +12 -25
  65. data/lib/selenium/webdriver/common/interactions/interactions.rb +24 -4
  66. data/lib/selenium/webdriver/common/interactions/key_actions.rb +5 -1
  67. data/lib/selenium/webdriver/common/interactions/key_input.rb +11 -27
  68. data/lib/selenium/webdriver/common/interactions/none_input.rb +10 -8
  69. data/lib/selenium/webdriver/common/interactions/pause.rb +49 -0
  70. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +59 -70
  71. data/lib/selenium/webdriver/common/interactions/pointer_cancel.rb +45 -0
  72. data/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb +63 -0
  73. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +15 -84
  74. data/lib/selenium/webdriver/common/interactions/pointer_move.rb +60 -0
  75. data/lib/selenium/webdriver/common/interactions/pointer_press.rb +85 -0
  76. data/lib/selenium/webdriver/common/interactions/scroll.rb +59 -0
  77. data/lib/selenium/webdriver/common/interactions/scroll_origin.rb +48 -0
  78. data/lib/selenium/webdriver/common/interactions/typing_interaction.rb +54 -0
  79. data/lib/selenium/webdriver/common/interactions/wheel_actions.rb +113 -0
  80. data/lib/selenium/webdriver/common/interactions/wheel_input.rb +42 -0
  81. data/lib/selenium/webdriver/common/keys.rb +1 -0
  82. data/lib/selenium/webdriver/common/local_driver.rb +46 -0
  83. data/lib/selenium/webdriver/common/logger.rb +90 -25
  84. data/lib/selenium/webdriver/common/manager.rb +0 -27
  85. data/lib/selenium/webdriver/common/options.rb +13 -17
  86. data/lib/selenium/webdriver/common/platform.rb +5 -51
  87. data/lib/selenium/webdriver/common/port_prober.rb +1 -1
  88. data/lib/selenium/webdriver/common/profile_helper.rb +1 -1
  89. data/lib/selenium/webdriver/common/proxy.rb +2 -2
  90. data/lib/selenium/webdriver/common/search_context.rb +0 -6
  91. data/lib/selenium/webdriver/common/selenium_manager.rb +129 -0
  92. data/lib/selenium/webdriver/common/service.rb +17 -30
  93. data/lib/selenium/webdriver/common/service_manager.rb +8 -15
  94. data/lib/selenium/webdriver/common/shadow_root.rb +2 -3
  95. data/lib/selenium/webdriver/common/socket_lock.rb +3 -3
  96. data/lib/selenium/webdriver/common/socket_poller.rb +2 -2
  97. data/lib/selenium/webdriver/common/takes_screenshot.rb +2 -3
  98. data/lib/selenium/webdriver/common/target_locator.rb +2 -3
  99. data/lib/selenium/webdriver/common/timeouts.rb +2 -2
  100. data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +85 -0
  101. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +72 -0
  102. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +62 -0
  103. data/lib/selenium/webdriver/common/websocket_connection.rb +164 -0
  104. data/lib/selenium/webdriver/common/window.rb +6 -6
  105. data/lib/selenium/webdriver/common/zipper.rb +1 -1
  106. data/lib/selenium/webdriver/common.rb +21 -3
  107. data/lib/selenium/webdriver/devtools/console_event.rb +0 -2
  108. data/lib/selenium/webdriver/devtools/exception_event.rb +0 -2
  109. data/lib/selenium/webdriver/devtools/mutation_event.rb +0 -2
  110. data/lib/selenium/webdriver/devtools/network_interceptor.rb +173 -0
  111. data/lib/selenium/webdriver/devtools/pinned_script.rb +0 -2
  112. data/lib/selenium/webdriver/devtools/request.rb +1 -3
  113. data/lib/selenium/webdriver/devtools/response.rb +1 -3
  114. data/lib/selenium/webdriver/devtools.rb +17 -114
  115. data/lib/selenium/webdriver/edge/driver.rb +9 -3
  116. data/lib/selenium/webdriver/edge/features.rb +4 -4
  117. data/lib/selenium/webdriver/edge/options.rb +17 -5
  118. data/lib/selenium/webdriver/edge/profile.rb +2 -2
  119. data/lib/selenium/webdriver/edge/service.rb +1 -7
  120. data/lib/selenium/webdriver/edge.rb +0 -2
  121. data/lib/selenium/webdriver/firefox/driver.rb +9 -2
  122. data/lib/selenium/webdriver/firefox/features.rb +6 -6
  123. data/lib/selenium/webdriver/firefox/options.rb +7 -16
  124. data/lib/selenium/webdriver/firefox/profile.rb +8 -12
  125. data/lib/selenium/webdriver/firefox/service.rb +0 -18
  126. data/lib/selenium/webdriver/firefox/util.rb +46 -0
  127. data/lib/selenium/webdriver/firefox.rb +1 -14
  128. data/lib/selenium/webdriver/ie/driver.rb +7 -1
  129. data/lib/selenium/webdriver/ie/options.rb +4 -3
  130. data/lib/selenium/webdriver/ie/service.rb +0 -22
  131. data/lib/selenium/webdriver/ie.rb +0 -14
  132. data/lib/selenium/webdriver/remote/{commands.rb → bridge/commands.rb} +15 -8
  133. data/lib/selenium/webdriver/remote/bridge.rb +65 -35
  134. data/lib/selenium/webdriver/remote/capabilities.rb +3 -53
  135. data/lib/selenium/webdriver/remote/driver.rb +31 -14
  136. data/lib/selenium/webdriver/remote/http/common.rb +3 -3
  137. data/lib/selenium/webdriver/remote/http/curb.rb +1 -3
  138. data/lib/selenium/webdriver/remote/http/default.rb +8 -14
  139. data/lib/selenium/webdriver/remote/response.rb +2 -3
  140. data/lib/selenium/webdriver/remote/server_error.rb +1 -1
  141. data/lib/selenium/webdriver/remote.rb +0 -1
  142. data/lib/selenium/webdriver/safari/driver.rb +7 -1
  143. data/lib/selenium/webdriver/safari/features.rb +0 -2
  144. data/lib/selenium/webdriver/safari/options.rb +5 -1
  145. data/lib/selenium/webdriver/safari/service.rb +10 -4
  146. data/lib/selenium/webdriver/safari.rb +1 -15
  147. data/lib/selenium/webdriver/support/color.rb +22 -22
  148. data/lib/selenium/webdriver/support/guards/guard.rb +0 -2
  149. data/lib/selenium/webdriver/support/guards/guard_condition.rb +1 -3
  150. data/lib/selenium/webdriver/support/guards.rb +1 -1
  151. data/lib/selenium/webdriver/support/relative_locator.rb +0 -1
  152. data/lib/selenium/webdriver/support/select.rb +3 -1
  153. data/lib/selenium/webdriver/version.rb +1 -1
  154. data/lib/selenium/webdriver.rb +6 -4
  155. data/selenium-webdriver.gemspec +14 -12
  156. metadata +73 -63
  157. data/lib/selenium/webdriver/remote/http/persistent.rb +0 -65
  158. data/lib/selenium/webdriver/support/cdp/domain.rb.erb +0 -63
  159. data/lib/selenium/webdriver/support/cdp_client_generator.rb +0 -108
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40e4bef1fdee7ae817c56466ec231be400d677d56a8c8f46b797c6b3eba28de9
4
- data.tar.gz: a9c1af31f12db6096f06c2a89e487e40ea2bb53b8f6e46e5f77a3046f149bb34
3
+ metadata.gz: 55168c5bf8486c6fa21e644095be740f2f6db107b6864097e4ee53fdf4568f96
4
+ data.tar.gz: 276d1d1976e25f0190fdbf3c5745ef20fd8c9693e6602c774a3ad41af0a054c2
5
5
  SHA512:
6
- metadata.gz: b5325d0fe9f5fdb721ed4a6daa1384d7876dc7a072dd52f46c73d76b1614434c123fff2b4a9d7de01538968eddfbad57f2e1a87f4dce0e560a850dcf21988840
7
- data.tar.gz: 3b345ac66d051c32267d1c4ef9b2dd70aea36e2c4e5bb35ce30197d748effca8fed460824d1961ad5a39340358fc9be3f200708a38557e5e878b09be1b0d61c0
6
+ metadata.gz: 78c70c53eb450854a115edd260d1e6f796c58f42f795434202868eb025cb0d9e0e06a9268b31c4a7fbb765c25c8a4fabe11ad06a7f6dd3cda25ca0e951c4ba41
7
+ data.tar.gz: 2efb72b14eb8d51dd8dfe5a4b88a58e9e551194e28ff05f890d208393fc2f34239665e143bddf405b88681c959402527b303a602fc01bfd37b7d12d8dbf29781
data/CHANGES CHANGED
@@ -1,4 +1,274 @@
1
- 4.1.0 (2021-11-18)
1
+ 4.12.0 (Unreleased)
2
+ =========================
3
+ Ruby:
4
+ * Fix bug preventing good error messages in Selenium Manager when stdout empty
5
+ * Fix bug with Firefox not loading net/http library by default (#12506)
6
+ * Remove support for using capabilities in local drivers
7
+
8
+ BiDi:
9
+ * Released selenium-devtools 0.116.0 (supports CDP v85, v114, v115, v116)
10
+
11
+ 4.11.0 (2023-07-31)
12
+ =========================
13
+ Ruby:
14
+ * Made network interception threads fail silently (#12226)
15
+ * Have Selenium Manager binary locate drivers on PATH (#12345)
16
+ * Add browser output from selenium manager to options (#12398)
17
+ * Remove deprecated code (#12417)
18
+ BiDi:
19
+ * Released selenium-devtools 0.115.0 (supports CDP v85, v113, v114, v115)
20
+ Edge:
21
+ * Adding ignore process match for IE Mode across bindings (#12279)
22
+
23
+ 4.10.0 (2023-06-07)
24
+ =========================
25
+ Ruby:
26
+ * Implement proxy support for Selenium Manager
27
+ * Prevent setting driver log level in Safari
28
+ * Change all Selenium Manager logging to :debug (#12145)
29
+ * Error messages include links to documentation
30
+ * Add custom error class for driver location and improve error logic
31
+
32
+ BiDi:
33
+ * Released selenium-devtools 0.114.0 (supports CDP v85, v112, v113, v114)
34
+
35
+ Edge:
36
+ * Add support for webview2
37
+
38
+ 4.9.1 (2023-05-08)
39
+ =========================
40
+ Ruby:
41
+ * Allow users to specify driver process output in Service class (#11964)
42
+ * Updated minimum required Ruby version to 3.0
43
+ * Selenium Logger defaults to :info and all debugging is now logged as :debug (#11967)
44
+ * Every logging entry can be ignored based on ID, not just warnings
45
+ * Logging entries can be filtered to allow or ignore specific IDs
46
+
47
+ BiDi:
48
+ * Fix bug with loading devtools (#11931) (thanks Boris Petrov!)
49
+ * Released selenium-devtools 0.113.0 (supports CDP v85, v111, v112, v113)
50
+
51
+ 4.9.0 (2023-04-21)
52
+ =========================
53
+ Ruby:
54
+ * Fix devtools version fallback (#11869)
55
+ * Fix bug in selenium manager escaping back slashes in Windows (#11884)
56
+
57
+ BiDi:
58
+ * Released selenium-devtools 0.112.0 (supports CDP v85, v110, v111, v112)
59
+
60
+ 4.8.6 (2023-03-29)
61
+ =========================
62
+ Ruby:
63
+ * Properly escape arguments passed to Selenium Manager
64
+
65
+ 4.8.5 (2023-03-28)
66
+ =========================
67
+ Ruby:
68
+ * Wrapping browser name in quotes when calling Selenium Manager
69
+
70
+ 4.8.4 (2023-03-28)
71
+ =========================
72
+ Ruby:
73
+ * Update the selenium-manager versions to fix an IE naming issue (#11828)
74
+
75
+ 4.8.3 (2023-03-26)
76
+ =========================
77
+ Ruby:
78
+ * Still need to use driver finder when using capabilities parameter
79
+ * Accommodate Driver Finder being sent something other than an Options instance
80
+
81
+ 4.8.2 (2023-03-24)
82
+ =========================
83
+ Ruby:
84
+ * Ruby driver finder (#11523)
85
+ * Using json output with Selenium Manager
86
+
87
+ BiDi:
88
+ * Released selenium-devtools 0.111.0 (supports CDP v85, v109, v110, v111)
89
+
90
+ 4.8.1 (2023-02-17)
91
+ =========================
92
+ Ruby:
93
+ * Fix autoload of WebDriver::Remote::Bridge::COMMANDS
94
+ * Subclass is setting value before the superclass is setting it to nil
95
+ * Updating Selenium Manager binaries for 4.8.1 release
96
+
97
+ BiDi:
98
+ * Released selenium-devtools 0.110.0 (supports CDP v85, v108, v109, v110)
99
+ * Close BiDi session on closing the last top-level browsing context
100
+ * Add filtering capability to LogInspector
101
+
102
+ 4.8.0 (2023-01-23)
103
+ =========================
104
+ Ruby:
105
+ * Allow updating instance variables on service classes
106
+ * Deprecate extract_service_args processing in service classes
107
+ * Fix bug preventing sending nil to #send_keys with Remote Driver
108
+ * Fix bug with IE specific methods not available to IE Driver
109
+ * Created Chromium superclass for Chrome and Edge
110
+ * Deprecated platform and version setters/getters in Capabilities class
111
+ * Revamped driver constructor logic
112
+ * Fix bug preventing using Safari Technology Preview when using SafariOptions
113
+ * Fix bug preventing more than one driver type to access Selenium Manager
114
+ * Defaults to using Options instead of Capabilities
115
+ * Make Options classes more strict for allowed arguments and types
116
+ * Removed previously deprecated actions class parameters
117
+ * Removed Location struct
118
+ * Add comment with name of large JS executions (#11038)
119
+ * update logger with link on how to use it (#11478)
120
+ * Deprecate #add_option for Option classes in favor of constructor and attr_accessor
121
+ * Deprecate all unrecognized capabilities for Options classes
122
+ * Deprecate support for :capabilities for local drivers
123
+ * Deprecate browser class methods for Capabilities
124
+ * Deprecate #headless! for Chrome and Firefox
125
+
126
+ BiDi:
127
+ * Released selenium-devtools 0.109.0 (supports CDP v85, v107, v108, v109)
128
+ * Add LogInspector (#11368)
129
+ * Add Browsing context commands (#11446)
130
+
131
+ 4.7.1 (2022-12-02)
132
+ =========================
133
+ Ruby:
134
+ * Fix bug preventing selenium manager from using Internet Explorer
135
+
136
+ 4.7.0 (2022-12-01)
137
+ =========================
138
+ BiDi:
139
+ * Released selenium-devtools 0.108.0 (supports CDP v85, v106, v107, v108)
140
+ * Fix bug with socket stability
141
+
142
+ Ruby:
143
+ * Remove dependency on ChildProcess gem in favor of native Process.spawn (#11251)
144
+ * Add support for Selenium Manager to work with IE Driver
145
+ * Improve error handling for Selenium Manager
146
+
147
+ Safari:
148
+ * Fix bug preventing Safari Options from being used with Safari Technology Preview
149
+
150
+ 4.6.1 (2022-11-04)
151
+ =========================
152
+ Ruby:
153
+ * fix bug preventing selenium-manager from being executable by default
154
+
155
+ 4.6.0 (2022-11-04)
156
+ =========================
157
+ BiDi:
158
+ * Released selenium-devtools 0.107.0 (supports CDP v85, v105, v106, v107)
159
+
160
+ Ruby:
161
+ * firefox scroll by amount is only failing on mac
162
+ * add initial support for selenium manager
163
+ * Revert "[rb] do not allow Select class to work with disabled selects"
164
+ * Make sure selenium-manager is packed into gem
165
+ * Fix platform list in #scroll_by guard
166
+
167
+ 4.5.0 (2022-09-28)
168
+ =========================
169
+
170
+ BiDi:
171
+ * Released selenium-devtools 0.105.0 (supports CDP v85, v103, v104, v105)
172
+ * Released selenium-devtools 0.106.0 (supports CDP v85, v104, v105, v106)
173
+ * Add HasBiDi support to Chrome
174
+
175
+ Ruby:
176
+ * Fix bug in Platform code
177
+ * Update Select class to error when elements are disabled (#10812)
178
+
179
+ Firefox:
180
+ * Add support for installing unsigned add-ons (#10265, thanks TamsilAmani!)
181
+ * Change accept_insecure_certificates to true by default (to match other bindings)
182
+ * Set debugger_address option to true by default
183
+
184
+ Server:
185
+ * Add support for initializing server class with arguments and log level
186
+
187
+ 4.4.0 (2022-08-09)
188
+ =========================
189
+
190
+ BiDi:
191
+ * Released selenium-devtools 0.103.1 to fix websocket dependency requirement
192
+ * Released selenium-devtools 0.104.0 (supports CDP v85, v102, v103, v104)
193
+ * Have network interceptor ignore cancelled requests (#10856)
194
+ * Improve websocket message handling
195
+
196
+ Chromium:
197
+ * Prevent users from setting w3c: false and warn for true (thanks Tamsil Amani!)
198
+
199
+ Ruby:
200
+ * Implement Virtual Authenticator (#10903, #10541) (thanks Tamsil Amani!)
201
+
202
+ 4.3.0 (2022-06-23)
203
+ =========================
204
+
205
+ BiDi:
206
+ * Released selenium-devtools 0.103.0 (supports CDP v85, v101, v102, v103)
207
+
208
+ Ruby:
209
+ * Allow specifying which button is clicked in pointer action class methods
210
+ * Remove deprecated `Persistent` http class
211
+ * Remove deprecated HasRemoteStatus module
212
+ * Remove deprecated `Manager#new_window` and `Manager#logs`
213
+ * `ActionBuilder#move_to` no longer attempts to move to top left corner of element
214
+ * Remove deprecated support for sending Service parameters directly to Driver constructor
215
+ * Remove deprecated setters and getters for driver path on Browser modules
216
+ * Remove deprecated support for passing in options argument to Options class
217
+ * Allow `:options` parameter to take `Options` instance argument like other languages
218
+ * Remove deprecated support for `:desired_capabilities` & `:options` with `Hash` argument
219
+
220
+ 4.2.1 (2022-05-31)
221
+ =========================
222
+
223
+ Ruby
224
+ * Fix bug in setting default duration in Actions constructor
225
+
226
+ 4.2.0 (2022-05-27)
227
+ =========================
228
+
229
+ BiDi:
230
+ * Released selenium-devtools 0.97.0 (supports CDP v85, v95, v96, v97)
231
+ * Released selenium-devtools 0.98.0 (supports CDP v85, v96, v97, v98)
232
+ * Released selenium-devtools 0.99.0 (supports CDP v85, v97, v98, v99)
233
+ * Released selenium-devtools 0.100.0 (supports CDP v85, v98, v99, v100)
234
+ * Released selenium-devtools 0.101.0 (supports CDP v85, v99, v100, v101)
235
+ * Released selenium-devtools 0.102.0 (supports CDP v85, v100, v101, v102)
236
+ * Implement simple BiDi connection
237
+ * Fix bug in initial BiDi implementation (thanks Boris Petrov!)
238
+ * Fix bug with mutating headers in request interception (#10574)
239
+ * Fix bug with empty response headers (thanks Viren Negi!)
240
+
241
+ Firefox:
242
+ * Add support to Firefox Options for environment capability
243
+ * Use addon parameter instead of path parameter to avoid using file detector
244
+ * Restore #from_name method to Firefox profile (#10146)
245
+
246
+ Chromium:
247
+ * Add support for casting desktop
248
+
249
+ Ruby:
250
+ * Updated minimum required Ruby version to 2.7
251
+ * Fix bug by not attempting to stop service process when it's not started (#10015)
252
+ * Fix bug to not stop service process when it's not started (thanks Atsushi Tatsuma!)
253
+ * Use driver endpoint to get page source instead of JavaScript
254
+ * Add zenkaku_hankaku key support
255
+ * Fix download support of Selenium Server
256
+ * Do not convert Tag Name to CSS Selector
257
+
258
+ ActionBuilder:
259
+ * Raise error if input device not found
260
+ * Move `TypingInteraction` from `Interactions::KeyInput` to `Interactions` module
261
+ * Throw better errors for `PointerInput` methods
262
+ * Allow each action interaction class to validate its own source
263
+ * Set all Interactions classes to private
264
+ * Allow device names to use a default id if one is not specified
265
+ * Deprecate default mouse and keyboard values in constructor, favoring devices parameter
266
+ * Add support for pointer event properties
267
+ * Implement scroll wheel support
268
+ * Deprecate ordered pair parameters for pause method in favor of keywords
269
+ * Deprecate move to element with offset changing origin to top left of element
270
+
271
+ 4.1.0 (2021-11-22)
2
272
  =========================
3
273
 
4
274
  DevTools:
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ source 'https://rubygems.org'
4
4
  Dir["#{__dir__}/*.gemspec"].each do |spec|
5
5
  gemspec name: File.basename(spec, '.gemspec')
6
6
  end
7
+
8
+ gem 'debug', '~> 1.7', require: false, platforms: %i[mri mingw x64_mingw]
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 2021 Software Freedom Conservancy (SFC)
190
+ Copyright 2023 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 CHANGED
@@ -1,2 +1,2 @@
1
- Copyright 2011-2021 Software Freedom Conservancy
1
+ Copyright 2011-2023 Software Freedom Conservancy
2
2
  Copyright 2004-2011 Selenium committers
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # selenium-webdriver
2
2
 
3
- This gem provides Ruby bindings for Selenium and supports MRI >= 2.6
3
+ This gem provides Ruby bindings for Selenium and supports MRI >= 3.0.
4
4
 
5
5
  ## Install
6
6
 
@@ -15,7 +15,7 @@ This gem provides Ruby bindings for Selenium and supports MRI >= 2.6
15
15
 
16
16
  ## License
17
17
 
18
- Copyright 2009-2021 Software Freedom Conservancy
18
+ Copyright 2009-2023 Software Freedom Conservancy
19
19
 
20
20
  Licensed to the Software Freedom Conservancy (SFC) under one
21
21
  or more contributor license agreements. See the NOTICE file
Binary file
Binary file
Binary file
@@ -17,7 +17,8 @@
17
17
  # specific language governing permissions and limitations
18
18
  # under the License.
19
19
 
20
- require 'childprocess'
20
+ require 'selenium/webdriver/common/child_process'
21
+ require 'selenium/webdriver/common/port_prober'
21
22
  require 'selenium/webdriver/common/socket_poller'
22
23
  require 'net/http'
23
24
 
@@ -84,15 +85,15 @@ module Selenium
84
85
  return download_file_name if File.exist? download_file_name
85
86
 
86
87
  begin
87
- server = 'https://github.com/seleniumhq/selenium/releases/download'
88
- released = Net::HTTP.get_response(URI.parse("#{server}/selenium-#{required_version}/#{download_file_name}"))
88
+ download_location = available_assets[download_file_name]['browser_download_url']
89
+ released = Net::HTTP.get_response(URI.parse(download_location))
89
90
  redirected = URI.parse released.header['location']
90
91
 
91
92
  File.open(download_file_name, 'wb') do |destination|
92
93
  download_server(redirected, destination)
93
94
  end
94
95
  rescue StandardError
95
- FileUtils.rm download_file_name if File.exist? download_file_name
96
+ FileUtils.rm_rf download_file_name
96
97
  raise
97
98
  end
98
99
 
@@ -105,19 +106,24 @@ module Selenium
105
106
 
106
107
  def latest
107
108
  @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
113
- end
109
+ available = available_assets.keys.map { |key| key[/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1] }
110
+ available.map { |asset| Gem::Version.new(asset) }.max.to_s
114
111
  end
115
112
  end
116
113
 
117
114
  # @api private
118
115
 
116
+ def available_assets
117
+ @available_assets ||= net_http_start('api.github.com') do |http|
118
+ json = http.get('/repos/seleniumhq/selenium/releases').body
119
+ all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
120
+ server_assets = all_assets.select { |asset| asset['name'].match(/selenium-server-(\d+\.\d+\.\d+)\.jar/) }
121
+ server_assets.each_with_object({}) { |asset, hash| hash[asset.delete('name')] = asset }
122
+ end
123
+ end
124
+
119
125
  def net_http_start(address, &block)
120
- http_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
126
+ http_proxy = ENV.fetch('http_proxy', nil) || ENV.fetch('HTTP_PROXY', nil)
121
127
  if http_proxy
122
128
  http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?('http://')
123
129
  uri = URI.parse(http_proxy)
@@ -160,7 +166,7 @@ module Selenium
160
166
  # :standalone, #hub, #node
161
167
  #
162
168
 
163
- attr_accessor :role, :port, :timeout, :background, :log
169
+ attr_accessor :role, :host, :port, :timeout, :background, :log
164
170
 
165
171
  #
166
172
  # @param [String] jar Path to the server jar.
@@ -177,15 +183,21 @@ module Selenium
177
183
  def initialize(jar, opts = {})
178
184
  raise Errno::ENOENT, jar unless File.exist?(jar)
179
185
 
180
- @jar = jar
181
- @host = '127.0.0.1'
182
- @role = opts.fetch(:role, 'standalone')
183
- @port = opts.fetch(:port, 4444)
184
- @timeout = opts.fetch(:timeout, 30)
186
+ @jar = jar
187
+ @host = '127.0.0.1'
188
+ @role = opts.fetch(:role, 'standalone')
189
+ @port = opts.fetch(:port, WebDriver::PortProber.above(4444))
190
+ @timeout = opts.fetch(:timeout, 30)
185
191
  @background = opts.fetch(:background, false)
186
- @log = opts[:log]
187
- @log_file = nil
188
- @additional_args = []
192
+ @additional_args = opts.fetch(:args, [])
193
+ @log = opts[:log]
194
+ if opts[:log_level]
195
+ @log ||= true
196
+ @additional_args << '--log-level'
197
+ @additional_args << opts[:log_level].to_s
198
+ end
199
+
200
+ @log_file = nil
189
201
  end
190
202
 
191
203
  def start
@@ -196,11 +208,6 @@ module Selenium
196
208
  end
197
209
 
198
210
  def stop
199
- begin
200
- Net::HTTP.get(@host, '/selenium-server/driver/?cmd=shutDownSeleniumServer', @port)
201
- rescue Errno::ECONNREFUSED
202
- end
203
-
204
211
  stop_process if @process
205
212
  poll_for_shutdown
206
213
 
@@ -222,13 +229,7 @@ module Selenium
222
229
  private
223
230
 
224
231
  def stop_process
225
- return unless @process.alive?
226
-
227
- begin
228
- @process.poll_for_exit(5)
229
- rescue ChildProcess::TimeoutError
230
- @process.stop
231
- end
232
+ @process.stop
232
233
  rescue Errno::ECHILD
233
234
  # already dead
234
235
  ensure
@@ -241,16 +242,12 @@ module Selenium
241
242
  properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
242
243
  args = ['-jar', @jar, @role, '--port', @port.to_s]
243
244
  server_command = ['java'] + properties + args + @additional_args
244
- cp = ChildProcess.build(*server_command)
245
- WebDriver.logger.debug("Executing Process #{server_command}")
246
-
247
- io = cp.io
245
+ cp = WebDriver::ChildProcess.build(*server_command)
248
246
 
249
247
  if @log.is_a?(String)
250
- @log_file = File.open(@log, 'w')
251
- io.stdout = io.stderr = @log_file
248
+ cp.io = @log
252
249
  elsif @log
253
- io.inherit!
250
+ cp.io = :out
254
251
  end
255
252
 
256
253
  cp.detach = @background
@@ -113,10 +113,9 @@ function nd(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.repla
113
113
  function pd(a,b,c,d,e){if(3==a.nodeType&&c)nd(a,b,d,e);else if(S(a))if(S(a,"CONTENT")||S(a,"SLOT")){for(var f=a;f.parentNode;)f=f.parentNode;f instanceof ShadowRoot?(a=S(a,"CONTENT")?a.getDistributedNodes():a.assignedNodes(),l(a,function(g){pd(g,b,c,d,e)})):jd(a,b)}else if(S(a,"SHADOW")){for(f=a;f.parentNode;)f=f.parentNode;if(f instanceof ShadowRoot&&(a=f))for(a=a.olderShadowRoot;a;)l(a.childNodes,function(g){pd(g,b,c,d,e)}),a=a.olderShadowRoot}else jd(a,b)}
114
114
  function jd(a,b){a.shadowRoot&&l(a.shadowRoot.childNodes,function(c){pd(c,b,!0,null,null)});ld(a,b,function(c,d,e,f,g){var h=null;1==c.nodeType?h=c:3==c.nodeType&&(h=c);null!=h&&(null!=h.assignedSlot||h.getDestinationInsertionPoints&&0<h.getDestinationInsertionPoints().length)||pd(c,d,e,f,g)})};var qd={C:function(a,b){return!(!a.querySelectorAll||!a.querySelector)&&!/^\d.*/.test(b)},o:function(a,b){var c=eb(b),d="string"===typeof a?c.a.getElementById(a):a;return d?Uc(d,"id")==a&&b!=d&&hb(b,d)?d:ua(mb(c,"*"),function(e){return Uc(e,"id")==a&&b!=e&&hb(b,e)}):null},j:function(a,b){if(!a)return[];if(qd.C(b,a))try{return b.querySelectorAll("#"+qd.T(a))}catch(c){return[]}b=mb(eb(b),"*",null,b);return pa(b,function(c){return Uc(c,"id")==a})},T:function(a){return a.replace(/([\s'"\\#.:;,!?+<>=~*^$|%&@`{}\-\/\[\]\(\)])/g,
115
115
  "\\$1")}};var Y={},rd={};Y.N=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return ua(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.K=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return pa(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.o=function(a,b){return Y.N(a,b,!1)};Y.j=function(a,b){return Y.K(a,b,!1)};rd.o=function(a,b){return Y.N(a,b,!0)};
116
- rd.j=function(a,b){return Y.K(a,b,!0)};var Z={F:function(a,b){return function(c){var d=Z.u(a);d=W(d);c=W(c);return b.call(null,d,c)}},R:function(a){return Z.F(a,function(b,c){return c.b+c.height<b.b})},S:function(a){return Z.F(a,function(b,c){return b.b+b.height<c.b})},V:function(a){return Z.F(a,function(b,c){return c.a+c.width<b.a})},aa:function(a){return Z.F(a,function(b,c){return b.a+b.width<c.a})},W:function(a,b){var c;b?c=b:"number"==typeof a.distance&&(c=a.distance);c||(c=100);return function(d){var e=Z.u(a);if(e===d)return!1;e=
117
- W(e);d=W(d);var f=Math.abs(e.a+e.width-d.a),g=Math.abs(e.b+e.height-d.b);g=Math.abs(e.b-(d.b+d.height))<=c||g<=c;return(Math.abs(e.a-(d.a+d.width))<=c||f<=c)&&g?!0:Math.sqrt(Math.pow(Math.abs(e.a+e.width/2-(d.a+d.width/2)),2)+Math.pow(Math.abs(e.b+e.height/2-(d.b+d.height/2)),2))<=c}},u:function(a){if(ha(a)&&1==a.nodeType)return a;if(ea(a))return Z.u(a.call(null));if(ha(a)){var b;a:{if(b=sd(a)){var c=td[b];if(c&&ea(c.o)){b=c.o(a[b],Bc.document);break a}}throw new P(61,"Unsupported locator strategy: "+
118
- b);}if(!b)throw new P(7,"No element has been found by "+JSON.stringify(a));return b}throw new P(61,"Selector is of wrong type: "+JSON.stringify(a));}};Z.P={left:Z.V,right:Z.aa,above:Z.R,below:Z.S,near:Z.W};Z.O={left:Z.u,right:Z.u,above:Z.u,below:Z.u,near:Z.u};
119
- Z.U=function(a,b){var c=[];l(a,function(e){e&&ta(b,function(f){var g=f.kind,h=Z.P[g];if(!h)throw new P(61,"Cannot find filter suitable for "+g);return h.apply(null,f.args)(e)},null)&&c.push(e)},null);a=b[b.length-1];var d=Z.O[a?a.kind:"unknown"];return d?(a=d.apply(null,a.args))?Z.ba(a,c):c:c};
116
+ rd.j=function(a,b){return Y.K(a,b,!0)};var Z={F:function(a,b){return function(c){var d=Z.u(a);d=W(d);c=W(c);return b.call(null,d,c)}},R:function(a){return Z.F(a,function(b,c){return c.b+c.height<b.b})},S:function(a){return Z.F(a,function(b,c){return b.b+b.height<c.b})},V:function(a){return Z.F(a,function(b,c){return c.a+c.width<b.a})},aa:function(a){return Z.F(a,function(b,c){return b.a+b.width<c.a})},W:function(a,b){var c;b?c=b:"number"==typeof a.distance&&(c=a.distance);c||(c=50);return function(d){var e=Z.u(a);if(e===d)return!1;e=W(e);
117
+ d=W(d);e=new U(e.a-c,e.b-c,e.width+2*c,e.height+2*c);return e.a<=d.a+d.width&&d.a<=e.a+e.width&&e.b<=d.b+d.height&&d.b<=e.b+e.height}},u:function(a){if(ha(a)&&1==a.nodeType)return a;if(ea(a))return Z.u(a.call(null));if(ha(a)){var b;a:{if(b=sd(a)){var c=td[b];if(c&&ea(c.o)){b=c.o(a[b],Bc.document);break a}}throw new P(61,"Unsupported locator strategy: "+b);}if(!b)throw new P(7,"No element has been found by "+JSON.stringify(a));return b}throw new P(61,"Selector is of wrong type: "+JSON.stringify(a));
118
+ }};Z.P={left:Z.V,right:Z.aa,above:Z.R,below:Z.S,near:Z.W};Z.O={left:Z.u,right:Z.u,above:Z.u,below:Z.u,near:Z.u};Z.U=function(a,b){var c=[];l(a,function(e){e&&ta(b,function(f){var g=f.kind,h=Z.P[g];if(!h)throw new P(61,"Cannot find filter suitable for "+g);return h.apply(null,f.args)(e)},null)&&c.push(e)},null);a=b[b.length-1];var d=Z.O[a?a.kind:"unknown"];return d?(a=d.apply(null,a.args))?Z.ba(a,c):c:c};
120
119
  Z.ba=function(a,b){function c(f){f=W(f);return Math.sqrt(Math.pow(d-(f.a+Math.max(1,f.width)/2),2)+Math.pow(e-(f.b+Math.max(1,f.height)/2),2))}a=W(a);var d=a.a+Math.max(1,a.width)/2,e=a.b+Math.max(1,a.height)/2;xa(b,function(f,g){return c(f)-c(g)});return b};Z.o=function(a,b){a=Z.j(a,b);return 0==a.length?null:a[0]};
121
120
  Z.j=function(a,b){if(!a.hasOwnProperty("root")||!a.hasOwnProperty("filters"))throw new P(61,"Locator not suitable for relative locators: "+JSON.stringify(a));var c=a.filters,d=da(c);if("array"!=d&&("object"!=d||"number"!=typeof c.length))throw new P(61,"Targets should be an array: "+JSON.stringify(a));var e;S(a.root)?e=[a.root]:e=ud(a.root,b);return 0==e.length?[]:Z.U(e,a.filters)};var vd={o:function(a,b){if(""===a)throw new P(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)[0]||null},j:function(a,b){if(""===a)throw new P(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)}};var td={className:Dc,"class name":Dc,css:Nc,"css selector":Nc,relative:Z,id:qd,linkText:Y,"link text":Y,name:{o:function(a,b){b=mb(eb(b),"*",null,b);return ua(b,function(c){return Uc(c,"name")==a})},j:function(a,b){b=mb(eb(b),"*",null,b);return pa(b,function(c){return Uc(c,"name")==a})}},partialLinkText:rd,"partial link text":rd,tagName:vd,"tag name":vd,xpath:T};function sd(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null}
122
- function ud(a,b){var c=sd(a);if(c){var d=td[c];if(d&&ea(d.j))return d.j(a[c],b||Bc.document)}throw new P(61,"Unsupported locator strategy: "+c);};ca("_",ud);; return this._.apply(null,arguments);}).apply({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);}
121
+ function ud(a,b){var c=sd(a);if(c){var d=td[c];if(d&&ea(d.j))return d.j(a[c],b||Bc.document)}throw new P(61,"Unsupported locator strategy: "+c);};ca("_",ud);; return this._.apply(null,arguments);}).apply(window, arguments);}
@@ -97,4 +97,4 @@ Uc.prototype.set=function(a,b){Object.prototype.hasOwnProperty.call(this.b,a)||(
97
97
  Z(69,"e","E");Z(70,"f","F");Z(71,"g","G");Z(72,"h","H");Z(73,"i","I");Z(74,"j","J");Z(75,"k","K");Z(76,"l","L");Z(77,"m","M");Z(78,"n","N");Z(79,"o","O");Z(80,"p","P");Z(81,"q","Q");Z(82,"r","R");Z(83,"s","S");Z(84,"t","T");Z(85,"u","U");Z(86,"v","V");Z(87,"w","W");Z(88,"x","X");Z(89,"y","Y");Z(90,"z","Z");var ad=Z(Ia?{g:91,h:91}:Ha?{g:224,h:91}:{g:0,h:91});Z(Ia?{g:92,h:92}:Ha?{g:224,h:93}:{g:0,h:92});Z(Ia?{g:93,h:93}:Ha?{g:0,h:0}:{g:93,h:null});Z({g:96,h:96},"0");Z({g:97,h:97},"1");
98
98
  Z({g:98,h:98},"2");Z({g:99,h:99},"3");Z({g:100,h:100},"4");Z({g:101,h:101},"5");Z({g:102,h:102},"6");Z({g:103,h:103},"7");Z({g:104,h:104},"8");Z({g:105,h:105},"9");Z({g:106,h:106},"*");Z({g:107,h:107},"+");Z({g:109,h:109},"-");Z({g:110,h:110},".");Z({g:111,h:111},"/");Z(144);Z(112);Z(113);Z(114);Z(115);Z(116);Z(117);Z(118);Z(119);Z(120);Z(121);Z(122);Z(123);Z({g:107,h:187},"=","+");Z(108,",");Z({g:109,h:189},"-","_");Z(188,",","<");Z(190,".",">");Z(191,"/","?");Z(192,"`","~");Z(219,"[","{");
99
99
  Z(220,"\\","|");Z(221,"]","}");Z({g:59,h:186},";",":");Z(222,"'",'"');var bd=new Uc;bd.set(1,Yc);bd.set(2,Zc);bd.set(4,$c);bd.set(8,ad);(function(a){var b=new Uc;n(Vc(a),function(c){b.set(a.get(c).code,c)});return b})(bd);var cd={"class":"className",readonly:"readOnly"},dd="allowfullscreen allowpaymentrequest allowusermedia async autofocus autoplay checked compact complete controls declare default defaultchecked defaultselected defer disabled ended formnovalidate hidden indeterminate iscontenteditable ismap itemscope loop multiple muted nohref nomodule noresize noshade novalidate nowrap open paused playsinline pubdate readonly required reversed scoped seamless seeking selected truespeed typemustmatch willvalidate".split(" ");ba("_",function(a,b){var c=null,d=b.toLowerCase();if("style"==d)return(c=a.style)&&!aa(c)&&(c=c.cssText),c;if(("selected"==d||"checked"==d)&&Jc(a)){if(!Jc(a))throw new U(15,"Element is not selectable");b="selected";c=a.type&&a.type.toLowerCase();if("checkbox"==c||"radio"==c)b="checked";return Ic(a,b)?"true":null}var e=Gc(a,"A");if(Gc(a,"IMG")&&"src"==d||e&&"href"==d)return(c=Ec(a,d))&&(c=Ic(a,d)),c;if("spellcheck"==d){c=Ec(a,d);if(null!==c){if("false"==c.toLowerCase())return"false";if("true"==c.toLowerCase())return"true"}return Ic(a,
100
- d)+""}e=cd[b]||b;if(0<=ma(dd,d))return(c=null!==Ec(a,b)||Ic(a,e))?"true":null;try{var f=Ic(a,e)}catch(g){}null==f||da(f)?c=Ec(a,b):c=f;return null!=c?c.toString():null});; return this._.apply(null,arguments);}).apply({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);}
100
+ d)+""}e=cd[b]||b;if(0<=ma(dd,d))return(c=null!==Ec(a,b)||Ic(a,e))?"true":null;try{var f=Ic(a,e)}catch(g){}null==f||da(f)?c=Ec(a,b):c=f;return null!=c?c.toString():null});; return this._.apply(null,arguments);}).apply(window, arguments);}
@@ -97,4 +97,4 @@ r.y){var D=Jc(a);if(0==D.width||0==D.height)return Z;var L=e.a<D.a,M=e.b<D.b;if(
97
97
  function Jc(a){var b=Lc(a);if(b)return b.rect;if(W(a,"HTML"))return a=A(a),a=((a?a.parentWindow||a.defaultView:window)||window).document,a="CSS1Compat"==a.compatMode?a.documentElement:a.body,a=new Va(a.clientWidth,a.clientHeight),new X(0,0,a.width,a.height);try{var c=a.getBoundingClientRect()}catch(d){return new X(0,0,0,0)}b=new X(c.left,c.top,c.right-c.left,c.bottom-c.top);v&&a.ownerDocument.body&&(a=A(a),b.a-=a.documentElement.clientLeft+a.body.clientLeft,b.b-=a.documentElement.clientTop+a.body.clientTop);
98
98
  return b}function Lc(a){var b=W(a,"MAP");if(!b&&!W(a,"AREA"))return null;var c=b?a:W(a.parentNode,"MAP")?a.parentNode:null,d=null,e=null;c&&c.name&&(d=Dc('/descendant::*[@usemap = "#'+c.name+'"]',A(c)))&&(e=Jc(d),b||"default"==a.shape.toLowerCase()||(a=Oc(a),b=Math.min(Math.max(a.a,0),e.width),c=Math.min(Math.max(a.b,0),e.height),e=new X(b+e.a,c+e.b,Math.min(a.width,e.width-b),Math.min(a.height,e.height-c))));return{image:d,rect:e||new X(0,0,0,0)}}
99
99
  function Oc(a){var b=a.shape.toLowerCase();a=a.coords.split(",");if("rect"==b&&4==a.length){b=a[0];var c=a[1];return new X(b,c,a[2]-b,a[3]-c)}if("circle"==b&&3==a.length)return b=a[2],new X(a[0]-b,a[1]-b,2*b,2*b);if("poly"==b&&2<a.length){b=a[0];c=a[1];for(var d=b,e=c,f=2;f+1<a.length;f+=2)b=Math.min(b,a[f]),d=Math.max(d,a[f]),c=Math.min(c,a[f+1]),e=Math.max(e,a[f+1]);return new X(b,c,d-b,e-c)}return new X(0,0,0,0)}function Nc(a){a=Jc(a);return new Ec(a.b,a.a+a.width,a.b+a.height,a.a)}
100
- function Mc(a){if(Ac){if("relative"==Y(a,"position"))return 1;a=Y(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Pc(a)}function Pc(a){var b=1,c=Y(a,"opacity");c&&(b=Number(c));(a=Gc(a))&&(b*=Pc(a));return b};ba("_",function(a,b){function c(d){if(W(d)&&"none"==Y(d,"display"))return!1;var e;if((e=d.parentNode)&&e.shadowRoot&&void 0!==d.assignedSlot)e=d.assignedSlot?d.assignedSlot.parentNode:null;else if(d.getDestinationInsertionPoints){var f=d.getDestinationInsertionPoints();0<f.length&&(e=f[f.length-1])}if(Fc&&e instanceof ShadowRoot){if(e.host.shadowRoot!==e)return!1;e=e.host}return!e||9!=e.nodeType&&11!=e.nodeType?e&&W(e,"DETAILS")&&!e.open&&!W(d,"SUMMARY")?!1:!!e&&c(e):!0}return Ic(a,!!b,c)});; return this._.apply(null,arguments);}).apply({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);}
100
+ function Mc(a){if(Ac){if("relative"==Y(a,"position"))return 1;a=Y(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Pc(a)}function Pc(a){var b=1,c=Y(a,"opacity");c&&(b=Number(c));(a=Gc(a))&&(b*=Pc(a));return b};ba("_",function(a,b){function c(d){if(W(d)&&"none"==Y(d,"display"))return!1;var e;if((e=d.parentNode)&&e.shadowRoot&&void 0!==d.assignedSlot)e=d.assignedSlot?d.assignedSlot.parentNode:null;else if(d.getDestinationInsertionPoints){var f=d.getDestinationInsertionPoints();0<f.length&&(e=f[f.length-1])}if(Fc&&e instanceof ShadowRoot){if(e.host.shadowRoot!==e)return!1;e=e.host}return!e||9!=e.nodeType&&11!=e.nodeType?e&&W(e,"DETAILS")&&!e.open&&!W(d,"SUMMARY")?!1:!!e&&c(e):!0}return Ic(a,!!b,c)});; return this._.apply(null,arguments);}).apply(window, arguments);}
File without changes
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Atoms
23
-
24
23
  private
25
24
 
26
25
  def read_atom(function)
@@ -28,10 +27,10 @@ module Selenium
28
27
  end
29
28
 
30
29
  def execute_atom(function_name, *arguments)
31
- script = format("return (%<atom>s).apply(null, arguments)", atom: read_atom(function_name))
30
+ script = format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
31
+ atom: read_atom(function_name))
32
32
  execute_script(script, *arguments)
33
33
  end
34
-
35
34
  end # Atoms
36
35
  end # WebDriver
37
36
  end # Selenium
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed to the Software Freedom Conservancy (SFC) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The SFC licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ require_relative 'navigate_result'
21
+ require_relative 'browsing_context_info'
22
+
23
+ module Selenium
24
+ module WebDriver
25
+ class BiDi
26
+ class BrowsingContext
27
+ attr_accessor :id
28
+
29
+ READINESS_STATE = {
30
+ none: 'none',
31
+ interactive: 'interactive',
32
+ complete: 'complete'
33
+ }.freeze
34
+
35
+ def initialize(driver:, browsing_context_id: nil, type: nil, reference_context: nil)
36
+ unless driver.capabilities.web_socket_url
37
+ raise Error::WebDriverError,
38
+ 'WebDriver instance must support BiDi protocol'
39
+ end
40
+
41
+ unless type.nil? || %i[window tab].include?(type)
42
+ raise ArgumentError,
43
+ "Valid types are :window & :tab. Received: #{type.inspect}"
44
+ end
45
+
46
+ @bidi = driver.bidi
47
+ @id = browsing_context_id.nil? ? create(type, reference_context)['context'] : browsing_context_id
48
+ end
49
+
50
+ def navigate(url:, readiness_state: nil)
51
+ unless readiness_state.nil? || READINESS_STATE.key?(readiness_state)
52
+ raise ArgumentError,
53
+ "Valid readiness states are :none, :interactive & :complete. Received: #{readiness_state.inspect}"
54
+ end
55
+
56
+ navigate_result = @bidi.send_cmd('browsingContext.navigate', context: @id, url: url,
57
+ wait: READINESS_STATE[readiness_state])
58
+
59
+ NavigateResult.new(
60
+ url: navigate_result['url'],
61
+ navigation_id: navigate_result['navigation']
62
+ )
63
+ end
64
+
65
+ def get_tree(max_depth: nil)
66
+ result = @bidi.send_cmd('browsingContext.getTree', root: @id, maxDepth: max_depth).dig('contexts', 0)
67
+
68
+ BrowsingContextInfo.new(
69
+ id: result['context'],
70
+ url: result['url'],
71
+ children: result['children'],
72
+ parent_context: result['parent']
73
+ )
74
+ end
75
+
76
+ def close
77
+ @bidi.send_cmd('browsingContext.close', context: @id)
78
+ end
79
+
80
+ private
81
+
82
+ def create(type, reference_context)
83
+ @bidi.send_cmd('browsingContext.create', type: type.to_s, referenceContext: reference_context)
84
+ end
85
+ end # BrowsingContext
86
+ end # BiDi
87
+ end # WebDriver
88
+ end # Selenium