selenium-webdriver 4.45.0 → 4.46.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +7 -0
  3. data/bin/linux/selenium-manager +0 -0
  4. data/bin/macos/selenium-manager +0 -0
  5. data/bin/windows/selenium-manager.exe +0 -0
  6. data/lib/selenium/webdriver/bidi/protocol/bluetooth.rb +465 -0
  7. data/lib/selenium/webdriver/bidi/protocol/browser.rb +222 -0
  8. data/lib/selenium/webdriver/bidi/protocol/browsing_context.rb +694 -0
  9. data/lib/selenium/webdriver/bidi/protocol/domain.rb +40 -0
  10. data/lib/selenium/webdriver/bidi/protocol/emulation.rb +334 -0
  11. data/lib/selenium/webdriver/bidi/protocol/input.rb +281 -0
  12. data/lib/selenium/webdriver/bidi/protocol/log.rb +104 -0
  13. data/lib/selenium/webdriver/bidi/protocol/network.rb +637 -0
  14. data/lib/selenium/webdriver/bidi/protocol/permissions.rb +73 -0
  15. data/lib/selenium/webdriver/bidi/protocol/script.rb +874 -0
  16. data/lib/selenium/webdriver/bidi/protocol/session.rb +241 -0
  17. data/lib/selenium/webdriver/bidi/protocol/speculation.rb +56 -0
  18. data/lib/selenium/webdriver/bidi/protocol/storage.rb +157 -0
  19. data/lib/selenium/webdriver/bidi/protocol/user_agent_client_hints.rb +83 -0
  20. data/lib/selenium/webdriver/bidi/protocol/web_extension.rb +93 -0
  21. data/lib/selenium/webdriver/bidi/protocol.rb +39 -0
  22. data/lib/selenium/webdriver/bidi/serialization/record.rb +226 -0
  23. data/lib/selenium/webdriver/bidi/serialization/union.rb +114 -0
  24. data/lib/selenium/webdriver/bidi/serialization.rb +78 -0
  25. data/lib/selenium/webdriver/bidi/support/bidi_generate.rb +936 -0
  26. data/lib/selenium/webdriver/bidi/support/check_generated.rb +55 -0
  27. data/lib/selenium/webdriver/bidi/transport.rb +52 -0
  28. data/lib/selenium/webdriver/bidi.rb +3 -0
  29. data/lib/selenium/webdriver/chrome/driver.rb +3 -3
  30. data/lib/selenium/webdriver/common/client_config.rb +97 -0
  31. data/lib/selenium/webdriver/common/driver.rb +2 -2
  32. data/lib/selenium/webdriver/common/local_driver.rb +15 -4
  33. data/lib/selenium/webdriver/common/proxy.rb +1 -1
  34. data/lib/selenium/webdriver/common.rb +1 -0
  35. data/lib/selenium/webdriver/edge/driver.rb +3 -3
  36. data/lib/selenium/webdriver/firefox/driver.rb +3 -3
  37. data/lib/selenium/webdriver/ie/driver.rb +3 -3
  38. data/lib/selenium/webdriver/remote/bidi_bridge.rb +6 -1
  39. data/lib/selenium/webdriver/remote/bridge.rb +8 -10
  40. data/lib/selenium/webdriver/remote/driver.rb +12 -4
  41. data/lib/selenium/webdriver/remote/http/common.rb +25 -12
  42. data/lib/selenium/webdriver/remote/http/default.rb +56 -39
  43. data/lib/selenium/webdriver/safari/driver.rb +3 -3
  44. data/lib/selenium/webdriver/version.rb +1 -1
  45. metadata +25 -2
