selenium-webdriver 4.35.0 → 4.47.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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +111 -0
  3. data/Gemfile +1 -4
  4. data/LICENSE +1 -1
  5. data/NOTICE +1 -1
  6. data/README.md +43 -23
  7. data/bin/linux/selenium-manager +0 -0
  8. data/bin/macos/selenium-manager +0 -0
  9. data/bin/selenium-manager-THIRD-PARTY-NOTICES.txt +5971 -0
  10. data/bin/selenium-manager.cdx.json +11629 -0
  11. data/bin/windows/selenium-manager.exe +0 -0
  12. data/lib/selenium/server.rb +30 -5
  13. data/lib/selenium/webdriver/atoms/findElements.js +272 -54
  14. data/lib/selenium/webdriver/atoms/getAttribute.js +152 -6
  15. data/lib/selenium/webdriver/atoms/isDisplayed.js +385 -28
  16. data/lib/selenium/webdriver/bidi/browser.rb +71 -0
  17. data/lib/selenium/webdriver/bidi/browsing_context.rb +3 -2
  18. data/lib/selenium/webdriver/bidi/{log/filter_by.rb → error.rb} +20 -16
  19. data/lib/selenium/webdriver/bidi/log_handler.rb +5 -0
  20. data/lib/selenium/webdriver/bidi/network/cookies.rb +13 -9
  21. data/lib/selenium/webdriver/bidi/network/credentials.rb +4 -0
  22. data/lib/selenium/webdriver/bidi/network/headers.rb +4 -0
  23. data/lib/selenium/webdriver/bidi/network/intercepted_auth.rb +4 -0
  24. data/lib/selenium/webdriver/bidi/network/intercepted_item.rb +4 -0
  25. data/lib/selenium/webdriver/bidi/network/intercepted_request.rb +20 -4
  26. data/lib/selenium/webdriver/bidi/network/intercepted_response.rb +24 -6
  27. data/lib/selenium/webdriver/bidi/network/url_pattern.rb +4 -0
  28. data/lib/selenium/webdriver/bidi/network.rb +18 -9
  29. data/lib/selenium/webdriver/bidi/protocol/bluetooth.rb +495 -0
  30. data/lib/selenium/webdriver/bidi/protocol/browser.rb +250 -0
  31. data/lib/selenium/webdriver/bidi/protocol/browsing_context.rb +798 -0
  32. data/lib/selenium/webdriver/bidi/{log/base_log_entry.rb → protocol/domain.rb} +22 -11
  33. data/lib/selenium/webdriver/bidi/protocol/emulation.rb +448 -0
  34. data/lib/selenium/webdriver/bidi/protocol/error_code.rb +66 -0
  35. data/lib/selenium/webdriver/bidi/protocol/input.rb +354 -0
  36. data/lib/selenium/webdriver/bidi/protocol/log.rb +115 -0
  37. data/lib/selenium/webdriver/bidi/protocol/network.rb +720 -0
  38. data/lib/selenium/webdriver/bidi/protocol/permissions.rb +75 -0
  39. data/lib/selenium/webdriver/bidi/protocol/script.rb +1052 -0
  40. data/lib/selenium/webdriver/bidi/protocol/session.rb +286 -0
  41. data/lib/selenium/webdriver/bidi/protocol/speculation.rb +58 -0
  42. data/lib/selenium/webdriver/bidi/protocol/storage.rb +183 -0
  43. data/lib/selenium/webdriver/bidi/protocol/user_agent_client_hints.rb +88 -0
  44. data/lib/selenium/webdriver/bidi/protocol/web_extension.rb +132 -0
  45. data/lib/selenium/webdriver/bidi/protocol.rb +42 -0
  46. data/lib/selenium/webdriver/bidi/serialization/record.rb +402 -0
  47. data/lib/selenium/webdriver/bidi/serialization/union.rb +156 -0
  48. data/lib/selenium/webdriver/bidi/serialization.rb +90 -0
  49. data/lib/selenium/webdriver/bidi/session.rb +4 -0
  50. data/lib/selenium/webdriver/bidi/support/bidi_generate.rb +1420 -0
  51. data/lib/selenium/webdriver/bidi/support/check_generated.rb +63 -0
  52. data/lib/selenium/webdriver/bidi/transport.rb +57 -0
  53. data/lib/selenium/webdriver/bidi.rb +4 -1
  54. data/lib/selenium/webdriver/chrome/driver.rb +4 -3
  55. data/lib/selenium/webdriver/chrome/service.rb +13 -0
  56. data/lib/selenium/webdriver/chromium/driver.rb +0 -1
  57. data/lib/selenium/webdriver/chromium/options.rb +23 -1
  58. data/lib/selenium/webdriver/chromium/profile.rb +6 -0
  59. data/lib/selenium/webdriver/common/child_process.rb +2 -1
  60. data/lib/selenium/webdriver/common/client_config.rb +97 -0
  61. data/lib/selenium/webdriver/common/driver.rb +13 -7
  62. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +0 -7
  63. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +0 -7
  64. data/lib/selenium/webdriver/common/driver_extensions/{has_bidi.rb → has_session_events.rb} +19 -7
  65. data/lib/selenium/webdriver/common/driver_finder.rb +35 -25
  66. data/lib/selenium/webdriver/common/error.rb +10 -3
  67. data/lib/selenium/webdriver/common/local_driver.rb +29 -12
  68. data/lib/selenium/webdriver/common/logger.rb +28 -0
  69. data/lib/selenium/webdriver/common/manager.rb +2 -0
  70. data/lib/selenium/webdriver/common/options.rb +41 -2
  71. data/lib/selenium/webdriver/common/platform.rb +1 -3
  72. data/lib/selenium/webdriver/common/proxy.rb +1 -9
  73. data/lib/selenium/webdriver/common/selenium_manager.rb +2 -1
  74. data/lib/selenium/webdriver/common/service.rb +4 -8
  75. data/lib/selenium/webdriver/common/service_manager.rb +36 -4
  76. data/lib/selenium/webdriver/common/socket_poller.rb +1 -1
  77. data/lib/selenium/webdriver/common/takes_screenshot.rb +1 -1
  78. data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +1 -1
  79. data/lib/selenium/webdriver/common/wait.rb +4 -1
  80. data/lib/selenium/webdriver/common/websocket_connection.rb +73 -37
  81. data/lib/selenium/webdriver/common.rb +2 -1
  82. data/lib/selenium/webdriver/devtools/response.rb +3 -3
  83. data/lib/selenium/webdriver/devtools.rb +1 -1
  84. data/lib/selenium/webdriver/edge/driver.rb +4 -3
  85. data/lib/selenium/webdriver/edge/service.rb +14 -0
  86. data/lib/selenium/webdriver/firefox/driver.rb +4 -6
  87. data/lib/selenium/webdriver/firefox/options.rb +19 -0
  88. data/lib/selenium/webdriver/firefox/profile.rb +13 -6
  89. data/lib/selenium/webdriver/firefox/service.rb +31 -2
  90. data/lib/selenium/webdriver/ie/driver.rb +4 -3
  91. data/lib/selenium/webdriver/ie/service.rb +10 -0
  92. data/lib/selenium/webdriver/remote/bidi_bridge.rb +44 -10
  93. data/lib/selenium/webdriver/remote/bridge.rb +20 -14
  94. data/lib/selenium/webdriver/remote/driver.rb +15 -4
  95. data/lib/selenium/webdriver/remote/features.rb +26 -1
  96. data/lib/selenium/webdriver/remote/http/common.rb +57 -12
  97. data/lib/selenium/webdriver/remote/http/curb.rb +6 -8
  98. data/lib/selenium/webdriver/remote/http/default.rb +56 -39
  99. data/lib/selenium/webdriver/safari/driver.rb +4 -3
  100. data/lib/selenium/webdriver/safari/options.rb +23 -4
  101. data/lib/selenium/webdriver/safari.rb +1 -6
  102. data/lib/selenium/webdriver/support/block_event_listener.rb +5 -1
  103. data/lib/selenium/webdriver/support/color.rb +14 -14
  104. data/lib/selenium/webdriver/support/event_firing_bridge.rb +5 -1
  105. data/lib/selenium/webdriver/support/guards/guard.rb +30 -14
  106. data/lib/selenium/webdriver/support/guards.rb +11 -4
  107. data/lib/selenium/webdriver/version.rb +1 -1
  108. data/lib/selenium/webdriver.rb +7 -2
  109. data/selenium-webdriver.gemspec +1 -1
  110. metadata +33 -11
  111. data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +0 -35
  112. data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +0 -33
  113. data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +0 -33
  114. data/lib/selenium/webdriver/bidi/log_inspector.rb +0 -147
