puppeteer/website/versioned_docs/version-19.8.2/api/puppeteer.page.waitfordeviceprompt.md
release-please[bot] 8d026042db
chore: release main (#9939)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2023-03-29 11:22:11 +00:00

1.0 KiB

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:

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

Parameters

Parameter Type Description
options WaitTimeoutOptions (Optional)

Returns:

Promise<DeviceRequestPrompt>

Example

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