selenium-webdriver 4.43.0 → 4.45.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 (48) hide show
  1. package/CHANGES.md +21 -0
  2. package/README.md +57 -185
  3. package/bidi/browsingContextInspector.js +1 -1
  4. package/bidi/generated/bluetooth.d.ts +223 -0
  5. package/bidi/generated/bluetooth.js +154 -0
  6. package/bidi/generated/browser.d.ts +104 -0
  7. package/bidi/generated/browser.js +107 -0
  8. package/bidi/generated/browsing_context.d.ts +394 -0
  9. package/bidi/generated/browsing_context.js +260 -0
  10. package/bidi/generated/common.d.ts +38 -0
  11. package/bidi/generated/common.js +30 -0
  12. package/bidi/generated/emulation.d.ts +176 -0
  13. package/bidi/generated/emulation.js +133 -0
  14. package/bidi/generated/input.d.ts +151 -0
  15. package/bidi/generated/input.js +81 -0
  16. package/bidi/generated/log.d.ts +39 -0
  17. package/bidi/generated/log.js +67 -0
  18. package/bidi/generated/network.d.ts +359 -0
  19. package/bidi/generated/network.js +230 -0
  20. package/bidi/generated/permissions.d.ts +22 -0
  21. package/bidi/generated/permissions.js +43 -0
  22. package/bidi/generated/script.d.ts +410 -0
  23. package/bidi/generated/script.js +146 -0
  24. package/bidi/generated/session.d.ts +119 -0
  25. package/bidi/generated/session.js +82 -0
  26. package/bidi/generated/speculation.d.ts +17 -0
  27. package/bidi/generated/speculation.js +40 -0
  28. package/bidi/generated/storage.d.ts +84 -0
  29. package/bidi/generated/storage.js +70 -0
  30. package/bidi/generated/user_agent_client_hints.d.ts +33 -0
  31. package/bidi/generated/user_agent_client_hints.js +43 -0
  32. package/bidi/generated/webextension.d.ts +42 -0
  33. package/bidi/generated/webextension.js +53 -0
  34. package/bidi/index.js +133 -21
  35. package/bin/linux/selenium-manager +0 -0
  36. package/bin/macos/selenium-manager +0 -0
  37. package/bin/windows/selenium-manager.exe +0 -0
  38. package/common/driverFinder.js +2 -1
  39. package/common/seleniumManager.js +1 -1
  40. package/eslint.config.js +5 -5
  41. package/io/zip.js +1 -1
  42. package/lib/atoms/find-elements.js +272 -68
  43. package/lib/atoms/get-attribute.js +152 -17
  44. package/lib/atoms/is-displayed.js +385 -39
  45. package/lib/http.js +2 -1
  46. package/lib/pinnedScript.js +0 -1
  47. package/lib/webdriver.js +2 -2
  48. package/package.json +18 -16
