October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Puppeteer DeviceRequestPrompt: Select and Connect Devices

Start Puppeteer’s device-prompt wait before triggering the page request, match the intended entry, then select it or cancel the prompt.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To select a device requested by a page in Puppeteer, start page.waitForDevicePrompt() before triggering the request, wait for a matching entry with prompt.waitForDevice(), then pass it to prompt.select(). Use prompt.cancel() to decline. The API documentation describes page-originated device requests such as WebBluetooth requests; it does not require a particular hardware model.

How to wait for a Puppeteer device prompt and select a device

Register the prompt wait before the page action that causes the request. A wait started after the request is made will not return a prompt that is already active. Pairing the wait and click in Promise.all() lets the listener start alongside the triggering action.

As an Amazon Associate I earn from qualifying purchases.

  1. Call page.waitForDevicePrompt() before clicking the page’s device-connect control.
  2. Call prompt.waitForDevice() with a predicate that identifies the intended entry.
  3. Pass the returned entry to prompt.select(device).

The following example follows the sequence in the Puppeteer API documentation. Replace the selector and device-name match with values from your page and test environment.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const [devicePrompt] = await Promise.all([
  page.waitForDevicePrompt(),
  page.click('#connect-bluetooth'),
]);

const device = await devicePrompt.waitForDevice(({name}) =>
  name.includes('My Device'),
);
await devicePrompt.select(device);

The example assumes page is an available Puppeteer page and that the page’s connect control requests a device. It is illustrative documentation guidance, not a report of an independently tested browser or hardware setup. See the DeviceRequestPrompt class reference for the prompt methods.

How to choose the right entry from the prompt

prompt.devices is the current readonly list of selectable entries. You can inspect it when you need to understand what the prompt currently offers; use waitForDevice() when the desired entry may not be available immediately.

The predicate receives a DeviceRequestPromptDevice and returns a boolean. The class reference says the method resolves to the first matching device. Its optional wait-timeout options let you set a timeout policy; the documentation does not prescribe a universal matching rule or timeout.

Prefer a property that distinguishes the intended device in your application and test environment. The official example matches a name containing My Device; if names are not unique or stable in your setup, choose another available property suited to the page’s request. Avoid selecting an arbitrary first entry when the wrong device could affect the test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

DeviceRequestPrompt methods at a glance

API Purpose
page.waitForDevicePrompt(options?) Begin waiting for an upcoming device prompt; returns a promise for a DeviceRequestPrompt. Call before the page makes its request.
prompt.devices Read the current list of selectable prompt entries.
prompt.waitForDevice(filter, options?) Wait for the first entry that satisfies the predicate; accepts optional wait-timeout options.
prompt.select(device) Select an entry from this prompt.
prompt.cancel() Cancel the prompt instead of selecting an entry.

For the documented class and method details, see DeviceRequestPrompt, waitForDevice(), and Page.waitForDevicePrompt(). The references reviewed for this article include class documentation version 25.12.0, a waitForDevice reference at 25.10.0, and the Next reference; align your code with the Puppeteer version installed in your project because API references can change.

How to cancel a device request

If the test should decline the request—for example, when no candidate matches your criteria—call cancel() on the prompt rather than selecting an unintended entry:

const [devicePrompt] = await Promise.all([
  page.waitForDevicePrompt(),
  page.click('#connect-bluetooth'),
]);

await devicePrompt.cancel();

Troubleshooting device prompt selection

The prompt wait never resolves

  • Cause: The wait was started after the page had already requested a device, or the triggering action did not make a request.
  • Fix: Start waitForDevicePrompt() before the click or other triggering action, preferably alongside it with Promise.all(). Confirm that the page control actually initiates the device request.

No device matches the predicate

  • Cause: The expected name or property does not match an entry offered by the prompt.
  • Fix: Inspect prompt.devices to see the current selectable entries, then revise the predicate to match the intended device. Set an appropriate timeout through the optional wait-timeout options when waiting for a match.

The wrong device is selected

  • Cause: The predicate is too broad, or the property used for matching is not distinctive in the test environment.
  • Fix: Make the predicate specific to the intended entry using a suitable available property. Do not assume a name is unique unless your application or environment ensures it.

Hardware or browser behavior differs between environments

The API references explain the prompt workflow but do not prescribe a hardware model or establish behavior for every browser, operating system, or device setup. Treat hardware availability and the exact test environment as application-dependent, and verify the example against your installed Puppeteer version and target setup.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For website screenshots rather than device-prompt automation, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return an image or PDF; it does not automate a Puppeteer device chooser. Cookie banners, popups and chat widgets are removed before the shot; bot checks, blank pages and failed loads are never billed; an MCP server lets AI agents take screenshots; and 1,000 screenshots a month are free with no card, with paid plans starting at $5 for 3,000.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example cURL request (replace the target URL and supply your API key):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for request options. Sign up for 1,000 free screenshots a month, with no card required.

Best Value
The SQL Programming Language: .
  • Used Book in Good Condition

Frequently Asked Questions

Does Puppeteer choose a device automatically?

No. The page exposes a device request prompt, and your code selects a matching prompt entry or cancels the request.

Does DeviceRequestPrompt require a specific Bluetooth device?

The API reference does not name a required hardware model. Requirements depend on the page and test environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.