@@ -0,0 +1,1052 @@
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
+ # DO NOT EDIT! This file is generated by rb/lib/selenium/webdriver/bidi/support/bidi_generate.rb.
21
+ # Regenerate with: `bazel run //rb/lib/selenium/webdriver:bidi-generate`
22
+
23
+ module Selenium
24
+ module WebDriver
25
+ class BiDi
26
+ module Protocol
27
+ # @api private
28
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
29
+ # @see https://w3c.github.io/webdriver-bidi/#module-script
30
+ class Script < Domain
31
+ EVENTS = {
32
+ message: 'script.message',
33
+ realm_created: 'script.realmCreated',
34
+ realm_destroyed: 'script.realmDestroyed'
35
+ }.freeze
36
+
37
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptspecialnumber
38
+ SPECIAL_NUMBER = {
39
+ na_n: 'NaN',
40
+ neg0: '-0',
41
+ infinity: 'Infinity',
42
+ neg_infinity: '-Infinity'
43
+ }.freeze
44
+
45
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-RealmType
46
+ REALM_TYPE = {
47
+ window: 'window',
48
+ dedicated_worker: 'dedicated-worker',
49
+ shared_worker: 'shared-worker',
50
+ service_worker: 'service-worker',
51
+ worker: 'worker',
52
+ paint_worklet: 'paint-worklet',
53
+ audio_worklet: 'audio-worklet',
54
+ worklet: 'worklet'
55
+ }.freeze
56
+
57
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-ResultOwnership
58
+ RESULT_OWNERSHIP = {
59
+ root: 'root',
60
+ none: 'none'
61
+ }.freeze
62
+
63
+ NODE_PROPERTIES_MODE = {
64
+ open: 'open',
65
+ closed: 'closed'
66
+ }.freeze
67
+
68
+ SERIALIZATION_OPTIONS_INCLUDE_SHADOW_TREE = {
69
+ none: 'none',
70
+ open: 'open',
71
+ all: 'all'
72
+ }.freeze
73
+
74
+ # @api private
75
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
76
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-ChannelValue
77
+ ChannelValue = Serialization::Record.define(
78
+ type: {fixed: 'channel'},
79
+ value: {wire_key: 'value', ref: 'Script::ChannelProperties'}
80
+ )
81
+
82
+ # @api private
83
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
84
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptchannelproperties
85
+ ChannelProperties = Serialization::Record.define(
86
+ channel: {wire_key: 'channel', primitive: 'string'},
87
+ serialization_options: {
88
+ wire_key: 'serializationOptions',
89
+ required: false,
90
+ ref: 'Script::SerializationOptions'
91
+ },
92
+ ownership: {wire_key: 'ownership', required: false, enum: 'Script::RESULT_OWNERSHIP'}
93
+ )
94
+
95
+ # @api private
96
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
97
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-EvaluateResult
98
+ class EvaluateResult < Serialization::Union
99
+ discriminator 'type', {success: 'success', exception: 'exception'}
100
+ variants(
101
+ success: 'Script::EvaluateResultSuccess',
102
+ exception: 'Script::EvaluateResultException'
103
+ )
104
+ object_only
105
+
106
+ def self.success(**) = Script::EvaluateResultSuccess.new(**)
107
+ def self.exception(**) = Script::EvaluateResultException.new(**)
108
+ end
109
+
110
+ # @api private
111
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
112
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptevaluateresultsuccess
113
+ EvaluateResultSuccess = Serialization::Record.define(
114
+ type: {fixed: 'success'},
115
+ result: {wire_key: 'result', ref: 'Script::RemoteValue'},
116
+ realm: {wire_key: 'realm', primitive: 'string'}
117
+ )
118
+
119
+ # @api private
120
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
121
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptevaluateresultexception
122
+ EvaluateResultException = Serialization::Record.define(
123
+ type: {fixed: 'exception'},
124
+ exception_details: {wire_key: 'exceptionDetails', ref: 'Script::ExceptionDetails'},
125
+ realm: {wire_key: 'realm', primitive: 'string'}
126
+ )
127
+
128
+ # @api private
129
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
130
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-ExceptionDetails
131
+ ExceptionDetails = Serialization::Record.define(
132
+ column_number: {wire_key: 'columnNumber', primitive: 'integer'},
133
+ exception: {wire_key: 'exception', ref: 'Script::RemoteValue'},
134
+ line_number: {wire_key: 'lineNumber', primitive: 'integer'},
135
+ stack_trace: {wire_key: 'stackTrace', ref: 'Script::StackTrace'},
136
+ text: {wire_key: 'text', primitive: 'string'}
137
+ )
138
+
139
+ # @api private
140
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
141
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-LocalValue
142
+ class LocalValue < Serialization::Union
143
+ discriminator 'type', {
144
+ undefined: 'undefined',
145
+ null: 'null',
146
+ string: 'string',
147
+ number: 'number',
148
+ boolean: 'boolean',
149
+ bigint: 'bigint',
150
+ channel: 'channel',
151
+ array: 'array',
152
+ date: 'date',
153
+ map: 'map',
154
+ object: 'object',
155
+ regexp: 'regexp',
156
+ set: 'set'
157
+ }
158
+ variants(
159
+ undefined: 'Script::UndefinedValue',
160
+ null: 'Script::NullValue',
161
+ string: 'Script::StringValue',
162
+ number: 'Script::NumberValue',
163
+ boolean: 'Script::BooleanValue',
164
+ bigint: 'Script::BigIntValue',
165
+ channel: 'Script::ChannelValue',
166
+ array: 'Script::ArrayLocalValue',
167
+ date: 'Script::DateLocalValue',
168
+ map: 'Script::MapLocalValue',
169
+ object: 'Script::ObjectLocalValue',
170
+ regexp: 'Script::RegExpLocalValue',
171
+ set: 'Script::SetLocalValue'
172
+ )
173
+ fallback 'Script::RemoteReference'
174
+ object_only
175
+
176
+ def self.undefined(**) = Script::UndefinedValue.new(**)
177
+ def self.null(**) = Script::NullValue.new(**)
178
+ def self.string(**) = Script::StringValue.new(**)
179
+ def self.number(**) = Script::NumberValue.new(**)
180
+ def self.boolean(**) = Script::BooleanValue.new(**)
181
+ def self.bigint(**) = Script::BigIntValue.new(**)
182
+ def self.channel(**) = Script::ChannelValue.new(**)
183
+ def self.array(**) = Script::ArrayLocalValue.new(**)
184
+ def self.date(**) = Script::DateLocalValue.new(**)
185
+ def self.map(**) = Script::MapLocalValue.new(**)
186
+ def self.object(**) = Script::ObjectLocalValue.new(**)
187
+ def self.regexp(**) = Script::RegExpLocalValue.new(**)
188
+ def self.set(**) = Script::SetLocalValue.new(**)
189
+ end
190
+
191
+ # @api private
192
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
193
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptarraylocalvalue
194
+ ArrayLocalValue = Serialization::Record.define(
195
+ type: {fixed: 'array'},
196
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true}
197
+ )
198
+
199
+ # @api private
200
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
201
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptdatelocalvalue
202
+ DateLocalValue = Serialization::Record.define(
203
+ type: {fixed: 'date'},
204
+ value: {wire_key: 'value', primitive: 'string'}
205
+ )
206
+
207
+ # @api private
208
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
209
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptmaplocalvalue
210
+ MapLocalValue = Serialization::Record.define(
211
+ type: {fixed: 'map'},
212
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true, scalar: 'string'}
213
+ )
214
+
215
+ # @api private
216
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
217
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptobjectlocalvalue
218
+ ObjectLocalValue = Serialization::Record.define(
219
+ type: {fixed: 'object'},
220
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true, scalar: 'string'}
221
+ )
222
+
223
+ # @api private
224
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
225
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptregexpvalue
226
+ RegExpValue = Serialization::Record.define(
227
+ pattern: {wire_key: 'pattern', primitive: 'string'},
228
+ flags: {wire_key: 'flags', required: false, primitive: 'string'}
229
+ )
230
+
231
+ # @api private
232
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
233
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptregexplocalvalue
234
+ RegExpLocalValue = Serialization::Record.define(
235
+ type: {fixed: 'regexp'},
236
+ value: {wire_key: 'value', ref: 'Script::RegExpValue'}
237
+ )
238
+
239
+ # @api private
240
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
241
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptsetlocalvalue
242
+ SetLocalValue = Serialization::Record.define(
243
+ type: {fixed: 'set'},
244
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true}
245
+ )
246
+
247
+ # @api private
248
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
249
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-PrimitiveProtocolValue
250
+ class PrimitiveProtocolValue < Serialization::Union
251
+ discriminator 'type', {
252
+ undefined: 'undefined',
253
+ null: 'null',
254
+ string: 'string',
255
+ number: 'number',
256
+ boolean: 'boolean',
257
+ bigint: 'bigint'
258
+ }
259
+ variants(
260
+ undefined: 'Script::UndefinedValue',
261
+ null: 'Script::NullValue',
262
+ string: 'Script::StringValue',
263
+ number: 'Script::NumberValue',
264
+ boolean: 'Script::BooleanValue',
265
+ bigint: 'Script::BigIntValue'
266
+ )
267
+ object_only
268
+
269
+ def self.undefined(**) = Script::UndefinedValue.new(**)
270
+ def self.null(**) = Script::NullValue.new(**)
271
+ def self.string(**) = Script::StringValue.new(**)
272
+ def self.number(**) = Script::NumberValue.new(**)
273
+ def self.boolean(**) = Script::BooleanValue.new(**)
274
+ def self.bigint(**) = Script::BigIntValue.new(**)
275
+ end
276
+
277
+ # @api private
278
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
279
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptundefinedvalue
280
+ UndefinedValue = Serialization::Record.define(type: {fixed: 'undefined'})
281
+
282
+ # @api private
283
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
284
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptnullvalue
285
+ NullValue = Serialization::Record.define(type: {fixed: 'null'})
286
+
287
+ # @api private
288
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
289
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptstringvalue
290
+ StringValue = Serialization::Record.define(
291
+ type: {fixed: 'string'},
292
+ value: {wire_key: 'value', primitive: 'string'}
293
+ )
294
+
295
+ # @api private
296
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
297
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptnumbervalue
298
+ NumberValue = Serialization::Record.define(type: {fixed: 'number'}, value: 'value')
299
+
300
+ # @api private
301
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
302
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptbooleanvalue
303
+ BooleanValue = Serialization::Record.define(
304
+ type: {fixed: 'boolean'},
305
+ value: {wire_key: 'value', primitive: 'boolean'}
306
+ )
307
+
308
+ # @api private
309
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
310
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptbigintvalue
311
+ BigIntValue = Serialization::Record.define(
312
+ type: {fixed: 'bigint'},
313
+ value: {wire_key: 'value', primitive: 'string'}
314
+ )
315
+
316
+ # @api private
317
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
318
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-RealmInfo
319
+ class RealmInfo < Serialization::Union
320
+ discriminator 'type', {
321
+ window: 'window',
322
+ dedicated_worker: 'dedicated-worker',
323
+ shared_worker: 'shared-worker',
324
+ service_worker: 'service-worker',
325
+ worker: 'worker',
326
+ paint_worklet: 'paint-worklet',
327
+ audio_worklet: 'audio-worklet',
328
+ worklet: 'worklet'
329
+ }
330
+ variants(
331
+ window: 'Script::WindowRealmInfo',
332
+ dedicated_worker: 'Script::DedicatedWorkerRealmInfo',
333
+ shared_worker: 'Script::SharedWorkerRealmInfo',
334
+ service_worker: 'Script::ServiceWorkerRealmInfo',
335
+ worker: 'Script::WorkerRealmInfo',
336
+ paint_worklet: 'Script::PaintWorkletRealmInfo',
337
+ audio_worklet: 'Script::AudioWorkletRealmInfo',
338
+ worklet: 'Script::WorkletRealmInfo'
339
+ )
340
+ object_only
341
+
342
+ def self.window(**) = Script::WindowRealmInfo.new(**)
343
+ def self.dedicated_worker(**) = Script::DedicatedWorkerRealmInfo.new(**)
344
+ def self.shared_worker(**) = Script::SharedWorkerRealmInfo.new(**)
345
+ def self.service_worker(**) = Script::ServiceWorkerRealmInfo.new(**)
346
+ def self.worker(**) = Script::WorkerRealmInfo.new(**)
347
+ def self.paint_worklet(**) = Script::PaintWorkletRealmInfo.new(**)
348
+ def self.audio_worklet(**) = Script::AudioWorkletRealmInfo.new(**)
349
+ def self.worklet(**) = Script::WorkletRealmInfo.new(**)
350
+ end
351
+
352
+ # @api private
353
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
354
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptbaserealminfo
355
+ BaseRealmInfo = Serialization::Record.define(
356
+ realm: {wire_key: 'realm', primitive: 'string'},
357
+ origin: {wire_key: 'origin', primitive: 'string'}
358
+ )
359
+
360
+ # @api private
361
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
362
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptwindowrealminfo
363
+ WindowRealmInfo = Serialization::Record.define(
364
+ type: {fixed: 'window'},
365
+ realm: {wire_key: 'realm', primitive: 'string'},
366
+ origin: {wire_key: 'origin', primitive: 'string'},
367
+ context: {wire_key: 'context', primitive: 'string'},
368
+ user_context: {wire_key: 'userContext', required: false, primitive: 'string'},
369
+ sandbox: {wire_key: 'sandbox', required: false, primitive: 'string'}
370
+ )
371
+
372
+ # @api private
373
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
374
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptdedicatedworkerrealminfo
375
+ DedicatedWorkerRealmInfo = Serialization::Record.define(
376
+ type: {fixed: 'dedicated-worker'},
377
+ realm: {wire_key: 'realm', primitive: 'string'},
378
+ origin: {wire_key: 'origin', primitive: 'string'},
379
+ owners: {wire_key: 'owners', list: true}
380
+ )
381
+
382
+ # @api private
383
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
384
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptsharedworkerrealminfo
385
+ SharedWorkerRealmInfo = Serialization::Record.define(
386
+ type: {fixed: 'shared-worker'},
387
+ realm: {wire_key: 'realm', primitive: 'string'},
388
+ origin: {wire_key: 'origin', primitive: 'string'}
389
+ )
390
+
391
+ # @api private
392
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
393
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptserviceworkerrealminfo
394
+ ServiceWorkerRealmInfo = Serialization::Record.define(
395
+ type: {fixed: 'service-worker'},
396
+ realm: {wire_key: 'realm', primitive: 'string'},
397
+ origin: {wire_key: 'origin', primitive: 'string'}
398
+ )
399
+
400
+ # @api private
401
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
402
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptworkerrealminfo
403
+ WorkerRealmInfo = Serialization::Record.define(
404
+ type: {fixed: 'worker'},
405
+ realm: {wire_key: 'realm', primitive: 'string'},
406
+ origin: {wire_key: 'origin', primitive: 'string'}
407
+ )
408
+
409
+ # @api private
410
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
411
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptpaintworkletrealminfo
412
+ PaintWorkletRealmInfo = Serialization::Record.define(
413
+ type: {fixed: 'paint-worklet'},
414
+ realm: {wire_key: 'realm', primitive: 'string'},
415
+ origin: {wire_key: 'origin', primitive: 'string'}
416
+ )
417
+
418
+ # @api private
419
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
420
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptaudioworkletrealminfo
421
+ AudioWorkletRealmInfo = Serialization::Record.define(
422
+ type: {fixed: 'audio-worklet'},
423
+ realm: {wire_key: 'realm', primitive: 'string'},
424
+ origin: {wire_key: 'origin', primitive: 'string'}
425
+ )
426
+
427
+ # @api private
428
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
429
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptworkletrealminfo
430
+ WorkletRealmInfo = Serialization::Record.define(
431
+ type: {fixed: 'worklet'},
432
+ realm: {wire_key: 'realm', primitive: 'string'},
433
+ origin: {wire_key: 'origin', primitive: 'string'}
434
+ )
435
+
436
+ # @api private
437
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
438
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-RemoteReference
439
+ class RemoteReference < Serialization::Union
440
+ presence(
441
+ 'Script::SharedReference' => ['sharedId'],
442
+ 'Script::RemoteObjectReference' => ['handle']
443
+ )
444
+ object_only
445
+ end
446
+
447
+ # @api private
448
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
449
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptsharedreference
450
+ SharedReference = Serialization::Record.define(
451
+ shared_id: {wire_key: 'sharedId', primitive: 'string'},
452
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
453
+ extensible: true
454
+ )
455
+
456
+ # @api private
457
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
458
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptremoteobjectreference
459
+ RemoteObjectReference = Serialization::Record.define(
460
+ handle: {wire_key: 'handle', primitive: 'string'},
461
+ shared_id: {wire_key: 'sharedId', required: false, primitive: 'string'},
462
+ extensible: true
463
+ )
464
+
465
+ # @api private
466
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
467
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-RemoteValue
468
+ class RemoteValue < Serialization::Union
469
+ discriminator 'type', {
470
+ undefined: 'undefined',
471
+ null: 'null',
472
+ string: 'string',
473
+ number: 'number',
474
+ boolean: 'boolean',
475
+ bigint: 'bigint',
476
+ symbol: 'symbol',
477
+ array: 'array',
478
+ object: 'object',
479
+ function: 'function',
480
+ regexp: 'regexp',
481
+ date: 'date',
482
+ map: 'map',
483
+ set: 'set',
484
+ weakmap: 'weakmap',
485
+ weakset: 'weakset',
486
+ generator: 'generator',
487
+ error: 'error',
488
+ proxy: 'proxy',
489
+ promise: 'promise',
490
+ typedarray: 'typedarray',
491
+ arraybuffer: 'arraybuffer',
492
+ nodelist: 'nodelist',
493
+ htmlcollection: 'htmlcollection',
494
+ node: 'node',
495
+ window: 'window'
496
+ }
497
+ variants(
498
+ undefined: 'Script::UndefinedValue',
499
+ null: 'Script::NullValue',
500
+ string: 'Script::StringValue',
501
+ number: 'Script::NumberValue',
502
+ boolean: 'Script::BooleanValue',
503
+ bigint: 'Script::BigIntValue',
504
+ symbol: 'Script::SymbolRemoteValue',
505
+ array: 'Script::ArrayRemoteValue',
506
+ object: 'Script::ObjectRemoteValue',
507
+ function: 'Script::FunctionRemoteValue',
508
+ regexp: 'Script::RegExpRemoteValue',
509
+ date: 'Script::DateRemoteValue',
510
+ map: 'Script::MapRemoteValue',
511
+ set: 'Script::SetRemoteValue',
512
+ weakmap: 'Script::WeakMapRemoteValue',
513
+ weakset: 'Script::WeakSetRemoteValue',
514
+ generator: 'Script::GeneratorRemoteValue',
515
+ error: 'Script::ErrorRemoteValue',
516
+ proxy: 'Script::ProxyRemoteValue',
517
+ promise: 'Script::PromiseRemoteValue',
518
+ typedarray: 'Script::TypedArrayRemoteValue',
519
+ arraybuffer: 'Script::ArrayBufferRemoteValue',
520
+ nodelist: 'Script::NodeListRemoteValue',
521
+ htmlcollection: 'Script::HTMLCollectionRemoteValue',
522
+ node: 'Script::NodeRemoteValue',
523
+ window: 'Script::WindowProxyRemoteValue'
524
+ )
525
+ object_only
526
+
527
+ def self.undefined(**) = Script::UndefinedValue.new(**)
528
+ def self.null(**) = Script::NullValue.new(**)
529
+ def self.string(**) = Script::StringValue.new(**)
530
+ def self.number(**) = Script::NumberValue.new(**)
531
+ def self.boolean(**) = Script::BooleanValue.new(**)
532
+ def self.bigint(**) = Script::BigIntValue.new(**)
533
+ def self.symbol(**) = Script::SymbolRemoteValue.new(**)
534
+ def self.array(**) = Script::ArrayRemoteValue.new(**)
535
+ def self.object(**) = Script::ObjectRemoteValue.new(**)
536
+ def self.function(**) = Script::FunctionRemoteValue.new(**)
537
+ def self.regexp(**) = Script::RegExpRemoteValue.new(**)
538
+ def self.date(**) = Script::DateRemoteValue.new(**)
539
+ def self.map(**) = Script::MapRemoteValue.new(**)
540
+ def self.set(**) = Script::SetRemoteValue.new(**)
541
+ def self.weakmap(**) = Script::WeakMapRemoteValue.new(**)
542
+ def self.weakset(**) = Script::WeakSetRemoteValue.new(**)
543
+ def self.generator(**) = Script::GeneratorRemoteValue.new(**)
544
+ def self.error(**) = Script::ErrorRemoteValue.new(**)
545
+ def self.proxy(**) = Script::ProxyRemoteValue.new(**)
546
+ def self.promise(**) = Script::PromiseRemoteValue.new(**)
547
+ def self.typedarray(**) = Script::TypedArrayRemoteValue.new(**)
548
+ def self.arraybuffer(**) = Script::ArrayBufferRemoteValue.new(**)
549
+ def self.nodelist(**) = Script::NodeListRemoteValue.new(**)
550
+ def self.htmlcollection(**) = Script::HTMLCollectionRemoteValue.new(**)
551
+ def self.node(**) = Script::NodeRemoteValue.new(**)
552
+ def self.window(**) = Script::WindowProxyRemoteValue.new(**)
553
+ end
554
+
555
+ # @api private
556
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
557
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptsymbolremotevalue
558
+ SymbolRemoteValue = Serialization::Record.define(
559
+ type: {fixed: 'symbol'},
560
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
561
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
562
+ )
563
+
564
+ # @api private
565
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
566
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptarrayremotevalue
567
+ ArrayRemoteValue = Serialization::Record.define(
568
+ type: {fixed: 'array'},
569
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
570
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'},
571
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
572
+ )
573
+
574
+ # @api private
575
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
576
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptobjectremotevalue
577
+ ObjectRemoteValue = Serialization::Record.define(
578
+ type: {fixed: 'object'},
579
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
580
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'},
581
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true, scalar: 'string'}
582
+ )
583
+
584
+ # @api private
585
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
586
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptfunctionremotevalue
587
+ FunctionRemoteValue = Serialization::Record.define(
588
+ type: {fixed: 'function'},
589
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
590
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
591
+ )
592
+
593
+ # @api private
594
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
595
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptregexpremotevalue
596
+ RegExpRemoteValue = Serialization::Record.define(
597
+ type: {fixed: 'regexp'},
598
+ value: {wire_key: 'value', ref: 'Script::RegExpValue'},
599
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
600
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
601
+ )
602
+
603
+ # @api private
604
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
605
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptdateremotevalue
606
+ DateRemoteValue = Serialization::Record.define(
607
+ type: {fixed: 'date'},
608
+ value: {wire_key: 'value', primitive: 'string'},
609
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
610
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
611
+ )
612
+
613
+ # @api private
614
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
615
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptmapremotevalue
616
+ MapRemoteValue = Serialization::Record.define(
617
+ type: {fixed: 'map'},
618
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
619
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'},
620
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true, scalar: 'string'}
621
+ )
622
+
623
+ # @api private
624
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
625
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptsetremotevalue
626
+ SetRemoteValue = Serialization::Record.define(
627
+ type: {fixed: 'set'},
628
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
629
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'},
630
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
631
+ )
632
+
633
+ # @api private
634
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
635
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptweakmapremotevalue
636
+ WeakMapRemoteValue = Serialization::Record.define(
637
+ type: {fixed: 'weakmap'},
638
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
639
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
640
+ )
641
+
642
+ # @api private
643
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
644
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptweaksetremotevalue
645
+ WeakSetRemoteValue = Serialization::Record.define(
646
+ type: {fixed: 'weakset'},
647
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
648
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
649
+ )
650
+
651
+ # @api private
652
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
653
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptgeneratorremotevalue
654
+ GeneratorRemoteValue = Serialization::Record.define(
655
+ type: {fixed: 'generator'},
656
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
657
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
658
+ )
659
+
660
+ # @api private
661
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
662
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scripterrorremotevalue
663
+ ErrorRemoteValue = Serialization::Record.define(
664
+ type: {fixed: 'error'},
665
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
666
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
667
+ )
668
+
669
+ # @api private
670
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
671
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptproxyremotevalue
672
+ ProxyRemoteValue = Serialization::Record.define(
673
+ type: {fixed: 'proxy'},
674
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
675
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
676
+ )
677
+
678
+ # @api private
679
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
680
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptpromiseremotevalue
681
+ PromiseRemoteValue = Serialization::Record.define(
682
+ type: {fixed: 'promise'},
683
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
684
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
685
+ )
686
+
687
+ # @api private
688
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
689
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scripttypedarrayremotevalue
690
+ TypedArrayRemoteValue = Serialization::Record.define(
691
+ type: {fixed: 'typedarray'},
692
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
693
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
694
+ )
695
+
696
+ # @api private
697
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
698
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptarraybufferremotevalue
699
+ ArrayBufferRemoteValue = Serialization::Record.define(
700
+ type: {fixed: 'arraybuffer'},
701
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
702
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
703
+ )
704
+
705
+ # @api private
706
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
707
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptnodelistremotevalue
708
+ NodeListRemoteValue = Serialization::Record.define(
709
+ type: {fixed: 'nodelist'},
710
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
711
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'},
712
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
713
+ )
714
+
715
+ # @api private
716
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
717
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scripthtmlcollectionremotevalue
718
+ HTMLCollectionRemoteValue = Serialization::Record.define(
719
+ type: {fixed: 'htmlcollection'},
720
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
721
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'},
722
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
723
+ )
724
+
725
+ # @api private
726
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
727
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptnoderemotevalue
728
+ NodeRemoteValue = Serialization::Record.define(
729
+ type: {fixed: 'node'},
730
+ shared_id: {wire_key: 'sharedId', required: false, primitive: 'string'},
731
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
732
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'},
733
+ value: {wire_key: 'value', required: false, ref: 'Script::NodeProperties'}
734
+ )
735
+
736
+ # @api private
737
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
738
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptnodeproperties
739
+ NodeProperties = Serialization::Record.define(
740
+ node_type: {wire_key: 'nodeType', primitive: 'integer'},
741
+ child_node_count: {wire_key: 'childNodeCount', primitive: 'integer'},
742
+ attributes: {wire_key: 'attributes', required: false},
743
+ children: {wire_key: 'children', required: false, ref: 'Script::NodeRemoteValue', list: true},
744
+ local_name: {wire_key: 'localName', required: false, primitive: 'string'},
745
+ mode: {wire_key: 'mode', required: false, enum: 'Script::NODE_PROPERTIES_MODE'},
746
+ namespace_uri: {wire_key: 'namespaceURI', required: false, primitive: 'string'},
747
+ node_value: {wire_key: 'nodeValue', required: false, primitive: 'string'},
748
+ shadow_root: {wire_key: 'shadowRoot', required: false, nullable: true, ref: 'Script::NodeRemoteValue'}
749
+ )
750
+
751
+ # @api private
752
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
753
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptwindowproxyremotevalue
754
+ WindowProxyRemoteValue = Serialization::Record.define(
755
+ type: {fixed: 'window'},
756
+ value: {wire_key: 'value', ref: 'Script::WindowProxyProperties'},
757
+ handle: {wire_key: 'handle', required: false, primitive: 'string'},
758
+ internal_id: {wire_key: 'internalId', required: false, primitive: 'string'}
759
+ )
760
+
761
+ # @api private
762
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
763
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptwindowproxyproperties
764
+ WindowProxyProperties = Serialization::Record.define(context: {wire_key: 'context', primitive: 'string'})
765
+
766
+ # @api private
767
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
768
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-SerializationOptions
769
+ SerializationOptions = Serialization::Record.define(
770
+ max_dom_depth: {wire_key: 'maxDomDepth', required: false, nullable: true, primitive: 'integer'},
771
+ max_object_depth: {wire_key: 'maxObjectDepth', required: false, nullable: true, primitive: 'integer'},
772
+ include_shadow_tree: {
773
+ wire_key: 'includeShadowTree',
774
+ required: false,
775
+ enum: 'Script::SERIALIZATION_OPTIONS_INCLUDE_SHADOW_TREE'
776
+ }
777
+ )
778
+
779
+ # @api private
780
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
781
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-StackFrame
782
+ StackFrame = Serialization::Record.define(
783
+ column_number: {wire_key: 'columnNumber', primitive: 'integer'},
784
+ function_name: {wire_key: 'functionName', primitive: 'string'},
785
+ line_number: {wire_key: 'lineNumber', primitive: 'integer'},
786
+ url: {wire_key: 'url', primitive: 'string'}
787
+ )
788
+
789
+ # @api private
790
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
791
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-StackTrace
792
+ StackTrace = Serialization::Record.define(
793
+ call_frames: {wire_key: 'callFrames', ref: 'Script::StackFrame', list: true}
794
+ )
795
+
796
+ # @api private
797
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
798
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-Source
799
+ Source = Serialization::Record.define(
800
+ realm: {wire_key: 'realm', primitive: 'string'},
801
+ context: {wire_key: 'context', required: false, primitive: 'string'},
802
+ user_context: {wire_key: 'userContext', required: false, primitive: 'string'}
803
+ )
804
+
805
+ # @api private
806
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
807
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptrealmtarget
808
+ RealmTarget = Serialization::Record.define(realm: {wire_key: 'realm', primitive: 'string'})
809
+
810
+ # @api private
811
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
812
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptcontexttarget
813
+ ContextTarget = Serialization::Record.define(
814
+ context: {wire_key: 'context', primitive: 'string'},
815
+ sandbox: {wire_key: 'sandbox', required: false, primitive: 'string'}
816
+ )
817
+
818
+ # @api private
819
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
820
+ # @see https://w3c.github.io/webdriver-bidi/#type-script-Target
821
+ class Target < Serialization::Union
822
+ presence(
823
+ 'Script::ContextTarget' => ['context'],
824
+ 'Script::RealmTarget' => ['realm']
825
+ )
826
+ object_only
827
+ end
828
+
829
+ # @api private
830
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
831
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptaddpreloadscriptparameters
832
+ AddPreloadScriptParameters = Serialization::Record.define(
833
+ function_declaration: {wire_key: 'functionDeclaration', primitive: 'string'},
834
+ arguments: {wire_key: 'arguments', required: false, ref: 'Script::ChannelValue', list: true},
835
+ contexts: {wire_key: 'contexts', required: false, list: true},
836
+ user_contexts: {wire_key: 'userContexts', required: false, list: true},
837
+ sandbox: {wire_key: 'sandbox', required: false, primitive: 'string'}
838
+ )
839
+
840
+ # @api private
841
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
842
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptaddpreloadscriptresult
843
+ AddPreloadScriptResult = Serialization::Record.define(script: {wire_key: 'script', primitive: 'string'})
844
+
845
+ # @api private
846
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
847
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptdisownparameters
848
+ DisownParameters = Serialization::Record.define(
849
+ handles: {wire_key: 'handles', list: true},
850
+ target: {wire_key: 'target', ref: 'Script::Target'}
851
+ )
852
+
853
+ # @api private
854
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
855
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptcallfunctionparameters
856
+ CallFunctionParameters = Serialization::Record.define(
857
+ function_declaration: {wire_key: 'functionDeclaration', primitive: 'string'},
858
+ await_promise: {wire_key: 'awaitPromise', primitive: 'boolean'},
859
+ target: {wire_key: 'target', ref: 'Script::Target'},
860
+ arguments: {wire_key: 'arguments', required: false, ref: 'Script::LocalValue', list: true},
861
+ result_ownership: {wire_key: 'resultOwnership', required: false, enum: 'Script::RESULT_OWNERSHIP'},
862
+ serialization_options: {
863
+ wire_key: 'serializationOptions',
864
+ required: false,
865
+ ref: 'Script::SerializationOptions'
866
+ },
867
+ this: {wire_key: 'this', required: false, ref: 'Script::LocalValue'},
868
+ user_activation: {wire_key: 'userActivation', required: false, primitive: 'boolean'}
869
+ )
870
+
871
+ # @api private
872
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
873
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptevaluateparameters
874
+ EvaluateParameters = Serialization::Record.define(
875
+ expression: {wire_key: 'expression', primitive: 'string'},
876
+ target: {wire_key: 'target', ref: 'Script::Target'},
877
+ await_promise: {wire_key: 'awaitPromise', primitive: 'boolean'},
878
+ result_ownership: {wire_key: 'resultOwnership', required: false, enum: 'Script::RESULT_OWNERSHIP'},
879
+ serialization_options: {
880
+ wire_key: 'serializationOptions',
881
+ required: false,
882
+ ref: 'Script::SerializationOptions'
883
+ },
884
+ user_activation: {wire_key: 'userActivation', required: false, primitive: 'boolean'}
885
+ )
886
+
887
+ # @api private
888
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
889
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptgetrealmsparameters
890
+ GetRealmsParameters = Serialization::Record.define(
891
+ context: {wire_key: 'context', required: false, primitive: 'string'},
892
+ type: {wire_key: 'type', required: false, enum: 'Script::REALM_TYPE'}
893
+ )
894
+
895
+ # @api private
896
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
897
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptgetrealmsresult
898
+ GetRealmsResult = Serialization::Record.define(
899
+ realms: {wire_key: 'realms', ref: 'Script::RealmInfo', list: true}
900
+ )
901
+
902
+ # @api private
903
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
904
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptremovepreloadscriptparameters
905
+ RemovePreloadScriptParameters = Serialization::Record.define(
906
+ script: {wire_key: 'script', primitive: 'string'}
907
+ )
908
+
909
+ # @api private
910
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
911
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptmessageparameters
912
+ MessageParameters = Serialization::Record.define(
913
+ channel: {wire_key: 'channel', primitive: 'string'},
914
+ data: {wire_key: 'data', ref: 'Script::RemoteValue'},
915
+ source: {wire_key: 'source', ref: 'Script::Source'}
916
+ )
917
+
918
+ # @api private
919
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
920
+ # @see https://w3c.github.io/webdriver-bidi/#cddl-type-scriptrealmdestroyedparameters
921
+ RealmDestroyedParameters = Serialization::Record.define(realm: {wire_key: 'realm', primitive: 'string'})
922
+
923
+ EVENT_TYPES = {
924
+ 'script.message' => Script::MessageParameters,
925
+ 'script.realmCreated' => Script::RealmInfo,
926
+ 'script.realmDestroyed' => Script::RealmDestroyedParameters
927
+ }.freeze
928
+
929
+ def channel_value(**) = ChannelValue.new(**)
930
+ def channel_properties(**) = ChannelProperties.new(**)
931
+ def local_value = LocalValue
932
+ def array_local_value(**) = ArrayLocalValue.new(**)
933
+ def date_local_value(**) = DateLocalValue.new(**)
934
+ def map_local_value(**) = MapLocalValue.new(**)
935
+ def object_local_value(**) = ObjectLocalValue.new(**)
936
+ def reg_exp_value(**) = RegExpValue.new(**)
937
+ def reg_exp_local_value(**) = RegExpLocalValue.new(**)
938
+ def set_local_value(**) = SetLocalValue.new(**)
939
+ def primitive_protocol_value = PrimitiveProtocolValue
940
+ def undefined_value(**) = UndefinedValue.new(**)
941
+ def null_value(**) = NullValue.new(**)
942
+ def string_value(**) = StringValue.new(**)
943
+ def number_value(**) = NumberValue.new(**)
944
+ def boolean_value(**) = BooleanValue.new(**)
945
+ def big_int_value(**) = BigIntValue.new(**)
946
+ def remote_reference = RemoteReference
947
+ def shared_reference(**) = SharedReference.new(**)
948
+ def remote_object_reference(**) = RemoteObjectReference.new(**)
949
+ def serialization_options(**) = SerializationOptions.new(**)
950
+ def realm_target(**) = RealmTarget.new(**)
951
+ def context_target(**) = ContextTarget.new(**)
952
+ def target = Target
953
+
954
+ # @api private
955
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
956
+ # @see https://w3c.github.io/webdriver-bidi/#command-script-addPreloadScript
957
+ def add_preload_script(
958
+ function_declaration:,
959
+ arguments: Serialization::UNSET,
960
+ contexts: Serialization::UNSET,
961
+ user_contexts: Serialization::UNSET,
962
+ sandbox: Serialization::UNSET
963
+ )
964
+ params = AddPreloadScriptParameters.new(
965
+ function_declaration: function_declaration,
966
+ arguments: arguments,
967
+ contexts: contexts,
968
+ user_contexts: user_contexts,
969
+ sandbox: sandbox
970
+ )
971
+ execute(cmd: 'script.addPreloadScript', params: params, result: Script::AddPreloadScriptResult)
972
+ end
973
+
974
+ # @api private
975
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
976
+ # @see https://w3c.github.io/webdriver-bidi/#command-script-callFunction
977
+ def call_function(
978
+ function_declaration:,
979
+ await_promise:,
980
+ target:,
981
+ arguments: Serialization::UNSET,
982
+ result_ownership: Serialization::UNSET,
983
+ serialization_options: Serialization::UNSET,
984
+ this: Serialization::UNSET,
985
+ user_activation: Serialization::UNSET
986
+ )
987
+ Serialization.validate!('resultOwnership', result_ownership, Script::RESULT_OWNERSHIP)
988
+ params = CallFunctionParameters.new(
989
+ function_declaration: function_declaration,
990
+ await_promise: await_promise,
991
+ target: target,
992
+ arguments: arguments,
993
+ result_ownership: result_ownership,
994
+ serialization_options: serialization_options,
995
+ this: this,
996
+ user_activation: user_activation
997
+ )
998
+ execute(cmd: 'script.callFunction', params: params, result: Script::EvaluateResult)
999
+ end
1000
+
1001
+ # @api private
1002
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
1003
+ # @see https://w3c.github.io/webdriver-bidi/#command-script-disown
1004
+ def disown(handles:, target:)
1005
+ params = DisownParameters.new(handles: handles, target: target)
1006
+ execute(cmd: 'script.disown', params: params)
1007
+ end
1008
+
1009
+ # @api private
1010
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
1011
+ # @see https://w3c.github.io/webdriver-bidi/#command-script-evaluate
1012
+ def evaluate(
1013
+ expression:,
1014
+ target:,
1015
+ await_promise:,
1016
+ result_ownership: Serialization::UNSET,
1017
+ serialization_options: Serialization::UNSET,
1018
+ user_activation: Serialization::UNSET
1019
+ )
1020
+ Serialization.validate!('resultOwnership', result_ownership, Script::RESULT_OWNERSHIP)
1021
+ params = EvaluateParameters.new(
1022
+ expression: expression,
1023
+ target: target,
1024
+ await_promise: await_promise,
1025
+ result_ownership: result_ownership,
1026
+ serialization_options: serialization_options,
1027
+ user_activation: user_activation
1028
+ )
1029
+ execute(cmd: 'script.evaluate', params: params, result: Script::EvaluateResult)
1030
+ end
1031
+
1032
+ # @api private
1033
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
1034
+ # @see https://w3c.github.io/webdriver-bidi/#command-script-getRealms
1035
+ def get_realms(context: Serialization::UNSET, type: Serialization::UNSET)
1036
+ Serialization.validate!('type', type, Script::REALM_TYPE)
1037
+ params = GetRealmsParameters.new(context: context, type: type)
1038
+ execute(cmd: 'script.getRealms', params: params, result: Script::GetRealmsResult)
1039
+ end
1040
+
1041
+ # @api private
1042
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
1043
+ # @see https://w3c.github.io/webdriver-bidi/#command-script-removePreloadScript
1044
+ def remove_preload_script(script:)
1045
+ params = RemovePreloadScriptParameters.new(script: script)
1046
+ execute(cmd: 'script.removePreloadScript', params: params)
1047
+ end
1048
+ end # Script
1049
+ end # Protocol
1050
+ end # BiDi
1051
+ end # WebDriver
1052
+ end # Selenium