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,495 @@
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
+ class Bluetooth < Domain
30
+ EVENTS = {
31
+ request_device_prompt_updated: 'bluetooth.requestDevicePromptUpdated',
32
+ gatt_connection_attempted: 'bluetooth.gattConnectionAttempted'
33
+ }.freeze
34
+
35
+ SIMULATE_ADAPTER_PARAMETERS_STATE = {
36
+ absent: 'absent',
37
+ powered_off: 'powered-off',
38
+ powered_on: 'powered-on'
39
+ }.freeze
40
+
41
+ SIMULATE_SERVICE_PARAMETERS_TYPE = {
42
+ add: 'add',
43
+ remove: 'remove'
44
+ }.freeze
45
+
46
+ SIMULATE_CHARACTERISTIC_PARAMETERS_TYPE = {
47
+ add: 'add',
48
+ remove: 'remove'
49
+ }.freeze
50
+
51
+ SIMULATE_CHARACTERISTIC_RESPONSE_PARAMETERS_TYPE = {
52
+ read: 'read',
53
+ write: 'write',
54
+ subscribe_to_notifications: 'subscribe-to-notifications',
55
+ unsubscribe_from_notifications: 'unsubscribe-from-notifications'
56
+ }.freeze
57
+
58
+ SIMULATE_DESCRIPTOR_PARAMETERS_TYPE = {
59
+ add: 'add',
60
+ remove: 'remove'
61
+ }.freeze
62
+
63
+ SIMULATE_DESCRIPTOR_RESPONSE_PARAMETERS_TYPE = {
64
+ read: 'read',
65
+ write: 'write'
66
+ }.freeze
67
+
68
+ CHARACTERISTIC_EVENT_GENERATED_PARAMETERS_TYPE = {
69
+ read: 'read',
70
+ write_with_response: 'write-with-response',
71
+ write_without_response: 'write-without-response',
72
+ subscribe_to_notifications: 'subscribe-to-notifications',
73
+ unsubscribe_from_notifications: 'unsubscribe-from-notifications'
74
+ }.freeze
75
+
76
+ DESCRIPTOR_EVENT_GENERATED_PARAMETERS_TYPE = {
77
+ read: 'read',
78
+ write: 'write'
79
+ }.freeze
80
+
81
+ # @api private
82
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
83
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothbluetoothmanufacturerdata
84
+ BluetoothManufacturerData = Serialization::Record.define(
85
+ key: {wire_key: 'key', primitive: 'integer'},
86
+ data: {wire_key: 'data', primitive: 'string'}
87
+ )
88
+
89
+ # @api private
90
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
91
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothcharacteristicproperties
92
+ CharacteristicProperties = Serialization::Record.define(
93
+ broadcast: {wire_key: 'broadcast', required: false, primitive: 'boolean'},
94
+ read: {wire_key: 'read', required: false, primitive: 'boolean'},
95
+ write_without_response: {wire_key: 'writeWithoutResponse', required: false, primitive: 'boolean'},
96
+ write: {wire_key: 'write', required: false, primitive: 'boolean'},
97
+ notify: {wire_key: 'notify', required: false, primitive: 'boolean'},
98
+ indicate: {wire_key: 'indicate', required: false, primitive: 'boolean'},
99
+ authenticated_signed_writes: {wire_key: 'authenticatedSignedWrites', required: false, primitive: 'boolean'},
100
+ extended_properties: {wire_key: 'extendedProperties', required: false, primitive: 'boolean'}
101
+ )
102
+
103
+ # @api private
104
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
105
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothrequestdeviceinfo
106
+ RequestDeviceInfo = Serialization::Record.define(
107
+ id: {wire_key: 'id', primitive: 'string'},
108
+ name: {wire_key: 'name', nullable: true, primitive: 'string'}
109
+ )
110
+
111
+ # @api private
112
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
113
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothscanrecord
114
+ ScanRecord = Serialization::Record.define(
115
+ name: {wire_key: 'name', required: false, primitive: 'string'},
116
+ uuids: {wire_key: 'uuids', required: false, list: true},
117
+ appearance: {wire_key: 'appearance', required: false, primitive: 'number'},
118
+ manufacturer_data: {
119
+ wire_key: 'manufacturerData',
120
+ required: false,
121
+ ref: 'Bluetooth::BluetoothManufacturerData',
122
+ list: true
123
+ }
124
+ )
125
+
126
+ # @api private
127
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
128
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothhandlerequestdevicepromptparameters
129
+ class HandleRequestDevicePromptParameters < Serialization::Union
130
+ discriminator 'accept'
131
+ variants(
132
+ true => 'Bluetooth::HandleRequestDevicePromptParameters::AcceptParameters',
133
+ false => 'Bluetooth::HandleRequestDevicePromptParameters::CancelParameters'
134
+ )
135
+ object_only
136
+
137
+ # @api private
138
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
139
+ AcceptParameters = Serialization::Record.define(
140
+ accept: {fixed: true},
141
+ context: {wire_key: 'context', primitive: 'string'},
142
+ prompt: {wire_key: 'prompt', primitive: 'string'},
143
+ device: {wire_key: 'device', primitive: 'string'}
144
+ )
145
+
146
+ # @api private
147
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
148
+ CancelParameters = Serialization::Record.define(
149
+ accept: {fixed: false},
150
+ context: {wire_key: 'context', primitive: 'string'},
151
+ prompt: {wire_key: 'prompt', primitive: 'string'}
152
+ )
153
+
154
+ def self.true(**) = Bluetooth::HandleRequestDevicePromptParameters::AcceptParameters.new(**)
155
+ def self.false(**) = Bluetooth::HandleRequestDevicePromptParameters::CancelParameters.new(**)
156
+ end
157
+
158
+ # @api private
159
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
160
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulateadapterparameters
161
+ SimulateAdapterParameters = Serialization::Record.define(
162
+ context: {wire_key: 'context', primitive: 'string'},
163
+ le_supported: {wire_key: 'leSupported', required: false, primitive: 'boolean'},
164
+ state: {wire_key: 'state', enum: 'Bluetooth::SIMULATE_ADAPTER_PARAMETERS_STATE'}
165
+ )
166
+
167
+ # @api private
168
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
169
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothdisablesimulationparameters
170
+ DisableSimulationParameters = Serialization::Record.define(
171
+ context: {wire_key: 'context', primitive: 'string'}
172
+ )
173
+
174
+ # @api private
175
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
176
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulatepreconnectedperipheralparameters
177
+ SimulatePreconnectedPeripheralParameters = Serialization::Record.define(
178
+ context: {wire_key: 'context', primitive: 'string'},
179
+ address: {wire_key: 'address', primitive: 'string'},
180
+ name: {wire_key: 'name', primitive: 'string'},
181
+ manufacturer_data: {wire_key: 'manufacturerData', ref: 'Bluetooth::BluetoothManufacturerData', list: true},
182
+ known_service_uuids: {wire_key: 'knownServiceUuids', list: true}
183
+ )
184
+
185
+ # @api private
186
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
187
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulateadvertisementparameters
188
+ SimulateAdvertisementParameters = Serialization::Record.define(
189
+ context: {wire_key: 'context', primitive: 'string'},
190
+ scan_entry: {wire_key: 'scanEntry', ref: 'Bluetooth::SimulateAdvertisementScanEntryParameters'}
191
+ )
192
+
193
+ # @api private
194
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
195
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulateadvertisementscanentryparameters
196
+ SimulateAdvertisementScanEntryParameters = Serialization::Record.define(
197
+ device_address: {wire_key: 'deviceAddress', primitive: 'string'},
198
+ rssi: {wire_key: 'rssi', primitive: 'number'},
199
+ scan_record: {wire_key: 'scanRecord', ref: 'Bluetooth::ScanRecord'}
200
+ )
201
+
202
+ # @api private
203
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
204
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulategattconnectionresponseparameters
205
+ SimulateGattConnectionResponseParameters = Serialization::Record.define(
206
+ context: {wire_key: 'context', primitive: 'string'},
207
+ address: {wire_key: 'address', primitive: 'string'},
208
+ code: {wire_key: 'code', primitive: 'integer'}
209
+ )
210
+
211
+ # @api private
212
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
213
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulategattdisconnectionparameters
214
+ SimulateGattDisconnectionParameters = Serialization::Record.define(
215
+ context: {wire_key: 'context', primitive: 'string'},
216
+ address: {wire_key: 'address', primitive: 'string'}
217
+ )
218
+
219
+ # @api private
220
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
221
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulateserviceparameters
222
+ SimulateServiceParameters = Serialization::Record.define(
223
+ context: {wire_key: 'context', primitive: 'string'},
224
+ address: {wire_key: 'address', primitive: 'string'},
225
+ uuid: {wire_key: 'uuid', primitive: 'string'},
226
+ type: {wire_key: 'type', enum: 'Bluetooth::SIMULATE_SERVICE_PARAMETERS_TYPE'}
227
+ )
228
+
229
+ # @api private
230
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
231
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulatecharacteristicparameters
232
+ SimulateCharacteristicParameters = Serialization::Record.define(
233
+ context: {wire_key: 'context', primitive: 'string'},
234
+ address: {wire_key: 'address', primitive: 'string'},
235
+ service_uuid: {wire_key: 'serviceUuid', primitive: 'string'},
236
+ characteristic_uuid: {wire_key: 'characteristicUuid', primitive: 'string'},
237
+ characteristic_properties: {
238
+ wire_key: 'characteristicProperties',
239
+ required: false,
240
+ ref: 'Bluetooth::CharacteristicProperties'
241
+ },
242
+ type: {wire_key: 'type', enum: 'Bluetooth::SIMULATE_CHARACTERISTIC_PARAMETERS_TYPE'}
243
+ )
244
+
245
+ # @api private
246
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
247
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulatecharacteristicresponseparameters
248
+ SimulateCharacteristicResponseParameters = Serialization::Record.define(
249
+ context: {wire_key: 'context', primitive: 'string'},
250
+ address: {wire_key: 'address', primitive: 'string'},
251
+ service_uuid: {wire_key: 'serviceUuid', primitive: 'string'},
252
+ characteristic_uuid: {wire_key: 'characteristicUuid', primitive: 'string'},
253
+ type: {wire_key: 'type', enum: 'Bluetooth::SIMULATE_CHARACTERISTIC_RESPONSE_PARAMETERS_TYPE'},
254
+ code: {wire_key: 'code', primitive: 'integer'},
255
+ data: {wire_key: 'data', required: false, list: true}
256
+ )
257
+
258
+ # @api private
259
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
260
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulatedescriptorparameters
261
+ SimulateDescriptorParameters = Serialization::Record.define(
262
+ context: {wire_key: 'context', primitive: 'string'},
263
+ address: {wire_key: 'address', primitive: 'string'},
264
+ service_uuid: {wire_key: 'serviceUuid', primitive: 'string'},
265
+ characteristic_uuid: {wire_key: 'characteristicUuid', primitive: 'string'},
266
+ descriptor_uuid: {wire_key: 'descriptorUuid', primitive: 'string'},
267
+ type: {wire_key: 'type', enum: 'Bluetooth::SIMULATE_DESCRIPTOR_PARAMETERS_TYPE'}
268
+ )
269
+
270
+ # @api private
271
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
272
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothsimulatedescriptorresponseparameters
273
+ SimulateDescriptorResponseParameters = Serialization::Record.define(
274
+ context: {wire_key: 'context', primitive: 'string'},
275
+ address: {wire_key: 'address', primitive: 'string'},
276
+ service_uuid: {wire_key: 'serviceUuid', primitive: 'string'},
277
+ characteristic_uuid: {wire_key: 'characteristicUuid', primitive: 'string'},
278
+ descriptor_uuid: {wire_key: 'descriptorUuid', primitive: 'string'},
279
+ type: {wire_key: 'type', enum: 'Bluetooth::SIMULATE_DESCRIPTOR_RESPONSE_PARAMETERS_TYPE'},
280
+ code: {wire_key: 'code', primitive: 'integer'},
281
+ data: {wire_key: 'data', required: false, list: true}
282
+ )
283
+
284
+ # @api private
285
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
286
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothrequestdevicepromptupdatedparameters
287
+ RequestDevicePromptUpdatedParameters = Serialization::Record.define(
288
+ context: {wire_key: 'context', primitive: 'string'},
289
+ prompt: {wire_key: 'prompt', primitive: 'string'},
290
+ devices: {wire_key: 'devices', ref: 'Bluetooth::RequestDeviceInfo', list: true}
291
+ )
292
+
293
+ # @api private
294
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
295
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothgattconnectionattemptedparameters
296
+ GattConnectionAttemptedParameters = Serialization::Record.define(
297
+ context: {wire_key: 'context', primitive: 'string'},
298
+ address: {wire_key: 'address', primitive: 'string'}
299
+ )
300
+
301
+ # @api private
302
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
303
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothcharacteristiceventgeneratedparameters
304
+ CharacteristicEventGeneratedParameters = Serialization::Record.define(
305
+ context: {wire_key: 'context', primitive: 'string'},
306
+ address: {wire_key: 'address', primitive: 'string'},
307
+ service_uuid: {wire_key: 'serviceUuid', primitive: 'string'},
308
+ characteristic_uuid: {wire_key: 'characteristicUuid', primitive: 'string'},
309
+ type: {wire_key: 'type', enum: 'Bluetooth::CHARACTERISTIC_EVENT_GENERATED_PARAMETERS_TYPE'},
310
+ data: {wire_key: 'data', required: false, list: true}
311
+ )
312
+
313
+ # @api private
314
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
315
+ # @see https://webbluetoothcg.github.io/web-bluetooth/#cddl-type-bluetoothdescriptoreventgeneratedparameters
316
+ DescriptorEventGeneratedParameters = Serialization::Record.define(
317
+ context: {wire_key: 'context', primitive: 'string'},
318
+ address: {wire_key: 'address', primitive: 'string'},
319
+ service_uuid: {wire_key: 'serviceUuid', primitive: 'string'},
320
+ characteristic_uuid: {wire_key: 'characteristicUuid', primitive: 'string'},
321
+ descriptor_uuid: {wire_key: 'descriptorUuid', primitive: 'string'},
322
+ type: {wire_key: 'type', enum: 'Bluetooth::DESCRIPTOR_EVENT_GENERATED_PARAMETERS_TYPE'},
323
+ data: {wire_key: 'data', required: false, list: true}
324
+ )
325
+
326
+ EVENT_TYPES = {
327
+ 'bluetooth.requestDevicePromptUpdated' => Bluetooth::RequestDevicePromptUpdatedParameters,
328
+ 'bluetooth.gattConnectionAttempted' => Bluetooth::GattConnectionAttemptedParameters
329
+ }.freeze
330
+
331
+ def bluetooth_manufacturer_data(**) = BluetoothManufacturerData.new(**)
332
+ def characteristic_properties(**) = CharacteristicProperties.new(**)
333
+ def scan_record(**) = ScanRecord.new(**)
334
+ def simulate_advertisement_scan_entry_parameters(**) = SimulateAdvertisementScanEntryParameters.new(**)
335
+
336
+ # @api private
337
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
338
+ def handle_request_device_prompt(context:, prompt:, accept:, device: Serialization::UNSET)
339
+ params = HandleRequestDevicePromptParameters.build(
340
+ context: context,
341
+ prompt: prompt,
342
+ accept: accept,
343
+ device: device
344
+ )
345
+ execute(cmd: 'bluetooth.handleRequestDevicePrompt', params: params)
346
+ end
347
+
348
+ # @api private
349
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
350
+ def simulate_adapter(context:, state:, le_supported: Serialization::UNSET)
351
+ Serialization.validate!('state', state, Bluetooth::SIMULATE_ADAPTER_PARAMETERS_STATE)
352
+ params = SimulateAdapterParameters.new(context: context, le_supported: le_supported, state: state)
353
+ execute(cmd: 'bluetooth.simulateAdapter', params: params)
354
+ end
355
+
356
+ # @api private
357
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
358
+ def disable_simulation(context:)
359
+ params = DisableSimulationParameters.new(context: context)
360
+ execute(cmd: 'bluetooth.disableSimulation', params: params)
361
+ end
362
+
363
+ # @api private
364
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
365
+ def simulate_preconnected_peripheral(context:, address:, name:, manufacturer_data:, known_service_uuids:)
366
+ params = SimulatePreconnectedPeripheralParameters.new(
367
+ context: context,
368
+ address: address,
369
+ name: name,
370
+ manufacturer_data: manufacturer_data,
371
+ known_service_uuids: known_service_uuids
372
+ )
373
+ execute(cmd: 'bluetooth.simulatePreconnectedPeripheral', params: params)
374
+ end
375
+
376
+ # @api private
377
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
378
+ def simulate_advertisement(context:, scan_entry:)
379
+ params = SimulateAdvertisementParameters.new(context: context, scan_entry: scan_entry)
380
+ execute(cmd: 'bluetooth.simulateAdvertisement', params: params)
381
+ end
382
+
383
+ # @api private
384
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
385
+ def simulate_gatt_connection_response(context:, address:, code:)
386
+ params = SimulateGattConnectionResponseParameters.new(context: context, address: address, code: code)
387
+ execute(cmd: 'bluetooth.simulateGattConnectionResponse', params: params)
388
+ end
389
+
390
+ # @api private
391
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
392
+ def simulate_gatt_disconnection(context:, address:)
393
+ params = SimulateGattDisconnectionParameters.new(context: context, address: address)
394
+ execute(cmd: 'bluetooth.simulateGattDisconnection', params: params)
395
+ end
396
+
397
+ # @api private
398
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
399
+ def simulate_service(context:, address:, uuid:, type:)
400
+ Serialization.validate!('type', type, Bluetooth::SIMULATE_SERVICE_PARAMETERS_TYPE)
401
+ params = SimulateServiceParameters.new(context: context, address: address, uuid: uuid, type: type)
402
+ execute(cmd: 'bluetooth.simulateService', params: params)
403
+ end
404
+
405
+ # @api private
406
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
407
+ def simulate_characteristic(
408
+ context:,
409
+ address:,
410
+ service_uuid:,
411
+ characteristic_uuid:,
412
+ type:,
413
+ characteristic_properties: Serialization::UNSET
414
+ )
415
+ Serialization.validate!('type', type, Bluetooth::SIMULATE_CHARACTERISTIC_PARAMETERS_TYPE)
416
+ params = SimulateCharacteristicParameters.new(
417
+ context: context,
418
+ address: address,
419
+ service_uuid: service_uuid,
420
+ characteristic_uuid: characteristic_uuid,
421
+ characteristic_properties: characteristic_properties,
422
+ type: type
423
+ )
424
+ execute(cmd: 'bluetooth.simulateCharacteristic', params: params)
425
+ end
426
+
427
+ # @api private
428
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
429
+ def simulate_characteristic_response(
430
+ context:,
431
+ address:,
432
+ service_uuid:,
433
+ characteristic_uuid:,
434
+ type:,
435
+ code:,
436
+ data: Serialization::UNSET
437
+ )
438
+ Serialization.validate!('type', type, Bluetooth::SIMULATE_CHARACTERISTIC_RESPONSE_PARAMETERS_TYPE)
439
+ params = SimulateCharacteristicResponseParameters.new(
440
+ context: context,
441
+ address: address,
442
+ service_uuid: service_uuid,
443
+ characteristic_uuid: characteristic_uuid,
444
+ type: type,
445
+ code: code,
446
+ data: data
447
+ )
448
+ execute(cmd: 'bluetooth.simulateCharacteristicResponse', params: params)
449
+ end
450
+
451
+ # @api private
452
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
453
+ def simulate_descriptor(context:, address:, service_uuid:, characteristic_uuid:, descriptor_uuid:, type:)
454
+ Serialization.validate!('type', type, Bluetooth::SIMULATE_DESCRIPTOR_PARAMETERS_TYPE)
455
+ params = SimulateDescriptorParameters.new(
456
+ context: context,
457
+ address: address,
458
+ service_uuid: service_uuid,
459
+ characteristic_uuid: characteristic_uuid,
460
+ descriptor_uuid: descriptor_uuid,
461
+ type: type
462
+ )
463
+ execute(cmd: 'bluetooth.simulateDescriptor', params: params)
464
+ end
465
+
466
+ # @api private
467
+ # @see https://www.selenium.dev/documentation/warnings/bidi-implementation/
468
+ def simulate_descriptor_response(
469
+ context:,
470
+ address:,
471
+ service_uuid:,
472
+ characteristic_uuid:,
473
+ descriptor_uuid:,
474
+ type:,
475
+ code:,
476
+ data: Serialization::UNSET
477
+ )
478
+ Serialization.validate!('type', type, Bluetooth::SIMULATE_DESCRIPTOR_RESPONSE_PARAMETERS_TYPE)
479
+ params = SimulateDescriptorResponseParameters.new(
480
+ context: context,
481
+ address: address,
482
+ service_uuid: service_uuid,
483
+ characteristic_uuid: characteristic_uuid,
484
+ descriptor_uuid: descriptor_uuid,
485
+ type: type,
486
+ code: code,
487
+ data: data
488
+ )
489
+ execute(cmd: 'bluetooth.simulateDescriptorResponse', params: params)
490
+ end
491
+ end # Bluetooth
492
+ end # Protocol
493
+ end # BiDi
494
+ end # WebDriver
495
+ end # Selenium