-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Page.waitForDevicePrompt (#9299)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com> Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
- Loading branch information
1 parent
d6e5aee
commit a5149d5
Showing
10 changed files
with
968 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
sidebar_label: Frame.waitForDevicePrompt | ||
--- | ||
|
||
# Frame.waitForDevicePrompt() method | ||
|
||
This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth. | ||
|
||
:::caution | ||
|
||
This must be called before the device request is made. It will not return a currently active device prompt. | ||
|
||
::: | ||
|
||
#### Signature: | ||
|
||
```typescript | ||
class Frame { | ||
waitForDevicePrompt( | ||
options?: WaitTimeoutOptions | ||
): Promise<DeviceRequestPrompt>; | ||
} | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --------- | ------------------------------------------------------- | ------------ | | ||
| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ | | ||
|
||
**Returns:** | ||
|
||
Promise<DeviceRequestPrompt> | ||
|
||
## Example | ||
|
||
```ts | ||
const [devicePrompt] = Promise.all([ | ||
frame.waitForDevicePrompt(), | ||
frame.click('#connect-bluetooth'), | ||
]); | ||
await devicePrompt.select( | ||
await devicePrompt.waitForDevice(({name}) => name.includes('My Device')) | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
sidebar_label: Page.waitForDevicePrompt | ||
--- | ||
|
||
# Page.waitForDevicePrompt() method | ||
|
||
This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth. | ||
|
||
:::caution | ||
|
||
This must be called before the device request is made. It will not return a currently active device prompt. | ||
|
||
::: | ||
|
||
#### Signature: | ||
|
||
```typescript | ||
class Page { | ||
waitForDevicePrompt( | ||
options?: WaitTimeoutOptions | ||
): Promise<DeviceRequestPrompt>; | ||
} | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --------- | ------------------------------------------------------- | ------------ | | ||
| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ | | ||
|
||
**Returns:** | ||
|
||
Promise<DeviceRequestPrompt> | ||
|
||
## Example | ||
|
||
```ts | ||
const [devicePrompt] = Promise.all([ | ||
page.waitForDevicePrompt(), | ||
page.click('#connect-bluetooth'), | ||
]); | ||
await devicePrompt.select( | ||
await devicePrompt.waitForDevice(({name}) => name.includes('My Device')) | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.