puppeteer/website/versioned_docs/version-21.3.1/api/puppeteer.frame.waitfordeviceprompt.md
release-please[bot] d98f488a51
chore: release main (#10942)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2023-09-19 20:20:53 +02:00

1.0 KiB

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:

class Frame {
  waitForDevicePrompt(
    options?: WaitTimeoutOptions
  ): Promise<DeviceRequestPrompt>;
}

Parameters

Parameter Type Description
options WaitTimeoutOptions (Optional)

Returns:

Promise<DeviceRequestPrompt>

Example

const [devicePrompt] = Promise.all([
  frame.waitForDevicePrompt(),
  frame.click('#connect-bluetooth'),
]);
await devicePrompt.select(
  await devicePrompt.waitForDevice(({name}) => name.includes('My Device'))
);