mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
93e9acc410
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nikolay Vitkov <nvitkov@chromium.org>
69 lines
1.0 KiB
Markdown
69 lines
1.0 KiB
Markdown
---
|
|
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 {
|
|
abstract waitForDevicePrompt(
|
|
options?: WaitTimeoutOptions
|
|
): Promise<DeviceRequestPrompt>;
|
|
}
|
|
```
|
|
|
|
## Parameters
|
|
|
|
<table><thead><tr><th>
|
|
|
|
Parameter
|
|
|
|
</th><th>
|
|
|
|
Type
|
|
|
|
</th><th>
|
|
|
|
Description
|
|
|
|
</th></tr></thead>
|
|
<tbody><tr><td>
|
|
|
|
options
|
|
|
|
</td><td>
|
|
|
|
[WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md)
|
|
|
|
</td><td>
|
|
|
|
_(Optional)_
|
|
|
|
</td></tr>
|
|
</tbody></table>
|
|
**Returns:**
|
|
|
|
Promise<[DeviceRequestPrompt](./puppeteer.devicerequestprompt.md)>
|
|
|
|
## Example
|
|
|
|
```ts
|
|
const [devicePrompt] = Promise.all([
|
|
page.waitForDevicePrompt(),
|
|
page.click('#connect-bluetooth'),
|
|
]);
|
|
await devicePrompt.select(
|
|
await devicePrompt.waitForDevice(({name}) => name.includes('My Device'))
|
|
);
|
|
```
|