2023-03-21 09:21:10 +00:00
|
|
|
---
|
|
|
|
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 {
|
2023-11-09 12:57:33 +00:00
|
|
|
abstract waitForDevicePrompt(
|
2023-03-21 09:21:10 +00:00
|
|
|
options?: WaitTimeoutOptions
|
|
|
|
): Promise<DeviceRequestPrompt>;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
2024-03-20 15:03:14 +00:00
|
|
|
<table><thead><tr><th>
|
2023-03-21 09:21:10 +00:00
|
|
|
|
2024-03-20 15:03:14 +00:00
|
|
|
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>
|
2023-03-21 09:21:10 +00:00
|
|
|
**Returns:**
|
|
|
|
|
2023-03-27 11:16:51 +00:00
|
|
|
Promise<[DeviceRequestPrompt](./puppeteer.devicerequestprompt.md)>
|
2023-03-21 09:21:10 +00:00
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```ts
|
|
|
|
const [devicePrompt] = Promise.all([
|
|
|
|
page.waitForDevicePrompt(),
|
|
|
|
page.click('#connect-bluetooth'),
|
|
|
|
]);
|
|
|
|
await devicePrompt.select(
|
|
|
|
await devicePrompt.waitForDevice(({name}) => name.includes('My Device'))
|
|
|
|
);
|
|
|
|
```
|