mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
a5149d52f5
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com> Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
46 lines
1.0 KiB
Markdown
46 lines
1.0 KiB
Markdown
---
|
|
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'))
|
|
);
|
|
```
|