package/CHANGES.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## 4.45.0
2
+
3
+ - Support CDP versions: v147, v148, v149
4
+ - update vulnerable dependency with a range (#17466)
5
+ - update dev dependencies (#17479)
6
+ - update eslint to v10 with fixes (#17482)
7
+ - Use the typescript atom for get attribute (#17526)
8
+ - Move JS bindings to use typescript atoms for isDisplayed and Find-Element (#17547)
9
+ - trim agent formatting guidance (#17617)
10
+ - [build] Automated Browser Version Update (#17609)
11
+ - Add Javascript/Typescript CDDL code generator for WebDriver BiDi (#17574)
12
+ - Expose BiDi CDDL ast and model as shared artifacts (#17657)
13
+
14
+ ## 4.44.0
15
+
16
+ - Support CDP versions: v146, v147, v148
17
+ - [Agents] Update agents to make sure do linting. (#17366)
18
+ - Standardize README files across bindings (#17245)
19
+ - Fix MaxListenersExceededWarning in BiDi send (#17423)
20
+ - [JavaScript] Move 'isDisplayed' atom to be typescript (#17316)
21
+
1
22
  ## 4.43.0
2
23
 
3
24
  - Support CDP versions: v145, v146, v147
package/README.md CHANGED
@@ -1,230 +1,102 @@
1
1
  # selenium-webdriver
2
2
 
3
- Selenium is a browser automation library. Most often used for testing
4
- web-applications, Selenium may be used for any task that requires automating
5
- interaction with the browser.
3
+ JavaScript language bindings for [Selenium WebDriver](https://www.selenium.dev).
4
+ Selenium automates browsers for testing and web-based task automation.
6
5
 
7
- ## Installation
8
-
9
- Selenium may be installed via npm with
10
-
11
- npm install selenium-webdriver
6
+ Requires Node.js >= 20.
12
7
 
13
- You will need to download additional components to work with each of the major
14
- browsers. The drivers for Chrome, Firefox, and Microsoft's IE and Edge web
15
- browsers are all standalone executables that should be placed on your system
16
- [PATH]. Apple's safaridriver (v10 and above) can be found at the
17
- following path – /usr/bin/safaridriver. To enable automation on safari,
18
- you need to run command `safaridriver --enable`.
19
-
20
- | Browser | Component |
21
- | :---------------- | :------------------------------- |
22
- | Chrome | [chromedriver(.exe)][chrome] |
23
- | Internet Explorer | [IEDriverServer.exe][release] |
24
- | Edge | [MicrosoftWebDriver.msi][edge] |
25
- | Firefox | [geckodriver(.exe)][geckodriver] |
26
- | Opera | [operadriver(.exe)][operadriver] |
27
- | Safari | [safaridriver] |
8
+ ## Installation
28
9
 
29
- ## Usage
10
+ ```bash
11
+ npm install selenium-webdriver
12
+ ```
30
13
 
31
- The sample below and others are included in the `example` directory. You may
32
- also find the tests for selenium-webdriver informative.
14
+ ## Quick Start
33
15
 
34
16
  ```javascript
35
- const { Builder, Browser, By, Key, until } = require('selenium-webdriver')
17
+ const { Builder, Browser } = require('selenium-webdriver')
36
18
 
37
19
  ;(async function example() {
38
- let driver = await new Builder().forBrowser(Browser.FIREFOX).build()
20
+ let driver = await new Builder().forBrowser(Browser.CHROME).build()
39
21
  try {
40
- await driver.get('https://www.google.com/ncr')
41
- await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
42
- await driver.wait(until.titleIs('webdriver - Google Search'), 1000)
22
+ await driver.get('https://www.selenium.dev')
23
+ console.log(await driver.getTitle())
43
24
  } finally {
44
25
  await driver.quit()
45
26
  }
46
27
  })()
47
28
  ```
48
29
 
49
- ### Using the Builder API
30
+ Selenium Manager automatically handles browser driver installation — no manual driver setup required.
31
+
32
+ ## Configuring the Builder
50
33
 
51
- The `Builder` class is your one-stop shop for configuring new WebDriver
52
- instances. Rather than clutter your code with branches for the various browsers,
53
- the builder lets you set all options in one flow. When you call
54
- `Builder#build()`, all options irrelevant to the selected browser are dropped:
34
+ The `Builder` sets default options for all browsers in a single chain; options
35
+ for non-selected browsers are dropped at `build()` time. The target browser can
36
+ be swapped at runtime via the `SELENIUM_BROWSER` environment variable.
55
37
 
56
38
  ```javascript
57
- const webdriver = require('selenium-webdriver')
39
+ const { Builder, Browser } = require('selenium-webdriver')
58
40
  const chrome = require('selenium-webdriver/chrome')
59
41
  const firefox = require('selenium-webdriver/firefox')
60
42
 
61
- let driver = new webdriver.Builder()
62
- .forBrowser(webdriver.Browser.FIREFOX)
63
- .setChromeOptions(/* ... */)
64
- .setFirefoxOptions(/* ... */)
43
+ let driver = new Builder()
44
+ .forBrowser(Browser.FIREFOX)
45
+ .setChromeOptions(new chrome.Options())
46
+ .setFirefoxOptions(new firefox.Options())
65
47
  .build()
66
48
  ```
67
49
 
68
- Why would you want to configure options irrelevant to the target browser? The
69
- `Builder`'s API defines your _default_ configuration. You can change the target
70
- browser at runtime through the `SELENIUM_BROWSER` environment variable. For
71
- example, the `example/google_search.js` script is configured to run against
72
- Firefox. You can run the example against other browsers just by changing the
73
- runtime environment
74
-
75
- # cd node_modules/selenium-webdriver
76
- node example/google_search
77
- SELENIUM_BROWSER=chrome node example/google_search
78
- SELENIUM_BROWSER=safari node example/google_search
79
-
80
- ### The Standalone Selenium Server
81
-
82
- The standalone Selenium Server acts as a proxy between your script and the
83
- browser-specific drivers. The server may be used when running locally, but it's
84
- not recommend as it introduces an extra hop for each request and will slow
85
- things down. The server is required, however, to use a browser on a remote host
86
- (most browser drivers, like the IEDriverServer, do not accept remote
87
- connections).
50
+ ## Running Against a Remote Server
88
51
 
89
- To use the Selenium Server, you will need to install the
90
- [JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) and
91
- download the latest server from [Selenium][release]. Once downloaded, run the
92
- server with
93
-
94
- java -jar selenium-server-4.27.0.jar standalone
95
-
96
- You may configure your tests to run against a remote server through the Builder
97
- API:
52
+ To run scripts against a [Selenium Grid](https://www.selenium.dev/documentation/grid/)
53
+ or standalone server, point the Builder at the server URL, or set
54
+ `SELENIUM_REMOTE_URL`:
98
55
 
99
56
  ```javascript
100
- let driver = new webdriver.Builder()
101
- .forBrowser(webdriver.Browser.FIREFOX)
102
- .usingServer('http://localhost:4444/wd/hub')
103
- .build()
57
+ let driver = new Builder().forBrowser(Browser.CHROME).usingServer('http://localhost:4444').build()
104
58
  ```
105
59
 
106
- Or change the Builder's configuration at runtime with the `SELENIUM_REMOTE_URL`
107
- environment variable:
60
+ ```bash
61
+ SELENIUM_REMOTE_URL="http://localhost:4444" node script.js
62
+ ```
108
63
 
109
- SELENIUM_REMOTE_URL="http://localhost:4444/wd/hub" node script.js
64
+ ## Node Support Policy
110
65
 
111
- You can experiment with these options using the `example/google_search.js`
112
- script provided with `selenium-webdriver`.
66
+ Each `selenium-webdriver` release targets the latest _semver-minor_ of Node's
67
+ [LTS and Current releases](https://github.com/nodejs/release#release-schedule).
68
+
69
+ | Level | Guarantee |
70
+ | :------------ | :------------------------------------------------------------------------ |
71
+ | _supported_ | API compatible without runtime flags; bugs investigated and fixed. |
72
+ | _best effort_ | Bugs investigated as time permits; API compatibility only where required. |
73
+ | _unsupported_ | Bug reports closed as will-not-fix; API compatibility not guaranteed. |
74
+
75
+ Versions older than the active LTS, unstable release branches (e.g. `v.Next`),
76
+ and _semver-major_ Node releases outside the LTS / Current pair are _unsupported_.
113
77
 
114
78
  ## Documentation
115
79
 
116
- API documentation is available online from the [Selenium project][api].
117
- Additional resources include
80
+ - [Getting Started](https://www.selenium.dev/documentation/webdriver/getting_started/)
81
+ - [JavaScript API Docs](https://www.selenium.dev/selenium/docs/api/javascript/)
82
+ - [Selenium Manager](https://www.selenium.dev/documentation/selenium_manager/)
83
+ - [Selenium Grid](https://www.selenium.dev/documentation/grid/)
118
84
 
119
- - the #selenium channel on Libera IRC
120
- - the [selenium-users@googlegroups.com][users] list
121
- - [SeleniumHQ](https://selenium.dev/documentation/) documentation
85
+ ## Support
86
+
87
+ - [Selenium Chat](https://www.selenium.dev/support/#ChatRoom)
88
+ - [GitHub Issues](https://github.com/SeleniumHQ/selenium/issues)
122
89
 
123
90
  ## Contributing
124
91
 
125
- Contributions are accepted either through [GitHub][gh] pull requests or patches
126
- via the [Selenium issue tracker][issues].
92
+ Contributions are welcome via [GitHub](https://github.com/SeleniumHQ/selenium/) pull requests.
93
+ See the [source code](https://github.com/SeleniumHQ/selenium/tree/trunk/javascript/selenium-webdriver) for this binding.
127
94
 
128
- ## Node Support Policy
95
+ ## Links
129
96
 
130
- Each version of selenium-webdriver will support the latest _semver-minor_
131
- version of the [LTS] and stable Node releases. All _semver-major_ &
132
- _semver-minor_ versions between the LTS and stable release will have "best
133
- effort" support. Following a Selenium release, any _semver-minor_ Node releases
134
- will also have "best effort" support. Releases older than the latest LTS,
135
- _semver-major_ releases, and all unstable release branches (e.g. "v.Next")
136
- are considered strictly unsupported.
137
-
138
- For example, suppose the current LTS and stable releases are v22.13.0 and
139
- v23.6.0,
140
- respectively. Then a Selenium release would have the following support levels:
141
-
142
- | Version | Support |
143
- | :--------: | :-----------: |
144
- | <= 16.20.2 | _unsupported_ |
145
- | 16.20.2 | supported |
146
- | 18.8.0 | supported |
147
- | >= 22.13.0 | best effort |
148
- | v.Next | _unsupported_ |
149
-
150
- ### Support Level Definitions
151
-
152
- - _supported:_ A selenium-webdriver release will be API compatible with the
153
- platform API, without the use of runtime flags.
154
-
155
- - _best effort:_ Bugs will be investigated as time permits. API compatibility is
156
- only guaranteed where required by a _supported_ release. This effectively
157
- means the adoption of new JS features, such as ES2015 modules, will depend
158
- on what is supported in Node's LTS.
159
-
160
- - _unsupported:_ Bug submissions will be closed as will-not-fix and API
161
- compatibility is not guaranteed.
162
-
163
- ### Projected Support Schedule
164
-
165
- If Node releases a new [LTS] each October and a new major version every 6
166
- months, the support window for selenium-webdriver will be roughly:
167
-
168
- | Release | Status | END-OF-LIFE |
169
- | :-----: | :-------------: | :---------: |
170
- | v18.x | Maintenance LTS | 2025-04-30 |
171
- | v19.x | End-of-Life | 2023-06-01 |
172
- | v20.x | Maintenance LTS | 2026-04-30 |
173
- | v21.x | End-of-Life | 2024-06-01 |
174
- | V22.x | Active LTS | 2027-04-30 |
175
- | V23.x | Current | 2025-06-01 |
176
-
177
- ## Issues
178
-
179
- Please report any issues using the [Selenium issue tracker][issues]. When using
180
- the issue tracker
181
-
182
- - **Do** include a detailed description of the problem.
183
- - **Do** include a link to a [gist](http://gist.github.com/) with any
184
- interesting stack traces/logs (you may also attach these directly to the bug
185
- report).
186
- - **Do** include a [reduced test case][reduction]. Reporting "unable to find
187
- element on the page" is _not_ a valid report - there's nothing for us to
188
- look into. Expect your bug report to be closed if you do not provide enough
189
- information for us to investigate.
190
- - **Do not** use the issue tracker to submit basic help requests. All help
191
- inquiries should be directed to the [user forum][users] or #selenium IRC
192
- channel.
193
- - **Do not** post empty "I see this too" or "Any updates?" comments. These
194
- provide no additional information and clutter the log.
195
- - **Do not** report regressions on closed bugs as they are not actively
196
- monitored for updates (especially bugs that are >6 months old). Please open a
197
- new issue and reference the original bug in your report.
97
+ - [npm](https://www.npmjs.com/package/selenium-webdriver)
98
+ - [Documentation](https://www.selenium.dev/documentation/?tab=javascript)
198
99
 
199
100
  ## License
200
101
 
201
- Licensed to the Software Freedom Conservancy (SFC) under one
202
- or more contributor license agreements. See the NOTICE file
203
- distributed with this work for additional information
204
- regarding copyright ownership. The SFC licenses this file
205
- to you under the Apache License, Version 2.0 (the
206
- "License"); you may not use this file except in compliance
207
- with the License. You may obtain a copy of the License at
208
-
209
- http://www.apache.org/licenses/LICENSE-2.0
210
-
211
- Unless required by applicable law or agreed to in writing,
212
- software distributed under the License is distributed on an
213
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
214
- KIND, either express or implied. See the License for the
215
- specific language governing permissions and limitations
216
- under the License.
217
-
218
- [LTS]: https://github.com/nodejs/LTS
219
- [PATH]: http://en.wikipedia.org/wiki/PATH_%28variable%29
220
- [api]: https://www.selenium.dev/selenium/docs/api/javascript/
221
- [chrome]: https://googlechromelabs.github.io/chrome-for-testing/#stable
222
- [gh]: https://github.com/SeleniumHQ/selenium/
223
- [issues]: https://github.com/SeleniumHQ/selenium/issues
224
- [edge]: http://go.microsoft.com/fwlink/?LinkId=619687
225
- [geckodriver]: https://github.com/mozilla/geckodriver/releases/
226
- [reduction]: http://www.webkit.org/quality/reduction.html
227
- [release]: https://www.selenium.dev/downloads/
228
- [users]: https://groups.google.com/forum/#!forum/selenium-users
229
- [safaridriver]: https://developer.apple.com/library/prerelease/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_0.html#//apple_ref/doc/uid/TP40014305-CH11-DontLinkElementID_28
230
- [operadriver]: https://github.com/operasoftware/operachromiumdriver/releases
102
+ Licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
@@ -124,7 +124,7 @@ class BrowsingContextInspector {
124
124
  this.ws.on('message', (event) => {
125
125
  const { params } = JSON.parse(Buffer.from(event.toString()))
126
126
  if (params) {
127
- let response = null
127
+ let response
128
128
  if ('navigation' in params) {
129
129
  response = new NavigationInfo(params.context, params.navigation, params.timestamp, params.url)
130
130
  } else if ('accepted' in params) {
@@ -0,0 +1,223 @@
1
+ export type BluetoothBluetoothUuid = string;
2
+ export interface BluetoothBluetoothManufacturerData {
3
+ key: number;
4
+ data: string;
5
+ }
6
+ export interface BluetoothCharacteristicProperties {
7
+ broadcast?: boolean;
8
+ read?: boolean;
9
+ writeWithoutResponse?: boolean;
10
+ write?: boolean;
11
+ notify?: boolean;
12
+ indicate?: boolean;
13
+ authenticatedSignedWrites?: boolean;
14
+ extendedProperties?: boolean;
15
+ }
16
+ export type BluetoothRequestDevice = string;
17
+ export interface BluetoothRequestDeviceInfo {
18
+ id: BluetoothRequestDevice;
19
+ name: string | null;
20
+ }
21
+ export type BluetoothRequestDevicePrompt = string;
22
+ export interface BluetoothScanRecord {
23
+ name?: string;
24
+ uuids?: BluetoothBluetoothUuid[];
25
+ appearance?: Number;
26
+ manufacturerData?: BluetoothBluetoothManufacturerData[];
27
+ }
28
+ export type BluetoothCommand = BluetoothHandleRequestDevicePrompt | BluetoothSimulateAdapter | BluetoothDisableSimulation | BluetoothSimulatePreconnectedPeripheral | BluetoothSimulateAdvertisement | BluetoothSimulateGattConnectionResponse | BluetoothSimulateGattDisconnection | BluetoothSimulateService | BluetoothSimulateCharacteristic | BluetoothSimulateCharacteristicResponse | BluetoothSimulateDescriptor | BluetoothSimulateDescriptorResponse;
29
+ export interface BluetoothHandleRequestDevicePrompt {
30
+ method: "bluetooth.handleRequestDevicePrompt";
31
+ params: BluetoothHandleRequestDevicePromptParameters;
32
+ }
33
+ export type BluetoothHandleRequestDevicePromptParameters = (BluetoothHandleRequestDevicePromptAcceptParameters | BluetoothHandleRequestDevicePromptCancelParameters) & {
34
+ context: string;
35
+ prompt: BluetoothRequestDevicePrompt;
36
+ };
37
+ export interface BluetoothHandleRequestDevicePromptAcceptParameters {
38
+ accept: true;
39
+ device: BluetoothRequestDevice;
40
+ }
41
+ export interface BluetoothHandleRequestDevicePromptCancelParameters {
42
+ accept: false;
43
+ }
44
+ export interface BluetoothSimulateAdapter {
45
+ method: "bluetooth.simulateAdapter";
46
+ params: BluetoothSimulateAdapterParameters;
47
+ }
48
+ export interface BluetoothSimulateAdapterParameters {
49
+ context: string;
50
+ leSupported?: boolean;
51
+ state: "absent" | "powered-off" | "powered-on";
52
+ }
53
+ export interface BluetoothDisableSimulation {
54
+ method: "bluetooth.disableSimulation";
55
+ params: BluetoothDisableSimulationParameters;
56
+ }
57
+ export interface BluetoothDisableSimulationParameters {
58
+ context: string;
59
+ }
60
+ export interface BluetoothSimulatePreconnectedPeripheral {
61
+ method: "bluetooth.simulatePreconnectedPeripheral";
62
+ params: BluetoothSimulatePreconnectedPeripheralParameters;
63
+ }
64
+ export interface BluetoothSimulatePreconnectedPeripheralParameters {
65
+ context: string;
66
+ address: string;
67
+ name: string;
68
+ manufacturerData: BluetoothBluetoothManufacturerData[];
69
+ knownServiceUuids: BluetoothBluetoothUuid[];
70
+ }
71
+ export interface BluetoothSimulateAdvertisement {
72
+ method: "bluetooth.simulateAdvertisement";
73
+ params: BluetoothSimulateAdvertisementParameters;
74
+ }
75
+ export interface BluetoothSimulateAdvertisementParameters {
76
+ context: string;
77
+ scanEntry: BluetoothSimulateAdvertisementScanEntryParameters;
78
+ }
79
+ export interface BluetoothSimulateAdvertisementScanEntryParameters {
80
+ deviceAddress: string;
81
+ rssi: Number;
82
+ scanRecord: BluetoothScanRecord;
83
+ }
84
+ export interface BluetoothSimulateGattConnectionResponse {
85
+ method: "bluetooth.simulateGattConnectionResponse";
86
+ params: BluetoothSimulateGattConnectionResponseParameters;
87
+ }
88
+ export interface BluetoothSimulateGattConnectionResponseParameters {
89
+ context: string;
90
+ address: string;
91
+ code: number;
92
+ }
93
+ export interface BluetoothSimulateGattDisconnection {
94
+ method: "bluetooth.simulateGattDisconnection";
95
+ params: BluetoothSimulateGattDisconnectionParameters;
96
+ }
97
+ export interface BluetoothSimulateGattDisconnectionParameters {
98
+ context: string;
99
+ address: string;
100
+ }
101
+ export interface BluetoothSimulateService {
102
+ method: "bluetooth.simulateService";
103
+ params: BluetoothSimulateServiceParameters;
104
+ }
105
+ export interface BluetoothSimulateServiceParameters {
106
+ context: string;
107
+ address: string;
108
+ uuid: BluetoothBluetoothUuid;
109
+ type: "add" | "remove";
110
+ }
111
+ export interface BluetoothSimulateCharacteristic {
112
+ method: "bluetooth.simulateCharacteristic";
113
+ params: BluetoothSimulateCharacteristicParameters;
114
+ }
115
+ export interface BluetoothSimulateCharacteristicParameters {
116
+ context: string;
117
+ address: string;
118
+ serviceUuid: BluetoothBluetoothUuid;
119
+ characteristicUuid: BluetoothBluetoothUuid;
120
+ characteristicProperties?: BluetoothCharacteristicProperties;
121
+ type: "add" | "remove";
122
+ }
123
+ export interface BluetoothSimulateCharacteristicResponse {
124
+ method: "bluetooth.simulateCharacteristicResponse";
125
+ params: BluetoothSimulateCharacteristicResponseParameters;
126
+ }
127
+ export interface BluetoothSimulateCharacteristicResponseParameters {
128
+ context: string;
129
+ address: string;
130
+ serviceUuid: BluetoothBluetoothUuid;
131
+ characteristicUuid: BluetoothBluetoothUuid;
132
+ type: "read" | "write" | "subscribe-to-notifications" | "unsubscribe-from-notifications";
133
+ code: number;
134
+ data?: number[];
135
+ }
136
+ export interface BluetoothSimulateDescriptor {
137
+ method: "bluetooth.simulateDescriptor";
138
+ params: BluetoothSimulateDescriptorParameters;
139
+ }
140
+ export interface BluetoothSimulateDescriptorParameters {
141
+ context: string;
142
+ address: string;
143
+ serviceUuid: BluetoothBluetoothUuid;
144
+ characteristicUuid: BluetoothBluetoothUuid;
145
+ descriptorUuid: BluetoothBluetoothUuid;
146
+ type: "add" | "remove";
147
+ }
148
+ export interface BluetoothSimulateDescriptorResponse {
149
+ method: "bluetooth.simulateDescriptorResponse";
150
+ params: BluetoothSimulateDescriptorResponseParameters;
151
+ }
152
+ export interface BluetoothSimulateDescriptorResponseParameters {
153
+ context: string;
154
+ address: string;
155
+ serviceUuid: BluetoothBluetoothUuid;
156
+ characteristicUuid: BluetoothBluetoothUuid;
157
+ descriptorUuid: BluetoothBluetoothUuid;
158
+ type: "read" | "write";
159
+ code: number;
160
+ data?: number[];
161
+ }
162
+ export type BluetoothEvent = BluetoothRequestDevicePromptUpdated | BluetoothGattConnectionAttempted;
163
+ export interface BluetoothRequestDevicePromptUpdated {
164
+ method: "bluetooth.requestDevicePromptUpdated";
165
+ params: BluetoothRequestDevicePromptUpdatedParameters;
166
+ }
167
+ export interface BluetoothRequestDevicePromptUpdatedParameters {
168
+ context: string;
169
+ prompt: BluetoothRequestDevicePrompt;
170
+ devices: BluetoothRequestDeviceInfo[];
171
+ }
172
+ export interface BluetoothGattConnectionAttempted {
173
+ method: "bluetooth.gattConnectionAttempted";
174
+ params: BluetoothGattConnectionAttemptedParameters;
175
+ }
176
+ export interface BluetoothGattConnectionAttemptedParameters {
177
+ context: string;
178
+ address: string;
179
+ }
180
+ export interface BluetoothCharacteristicEventGenerated {
181
+ method: "bluetooth.characteristicEventGenerated";
182
+ params: BluetoothCharacteristicEventGeneratedParameters;
183
+ }
184
+ export interface BluetoothCharacteristicEventGeneratedParameters {
185
+ context: string;
186
+ address: string;
187
+ serviceUuid: BluetoothBluetoothUuid;
188
+ characteristicUuid: BluetoothBluetoothUuid;
189
+ type: "read" | "write-with-response" | "write-without-response" | "subscribe-to-notifications" | "unsubscribe-from-notifications";
190
+ data?: number[];
191
+ }
192
+ export interface BluetoothDescriptorEventGenerated {
193
+ method: "bluetooth.descriptorEventGenerated";
194
+ params: BluetoothDescriptorEventGeneratedParameters;
195
+ }
196
+ export interface BluetoothDescriptorEventGeneratedParameters {
197
+ context: string;
198
+ address: string;
199
+ serviceUuid: BluetoothBluetoothUuid;
200
+ characteristicUuid: BluetoothBluetoothUuid;
201
+ descriptorUuid: BluetoothBluetoothUuid;
202
+ type: "read" | "write";
203
+ data?: number[];
204
+ }
205
+ export declare class Bluetooth {
206
+ private readonly bidi;
207
+ private constructor();
208
+ static create(driver: unknown): Promise<Bluetooth>;
209
+ handleRequestDevicePrompt(params: BluetoothHandleRequestDevicePromptParameters): Promise<void>;
210
+ simulateAdapter(params: BluetoothSimulateAdapterParameters): Promise<void>;
211
+ disableSimulation(params: BluetoothDisableSimulationParameters): Promise<void>;
212
+ simulatePreconnectedPeripheral(params: BluetoothSimulatePreconnectedPeripheralParameters): Promise<void>;
213
+ simulateAdvertisement(params: BluetoothSimulateAdvertisementParameters): Promise<void>;
214
+ simulateGattConnectionResponse(params: BluetoothSimulateGattConnectionResponseParameters): Promise<void>;
215
+ simulateGattDisconnection(params: BluetoothSimulateGattDisconnectionParameters): Promise<void>;
216
+ simulateService(params: BluetoothSimulateServiceParameters): Promise<void>;
217
+ simulateCharacteristic(params: BluetoothSimulateCharacteristicParameters): Promise<void>;
218
+ simulateCharacteristicResponse(params: BluetoothSimulateCharacteristicResponseParameters): Promise<void>;
219
+ simulateDescriptor(params: BluetoothSimulateDescriptorParameters): Promise<void>;
220
+ simulateDescriptorResponse(params: BluetoothSimulateDescriptorResponseParameters): Promise<void>;
221
+ onRequestDevicePromptUpdated(callback: (params: BluetoothRequestDevicePromptUpdatedParameters) => void): Promise<void>;
222
+ onGattConnectionAttempted(callback: (params: BluetoothGattConnectionAttemptedParameters) => void): Promise<void>;
223
+ }