@@ -0,0 +1,874 @@
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
+ # This file is automatically generated. DO NOT EDIT!
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
+ class Script < Domain
30
+ EVENTS = {
31
+ message: 'script.message',
32
+ realm_created: 'script.realmCreated',
33
+ realm_destroyed: 'script.realmDestroyed'
34
+ }.freeze
35
+
36
+ SPECIAL_NUMBER = {
37
+ na_n: 'NaN',
38
+ neg0: '-0',
39
+ infinity: 'Infinity',
40
+ neg_infinity: '-Infinity'
41
+ }.freeze
42
+
43
+ REALM_TYPE = {
44
+ window: 'window',
45
+ dedicated_worker: 'dedicated-worker',
46
+ shared_worker: 'shared-worker',
47
+ service_worker: 'service-worker',
48
+ worker: 'worker',
49
+ paint_worklet: 'paint-worklet',
50
+ audio_worklet: 'audio-worklet',
51
+ worklet: 'worklet'
52
+ }.freeze
53
+
54
+ RESULT_OWNERSHIP = {
55
+ root: 'root',
56
+ none: 'none'
57
+ }.freeze
58
+
59
+ NODE_PROPERTIES_MODE = {
60
+ open: 'open',
61
+ closed: 'closed'
62
+ }.freeze
63
+
64
+ SERIALIZATION_OPTIONS_INCLUDE_SHADOW_TREE = {
65
+ none: 'none',
66
+ open: 'open',
67
+ all: 'all'
68
+ }.freeze
69
+
70
+ # @api private
71
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
72
+ ChannelValue = Serialization::Record.define(
73
+ type: {fixed: 'channel'},
74
+ value: {wire_key: 'value', ref: 'Script::ChannelProperties'}
75
+ )
76
+
77
+ # @api private
78
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
79
+ ChannelProperties = Serialization::Record.define(
80
+ channel: 'channel',
81
+ serialization_options: {
82
+ wire_key: 'serializationOptions',
83
+ required: false,
84
+ ref: 'Script::SerializationOptions'
85
+ },
86
+ ownership: {wire_key: 'ownership', required: false, enum: 'Script::RESULT_OWNERSHIP'}
87
+ )
88
+
89
+ # @api private
90
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
91
+ class EvaluateResult < Serialization::Union
92
+ discriminator 'type', {success: 'success', exception: 'exception'}
93
+ variants(
94
+ success: 'Script::EvaluateResultSuccess',
95
+ exception: 'Script::EvaluateResultException'
96
+ )
97
+ end
98
+
99
+ # @api private
100
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
101
+ EvaluateResultSuccess = Serialization::Record.define(
102
+ type: {fixed: 'success'},
103
+ result: {wire_key: 'result', ref: 'Script::RemoteValue'},
104
+ realm: 'realm'
105
+ )
106
+
107
+ # @api private
108
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
109
+ EvaluateResultException = Serialization::Record.define(
110
+ type: {fixed: 'exception'},
111
+ exception_details: {wire_key: 'exceptionDetails', ref: 'Script::ExceptionDetails'},
112
+ realm: 'realm'
113
+ )
114
+
115
+ # @api private
116
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
117
+ ExceptionDetails = Serialization::Record.define(
118
+ column_number: 'columnNumber',
119
+ exception: {wire_key: 'exception', ref: 'Script::RemoteValue'},
120
+ line_number: 'lineNumber',
121
+ stack_trace: {wire_key: 'stackTrace', ref: 'Script::StackTrace'},
122
+ text: {wire_key: 'text', primitive: 'string'}
123
+ )
124
+
125
+ # @api private
126
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
127
+ class LocalValue < Serialization::Union
128
+ discriminator 'type', {
129
+ undefined: 'undefined',
130
+ null: 'null',
131
+ string: 'string',
132
+ number: 'number',
133
+ boolean: 'boolean',
134
+ bigint: 'bigint',
135
+ channel: 'channel',
136
+ array: 'array',
137
+ date: 'date',
138
+ map: 'map',
139
+ object: 'object',
140
+ regexp: 'regexp',
141
+ set: 'set'
142
+ }
143
+ variants(
144
+ undefined: 'Script::UndefinedValue',
145
+ null: 'Script::NullValue',
146
+ string: 'Script::StringValue',
147
+ number: 'Script::NumberValue',
148
+ boolean: 'Script::BooleanValue',
149
+ bigint: 'Script::BigIntValue',
150
+ channel: 'Script::ChannelValue',
151
+ array: 'Script::ArrayLocalValue',
152
+ date: 'Script::DateLocalValue',
153
+ map: 'Script::MapLocalValue',
154
+ object: 'Script::ObjectLocalValue',
155
+ regexp: 'Script::RegExpLocalValue',
156
+ set: 'Script::SetLocalValue'
157
+ )
158
+ fallback 'Script::RemoteReference'
159
+ end
160
+
161
+ # @api private
162
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
163
+ ArrayLocalValue = Serialization::Record.define(
164
+ type: {fixed: 'array'},
165
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true}
166
+ )
167
+
168
+ # @api private
169
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
170
+ DateLocalValue = Serialization::Record.define(
171
+ type: {fixed: 'date'},
172
+ value: {wire_key: 'value', primitive: 'string'}
173
+ )
174
+
175
+ # @api private
176
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
177
+ MapLocalValue = Serialization::Record.define(
178
+ type: {fixed: 'map'},
179
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true}
180
+ )
181
+
182
+ # @api private
183
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
184
+ ObjectLocalValue = Serialization::Record.define(
185
+ type: {fixed: 'object'},
186
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true}
187
+ )
188
+
189
+ # @api private
190
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
191
+ RegExpValue = Serialization::Record.define(
192
+ pattern: {wire_key: 'pattern', primitive: 'string'},
193
+ flags: {wire_key: 'flags', required: false, primitive: 'string'}
194
+ )
195
+
196
+ # @api private
197
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
198
+ RegExpLocalValue = Serialization::Record.define(
199
+ type: {fixed: 'regexp'},
200
+ value: {wire_key: 'value', ref: 'Script::RegExpValue'}
201
+ )
202
+
203
+ # @api private
204
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
205
+ SetLocalValue = Serialization::Record.define(
206
+ type: {fixed: 'set'},
207
+ value: {wire_key: 'value', ref: 'Script::LocalValue', list: true}
208
+ )
209
+
210
+ # @api private
211
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
212
+ class PrimitiveProtocolValue < Serialization::Union
213
+ discriminator 'type', {
214
+ undefined: 'undefined',
215
+ null: 'null',
216
+ string: 'string',
217
+ number: 'number',
218
+ boolean: 'boolean',
219
+ bigint: 'bigint'
220
+ }
221
+ variants(
222
+ undefined: 'Script::UndefinedValue',
223
+ null: 'Script::NullValue',
224
+ string: 'Script::StringValue',
225
+ number: 'Script::NumberValue',
226
+ boolean: 'Script::BooleanValue',
227
+ bigint: 'Script::BigIntValue'
228
+ )
229
+ end
230
+
231
+ # @api private
232
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
233
+ UndefinedValue = Serialization::Record.define(type: {fixed: 'undefined'})
234
+
235
+ # @api private
236
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
237
+ NullValue = Serialization::Record.define(type: {fixed: 'null'})
238
+
239
+ # @api private
240
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
241
+ StringValue = Serialization::Record.define(
242
+ type: {fixed: 'string'},
243
+ value: {wire_key: 'value', primitive: 'string'}
244
+ )
245
+
246
+ # @api private
247
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
248
+ NumberValue = Serialization::Record.define(type: {fixed: 'number'}, value: 'value')
249
+
250
+ # @api private
251
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
252
+ BooleanValue = Serialization::Record.define(
253
+ type: {fixed: 'boolean'},
254
+ value: {wire_key: 'value', primitive: 'boolean'}
255
+ )
256
+
257
+ # @api private
258
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
259
+ BigIntValue = Serialization::Record.define(
260
+ type: {fixed: 'bigint'},
261
+ value: {wire_key: 'value', primitive: 'string'}
262
+ )
263
+
264
+ # @api private
265
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
266
+ class RealmInfo < Serialization::Union
267
+ discriminator 'type', {
268
+ window: 'window',
269
+ dedicated_worker: 'dedicated-worker',
270
+ shared_worker: 'shared-worker',
271
+ service_worker: 'service-worker',
272
+ worker: 'worker',
273
+ paint_worklet: 'paint-worklet',
274
+ audio_worklet: 'audio-worklet',
275
+ worklet: 'worklet'
276
+ }
277
+ variants(
278
+ window: 'Script::WindowRealmInfo',
279
+ dedicated_worker: 'Script::DedicatedWorkerRealmInfo',
280
+ shared_worker: 'Script::SharedWorkerRealmInfo',
281
+ service_worker: 'Script::ServiceWorkerRealmInfo',
282
+ worker: 'Script::WorkerRealmInfo',
283
+ paint_worklet: 'Script::PaintWorkletRealmInfo',
284
+ audio_worklet: 'Script::AudioWorkletRealmInfo',
285
+ worklet: 'Script::WorkletRealmInfo'
286
+ )
287
+ end
288
+
289
+ # @api private
290
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
291
+ BaseRealmInfo = Serialization::Record.define(
292
+ realm: 'realm',
293
+ origin: {wire_key: 'origin', primitive: 'string'}
294
+ )
295
+
296
+ # @api private
297
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
298
+ WindowRealmInfo = Serialization::Record.define(
299
+ type: {fixed: 'window'},
300
+ realm: 'realm',
301
+ origin: {wire_key: 'origin', primitive: 'string'},
302
+ context: 'context',
303
+ user_context: {wire_key: 'userContext', required: false},
304
+ sandbox: {wire_key: 'sandbox', required: false, primitive: 'string'}
305
+ )
306
+
307
+ # @api private
308
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
309
+ DedicatedWorkerRealmInfo = Serialization::Record.define(
310
+ type: {fixed: 'dedicated-worker'},
311
+ realm: 'realm',
312
+ origin: {wire_key: 'origin', primitive: 'string'},
313
+ owners: {wire_key: 'owners', list: true}
314
+ )
315
+
316
+ # @api private
317
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
318
+ SharedWorkerRealmInfo = Serialization::Record.define(
319
+ type: {fixed: 'shared-worker'},
320
+ realm: 'realm',
321
+ origin: {wire_key: 'origin', primitive: 'string'}
322
+ )
323
+
324
+ # @api private
325
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
326
+ ServiceWorkerRealmInfo = Serialization::Record.define(
327
+ type: {fixed: 'service-worker'},
328
+ realm: 'realm',
329
+ origin: {wire_key: 'origin', primitive: 'string'}
330
+ )
331
+
332
+ # @api private
333
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
334
+ WorkerRealmInfo = Serialization::Record.define(
335
+ type: {fixed: 'worker'},
336
+ realm: 'realm',
337
+ origin: {wire_key: 'origin', primitive: 'string'}
338
+ )
339
+
340
+ # @api private
341
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
342
+ PaintWorkletRealmInfo = Serialization::Record.define(
343
+ type: {fixed: 'paint-worklet'},
344
+ realm: 'realm',
345
+ origin: {wire_key: 'origin', primitive: 'string'}
346
+ )
347
+
348
+ # @api private
349
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
350
+ AudioWorkletRealmInfo = Serialization::Record.define(
351
+ type: {fixed: 'audio-worklet'},
352
+ realm: 'realm',
353
+ origin: {wire_key: 'origin', primitive: 'string'}
354
+ )
355
+
356
+ # @api private
357
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
358
+ WorkletRealmInfo = Serialization::Record.define(
359
+ type: {fixed: 'worklet'},
360
+ realm: 'realm',
361
+ origin: {wire_key: 'origin', primitive: 'string'}
362
+ )
363
+
364
+ # @api private
365
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
366
+ class RemoteReference < Serialization::Union
367
+ presence(
368
+ 'Script::SharedReference' => ['sharedId'],
369
+ 'Script::RemoteObjectReference' => ['handle']
370
+ )
371
+ end
372
+
373
+ # @api private
374
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
375
+ SharedReference = Serialization::Record.define(
376
+ shared_id: 'sharedId',
377
+ handle: {wire_key: 'handle', required: false},
378
+ extensible: true
379
+ )
380
+
381
+ # @api private
382
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
383
+ RemoteObjectReference = Serialization::Record.define(
384
+ handle: 'handle',
385
+ shared_id: {wire_key: 'sharedId', required: false},
386
+ extensible: true
387
+ )
388
+
389
+ # @api private
390
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
391
+ class RemoteValue < Serialization::Union
392
+ discriminator 'type', {
393
+ undefined: 'undefined',
394
+ null: 'null',
395
+ string: 'string',
396
+ number: 'number',
397
+ boolean: 'boolean',
398
+ bigint: 'bigint',
399
+ symbol: 'symbol',
400
+ array: 'array',
401
+ object: 'object',
402
+ function: 'function',
403
+ regexp: 'regexp',
404
+ date: 'date',
405
+ map: 'map',
406
+ set: 'set',
407
+ weakmap: 'weakmap',
408
+ weakset: 'weakset',
409
+ generator: 'generator',
410
+ error: 'error',
411
+ proxy: 'proxy',
412
+ promise: 'promise',
413
+ typedarray: 'typedarray',
414
+ arraybuffer: 'arraybuffer',
415
+ nodelist: 'nodelist',
416
+ htmlcollection: 'htmlcollection',
417
+ node: 'node',
418
+ window: 'window'
419
+ }
420
+ variants(
421
+ undefined: 'Script::UndefinedValue',
422
+ null: 'Script::NullValue',
423
+ string: 'Script::StringValue',
424
+ number: 'Script::NumberValue',
425
+ boolean: 'Script::BooleanValue',
426
+ bigint: 'Script::BigIntValue',
427
+ symbol: 'Script::SymbolRemoteValue',
428
+ array: 'Script::ArrayRemoteValue',
429
+ object: 'Script::ObjectRemoteValue',
430
+ function: 'Script::FunctionRemoteValue',
431
+ regexp: 'Script::RegExpRemoteValue',
432
+ date: 'Script::DateRemoteValue',
433
+ map: 'Script::MapRemoteValue',
434
+ set: 'Script::SetRemoteValue',
435
+ weakmap: 'Script::WeakMapRemoteValue',
436
+ weakset: 'Script::WeakSetRemoteValue',
437
+ generator: 'Script::GeneratorRemoteValue',
438
+ error: 'Script::ErrorRemoteValue',
439
+ proxy: 'Script::ProxyRemoteValue',
440
+ promise: 'Script::PromiseRemoteValue',
441
+ typedarray: 'Script::TypedArrayRemoteValue',
442
+ arraybuffer: 'Script::ArrayBufferRemoteValue',
443
+ nodelist: 'Script::NodeListRemoteValue',
444
+ htmlcollection: 'Script::HTMLCollectionRemoteValue',
445
+ node: 'Script::NodeRemoteValue',
446
+ window: 'Script::WindowProxyRemoteValue'
447
+ )
448
+ end
449
+
450
+ # @api private
451
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
452
+ SymbolRemoteValue = Serialization::Record.define(
453
+ type: {fixed: 'symbol'},
454
+ handle: {wire_key: 'handle', required: false},
455
+ internal_id: {wire_key: 'internalId', required: false}
456
+ )
457
+
458
+ # @api private
459
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
460
+ ArrayRemoteValue = Serialization::Record.define(
461
+ type: {fixed: 'array'},
462
+ handle: {wire_key: 'handle', required: false},
463
+ internal_id: {wire_key: 'internalId', required: false},
464
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
465
+ )
466
+
467
+ # @api private
468
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
469
+ ObjectRemoteValue = Serialization::Record.define(
470
+ type: {fixed: 'object'},
471
+ handle: {wire_key: 'handle', required: false},
472
+ internal_id: {wire_key: 'internalId', required: false},
473
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
474
+ )
475
+
476
+ # @api private
477
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
478
+ FunctionRemoteValue = Serialization::Record.define(
479
+ type: {fixed: 'function'},
480
+ handle: {wire_key: 'handle', required: false},
481
+ internal_id: {wire_key: 'internalId', required: false}
482
+ )
483
+
484
+ # @api private
485
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
486
+ RegExpRemoteValue = Serialization::Record.define(
487
+ type: {fixed: 'regexp'},
488
+ value: {wire_key: 'value', ref: 'Script::RegExpValue'},
489
+ handle: {wire_key: 'handle', required: false},
490
+ internal_id: {wire_key: 'internalId', required: false}
491
+ )
492
+
493
+ # @api private
494
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
495
+ DateRemoteValue = Serialization::Record.define(
496
+ type: {fixed: 'date'},
497
+ value: {wire_key: 'value', primitive: 'string'},
498
+ handle: {wire_key: 'handle', required: false},
499
+ internal_id: {wire_key: 'internalId', required: false}
500
+ )
501
+
502
+ # @api private
503
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
504
+ MapRemoteValue = Serialization::Record.define(
505
+ type: {fixed: 'map'},
506
+ handle: {wire_key: 'handle', required: false},
507
+ internal_id: {wire_key: 'internalId', required: false},
508
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
509
+ )
510
+
511
+ # @api private
512
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
513
+ SetRemoteValue = Serialization::Record.define(
514
+ type: {fixed: 'set'},
515
+ handle: {wire_key: 'handle', required: false},
516
+ internal_id: {wire_key: 'internalId', required: false},
517
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
518
+ )
519
+
520
+ # @api private
521
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
522
+ WeakMapRemoteValue = Serialization::Record.define(
523
+ type: {fixed: 'weakmap'},
524
+ handle: {wire_key: 'handle', required: false},
525
+ internal_id: {wire_key: 'internalId', required: false}
526
+ )
527
+
528
+ # @api private
529
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
530
+ WeakSetRemoteValue = Serialization::Record.define(
531
+ type: {fixed: 'weakset'},
532
+ handle: {wire_key: 'handle', required: false},
533
+ internal_id: {wire_key: 'internalId', required: false}
534
+ )
535
+
536
+ # @api private
537
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
538
+ GeneratorRemoteValue = Serialization::Record.define(
539
+ type: {fixed: 'generator'},
540
+ handle: {wire_key: 'handle', required: false},
541
+ internal_id: {wire_key: 'internalId', required: false}
542
+ )
543
+
544
+ # @api private
545
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
546
+ ErrorRemoteValue = Serialization::Record.define(
547
+ type: {fixed: 'error'},
548
+ handle: {wire_key: 'handle', required: false},
549
+ internal_id: {wire_key: 'internalId', required: false}
550
+ )
551
+
552
+ # @api private
553
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
554
+ ProxyRemoteValue = Serialization::Record.define(
555
+ type: {fixed: 'proxy'},
556
+ handle: {wire_key: 'handle', required: false},
557
+ internal_id: {wire_key: 'internalId', required: false}
558
+ )
559
+
560
+ # @api private
561
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
562
+ PromiseRemoteValue = Serialization::Record.define(
563
+ type: {fixed: 'promise'},
564
+ handle: {wire_key: 'handle', required: false},
565
+ internal_id: {wire_key: 'internalId', required: false}
566
+ )
567
+
568
+ # @api private
569
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
570
+ TypedArrayRemoteValue = Serialization::Record.define(
571
+ type: {fixed: 'typedarray'},
572
+ handle: {wire_key: 'handle', required: false},
573
+ internal_id: {wire_key: 'internalId', required: false}
574
+ )
575
+
576
+ # @api private
577
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
578
+ ArrayBufferRemoteValue = Serialization::Record.define(
579
+ type: {fixed: 'arraybuffer'},
580
+ handle: {wire_key: 'handle', required: false},
581
+ internal_id: {wire_key: 'internalId', required: false}
582
+ )
583
+
584
+ # @api private
585
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
586
+ NodeListRemoteValue = Serialization::Record.define(
587
+ type: {fixed: 'nodelist'},
588
+ handle: {wire_key: 'handle', required: false},
589
+ internal_id: {wire_key: 'internalId', required: false},
590
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
591
+ )
592
+
593
+ # @api private
594
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
595
+ HTMLCollectionRemoteValue = Serialization::Record.define(
596
+ type: {fixed: 'htmlcollection'},
597
+ handle: {wire_key: 'handle', required: false},
598
+ internal_id: {wire_key: 'internalId', required: false},
599
+ value: {wire_key: 'value', required: false, ref: 'Script::RemoteValue', list: true}
600
+ )
601
+
602
+ # @api private
603
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
604
+ NodeRemoteValue = Serialization::Record.define(
605
+ type: {fixed: 'node'},
606
+ shared_id: {wire_key: 'sharedId', required: false},
607
+ handle: {wire_key: 'handle', required: false},
608
+ internal_id: {wire_key: 'internalId', required: false},
609
+ value: {wire_key: 'value', required: false, ref: 'Script::NodeProperties'}
610
+ )
611
+
612
+ # @api private
613
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
614
+ NodeProperties = Serialization::Record.define(
615
+ node_type: 'nodeType',
616
+ child_node_count: 'childNodeCount',
617
+ attributes: {wire_key: 'attributes', required: false},
618
+ children: {wire_key: 'children', required: false, ref: 'Script::NodeRemoteValue', list: true},
619
+ local_name: {wire_key: 'localName', required: false, primitive: 'string'},
620
+ mode: {wire_key: 'mode', required: false, enum: 'Script::NODE_PROPERTIES_MODE'},
621
+ namespace_uri: {wire_key: 'namespaceURI', required: false, primitive: 'string'},
622
+ node_value: {wire_key: 'nodeValue', required: false, primitive: 'string'},
623
+ shadow_root: {wire_key: 'shadowRoot', required: false, nullable: true, ref: 'Script::NodeRemoteValue'}
624
+ )
625
+
626
+ # @api private
627
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
628
+ WindowProxyRemoteValue = Serialization::Record.define(
629
+ type: {fixed: 'window'},
630
+ value: {wire_key: 'value', ref: 'Script::WindowProxyProperties'},
631
+ handle: {wire_key: 'handle', required: false},
632
+ internal_id: {wire_key: 'internalId', required: false}
633
+ )
634
+
635
+ # @api private
636
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
637
+ WindowProxyProperties = Serialization::Record.define(context: 'context')
638
+
639
+ # @api private
640
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
641
+ SerializationOptions = Serialization::Record.define(
642
+ max_dom_depth: {wire_key: 'maxDomDepth', required: false, nullable: true},
643
+ max_object_depth: {wire_key: 'maxObjectDepth', required: false, nullable: true},
644
+ include_shadow_tree: {
645
+ wire_key: 'includeShadowTree',
646
+ required: false,
647
+ enum: 'Script::SERIALIZATION_OPTIONS_INCLUDE_SHADOW_TREE'
648
+ }
649
+ )
650
+
651
+ # @api private
652
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
653
+ StackFrame = Serialization::Record.define(
654
+ column_number: 'columnNumber',
655
+ function_name: {wire_key: 'functionName', primitive: 'string'},
656
+ line_number: 'lineNumber',
657
+ url: {wire_key: 'url', primitive: 'string'}
658
+ )
659
+
660
+ # @api private
661
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
662
+ StackTrace = Serialization::Record.define(
663
+ call_frames: {wire_key: 'callFrames', ref: 'Script::StackFrame', list: true}
664
+ )
665
+
666
+ # @api private
667
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
668
+ Source = Serialization::Record.define(
669
+ realm: 'realm',
670
+ context: {wire_key: 'context', required: false},
671
+ user_context: {wire_key: 'userContext', required: false}
672
+ )
673
+
674
+ # @api private
675
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
676
+ RealmTarget = Serialization::Record.define(realm: 'realm')
677
+
678
+ # @api private
679
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
680
+ ContextTarget = Serialization::Record.define(
681
+ context: 'context',
682
+ sandbox: {wire_key: 'sandbox', required: false, primitive: 'string'}
683
+ )
684
+
685
+ # @api private
686
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
687
+ class Target < Serialization::Union
688
+ presence(
689
+ 'Script::ContextTarget' => ['context'],
690
+ 'Script::RealmTarget' => ['realm']
691
+ )
692
+ end
693
+
694
+ # @api private
695
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
696
+ AddPreloadScriptParameters = Serialization::Record.define(
697
+ function_declaration: {wire_key: 'functionDeclaration', primitive: 'string'},
698
+ arguments: {wire_key: 'arguments', required: false, ref: 'Script::ChannelValue', list: true},
699
+ contexts: {wire_key: 'contexts', required: false, list: true},
700
+ user_contexts: {wire_key: 'userContexts', required: false, list: true},
701
+ sandbox: {wire_key: 'sandbox', required: false, primitive: 'string'}
702
+ )
703
+
704
+ # @api private
705
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
706
+ AddPreloadScriptResult = Serialization::Record.define(script: 'script')
707
+
708
+ # @api private
709
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
710
+ DisownParameters = Serialization::Record.define(
711
+ handles: {wire_key: 'handles', list: true},
712
+ target: {wire_key: 'target', ref: 'Script::Target'}
713
+ )
714
+
715
+ # @api private
716
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
717
+ CallFunctionParameters = Serialization::Record.define(
718
+ function_declaration: {wire_key: 'functionDeclaration', primitive: 'string'},
719
+ await_promise: {wire_key: 'awaitPromise', primitive: 'boolean'},
720
+ target: {wire_key: 'target', ref: 'Script::Target'},
721
+ arguments: {wire_key: 'arguments', required: false, ref: 'Script::LocalValue', list: true},
722
+ result_ownership: {wire_key: 'resultOwnership', required: false, enum: 'Script::RESULT_OWNERSHIP'},
723
+ serialization_options: {
724
+ wire_key: 'serializationOptions',
725
+ required: false,
726
+ ref: 'Script::SerializationOptions'
727
+ },
728
+ this: {wire_key: 'this', required: false, ref: 'Script::LocalValue'},
729
+ user_activation: {wire_key: 'userActivation', required: false, primitive: 'boolean'}
730
+ )
731
+
732
+ # @api private
733
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
734
+ EvaluateParameters = Serialization::Record.define(
735
+ expression: {wire_key: 'expression', primitive: 'string'},
736
+ target: {wire_key: 'target', ref: 'Script::Target'},
737
+ await_promise: {wire_key: 'awaitPromise', primitive: 'boolean'},
738
+ result_ownership: {wire_key: 'resultOwnership', required: false, enum: 'Script::RESULT_OWNERSHIP'},
739
+ serialization_options: {
740
+ wire_key: 'serializationOptions',
741
+ required: false,
742
+ ref: 'Script::SerializationOptions'
743
+ },
744
+ user_activation: {wire_key: 'userActivation', required: false, primitive: 'boolean'}
745
+ )
746
+
747
+ # @api private
748
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
749
+ GetRealmsParameters = Serialization::Record.define(
750
+ context: {wire_key: 'context', required: false},
751
+ type: {wire_key: 'type', required: false, enum: 'Script::REALM_TYPE'}
752
+ )
753
+
754
+ # @api private
755
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
756
+ GetRealmsResult = Serialization::Record.define(
757
+ realms: {wire_key: 'realms', ref: 'Script::RealmInfo', list: true}
758
+ )
759
+
760
+ # @api private
761
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
762
+ RemovePreloadScriptParameters = Serialization::Record.define(script: 'script')
763
+
764
+ # @api private
765
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
766
+ MessageParameters = Serialization::Record.define(
767
+ channel: 'channel',
768
+ data: {wire_key: 'data', ref: 'Script::RemoteValue'},
769
+ source: {wire_key: 'source', ref: 'Script::Source'}
770
+ )
771
+
772
+ # @api private
773
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
774
+ RealmDestroyedParameters = Serialization::Record.define(realm: 'realm')
775
+
776
+ EVENT_TYPES = {
777
+ 'script.message' => Script::MessageParameters,
778
+ 'script.realmCreated' => Script::RealmInfo,
779
+ 'script.realmDestroyed' => Script::RealmDestroyedParameters
780
+ }.freeze
781
+
782
+ # @api private
783
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
784
+ def add_preload_script(
785
+ function_declaration:,
786
+ arguments: Serialization::UNSET,
787
+ contexts: Serialization::UNSET,
788
+ user_contexts: Serialization::UNSET,
789
+ sandbox: Serialization::UNSET
790
+ )
791
+ params = AddPreloadScriptParameters.new(
792
+ function_declaration: function_declaration,
793
+ arguments: arguments,
794
+ contexts: contexts,
795
+ user_contexts: user_contexts,
796
+ sandbox: sandbox
797
+ )
798
+ execute(cmd: 'script.addPreloadScript', params: params, result: Script::AddPreloadScriptResult)
799
+ end
800
+
801
+ # @api private
802
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
803
+ def call_function(
804
+ function_declaration:,
805
+ await_promise:,
806
+ target:,
807
+ arguments: Serialization::UNSET,
808
+ result_ownership: Serialization::UNSET,
809
+ serialization_options: Serialization::UNSET,
810
+ this: Serialization::UNSET,
811
+ user_activation: Serialization::UNSET
812
+ )
813
+ Serialization.validate!('resultOwnership', result_ownership, Script::RESULT_OWNERSHIP)
814
+ params = CallFunctionParameters.new(
815
+ function_declaration: function_declaration,
816
+ await_promise: await_promise,
817
+ target: target,
818
+ arguments: arguments,
819
+ result_ownership: result_ownership,
820
+ serialization_options: serialization_options,
821
+ this: this,
822
+ user_activation: user_activation
823
+ )
824
+ execute(cmd: 'script.callFunction', params: params, result: Script::EvaluateResult)
825
+ end
826
+
827
+ # @api private
828
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
829
+ def disown(handles:, target:)
830
+ params = DisownParameters.new(handles: handles, target: target)
831
+ execute(cmd: 'script.disown', params: params)
832
+ end
833
+
834
+ # @api private
835
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
836
+ def evaluate(
837
+ expression:,
838
+ target:,
839
+ await_promise:,
840
+ result_ownership: Serialization::UNSET,
841
+ serialization_options: Serialization::UNSET,
842
+ user_activation: Serialization::UNSET
843
+ )
844
+ Serialization.validate!('resultOwnership', result_ownership, Script::RESULT_OWNERSHIP)
845
+ params = EvaluateParameters.new(
846
+ expression: expression,
847
+ target: target,
848
+ await_promise: await_promise,
849
+ result_ownership: result_ownership,
850
+ serialization_options: serialization_options,
851
+ user_activation: user_activation
852
+ )
853
+ execute(cmd: 'script.evaluate', params: params, result: Script::EvaluateResult)
854
+ end
855
+
856
+ # @api private
857
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
858
+ def get_realms(context: Serialization::UNSET, type: Serialization::UNSET)
859
+ Serialization.validate!('type', type, Script::REALM_TYPE)
860
+ params = GetRealmsParameters.new(context: context, type: type)
861
+ execute(cmd: 'script.getRealms', params: params, result: Script::GetRealmsResult)
862
+ end
863
+
864
+ # @api private
865
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
866
+ def remove_preload_script(script:)
867
+ params = RemovePreloadScriptParameters.new(script: script)
868
+ execute(cmd: 'script.removePreloadScript', params: params)
869
+ end
870
+ end # Script
871
+ end # Protocol
872
+ end # BiDi
873
+ end # WebDriver
874
+ end # Selenium