puppeteer/docs/api/puppeteer.devicerequestprompt.md
dependabot[bot] 93e9acc410
chore(deps-dev): Bump the dev-dependencies group with 3 updates (#12101)
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>
2024-03-20 15:03:14 +00:00

1.7 KiB

sidebar_label
DeviceRequestPrompt

DeviceRequestPrompt class

Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth.

Signature:

export declare class DeviceRequestPrompt

Remarks

DeviceRequestPrompt instances are returned via the Page.waitForDevicePrompt() method.

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the DeviceRequestPrompt class.

Example

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

Properties

Property

Modifiers

Type

Description

devices

DeviceRequestPromptDevice[]

Current list of selectable devices.

Methods

Method

Modifiers

Description

cancel()

Cancel the prompt.

select(device)

Select a device in the prompt's list.

waitForDevice(filter, options)

Resolve to the first device in the prompt matching a filter.