Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk3 min

How to Handle Device Requests in Puppeteer

Wait for Puppeteer’s device prompt before triggering a page request, then match and select the intended device. See how this differs from emulation and HTTP interception.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a page-triggered device request—such as a WebBluetooth chooser—start page.waitForDevicePrompt() before clicking the page control that opens it. Then wait for a matching device and select it. This is different from mobile-device emulation and HTTP request interception, which handle different tasks.

Handle a page-triggered device prompt

Puppeteer’s Page.waitForDevicePrompt() returns a DeviceRequestPrompt for a device request initiated by the page. The key timing requirement is to begin waiting before the page requests the device: the method does not return a prompt that is already active. Puppeteer describes this flow for APIs such as WebBluetooth. See the Page.waitForDevicePrompt() API reference.

As an Amazon Associate I earn from qualifying purchases.

Complete example

Start the prompt wait and the action that triggers the request together. The example uses a button selector and a device-name predicate; replace both with selectors and criteria appropriate to your test page.

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 predicate identifies a candidate device in the prompt. A name is not necessarily unique, so use a criterion that distinguishes the intended device in your test environment. The example does not require a particular Bluetooth product.

Sequence and timing

  1. Open the page and identify the page action that triggers its device request.
  2. Call page.waitForDevicePrompt() before that action. Do not click first and start waiting afterward.
  3. Run the wait and triggering action together, for example with Promise.all().
  4. Call devicePrompt.waitForDevice(predicate) to find the intended candidate.
  5. Pass the returned device to devicePrompt.select(device).

Choose the right Puppeteer API for “device”

“Device request” can refer to different browser automation tasks. Choose by the event you need to control, not by the word “device.”

Task Puppeteer API or object When to set it up
Respond to a page-triggered chooser, such as a WebBluetooth request Page.waitForDevicePrompt() and DeviceRequestPrompt Before triggering the page’s request
Use a mobile-style viewport and user agent Page.emulate(device), or user-agent and viewport APIs Before navigation is generally preferable
Inspect or modify HTTP network requests Page.setRequestInterception(true) and HTTPRequest Enable interception before the requests you want to handle

Mobile-device emulation

Page.emulate(device) applies a Puppeteer device profile’s viewport metrics and user agent; it is a shortcut for setting those values. It emulates a software profile, not a physical phone or Bluetooth peripheral. Set the profile before navigation where possible: changing viewport dimensions can resize the page and may trigger a reload in some cases. See the Page.emulate() reference and device profiles reference.

HTTP request interception

Page.setRequestInterception(true) is for browser network requests, not device-selection prompts. When interception is enabled, requests stall until they are continued, aborted, or fulfilled, except requests completed using the browser cache. See the network interception guide and Page.setRequestInterception() reference.

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

If multiple handlers may resolve an intercepted request, guard against handling a request that another handler has already resolved. Puppeteer documents cooperative priority handling, but it only applies when all resolutions use priorities; a legacy resolution can take effect immediately. These rules concern HTTP interception and do not select a device from a browser prompt.

Troubleshoot device-prompt automation

  • The wait never returns or the prompt is missed: Make sure waitForDevicePrompt() starts before the click or other page action that requests a device. It will not return an already active prompt.
  • No candidate matches: Check that the page actually triggered a device request, then adjust the predicate to match the names or other identifying information available in your test environment. Avoid assuming a device name is globally unique.
  • The code reports that the method is unavailable: Check the installed Puppeteer package and its API reference. The device-prompt method appears in the Next reference; do not assume it exists in every installed release. The documented version range surfaced for related device-profile, emulation, and interception pages includes Puppeteer 25.10.0–25.12.0, but that does not establish the device-prompt method’s availability in those releases.
  • You are trying to change screen dimensions: Use device emulation or viewport APIs rather than waitForDevicePrompt().
  • You are trying to modify URLs, headers, or network behavior: Use HTTP request interception and ensure every intercepted request is resolved. It does not operate on a WebBluetooth chooser.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a website screenshot rather than testing a browser device chooser, ScreenshotNeo returns an image or PDF from one GET request. It is a different task from selecting a WebBluetooth device through Puppeteer.

Best Value
The SQL Programming Language: .
  • Used Book in Good Condition
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 API options. It removes cookie banners, popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

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.

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

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.