October 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 NowOctober 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

How to Select a Device with Puppeteer DeviceRequestPrompt

Wait for Puppeteer’s device prompt before triggering the page request, find the intended device with a predicate, and pass that device object to select().
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Call page.waitForDevicePrompt() before triggering the page’s device request, find the intended entry with prompt.waitForDevice(predicate), then pass the returned device object to prompt.select(device). The order matters: Puppeteer does not return a prompt that is already active.

Use the prompt to respond to a live device request

DeviceRequestPrompt is Puppeteer’s response mechanism for a page requesting a device through an API such as Web Bluetooth. Its devices property exposes the devices currently selectable in that prompt. The prompt provides methods to wait for a matching device, select it, or cancel the prompt.

As an Amazon Associate I earn from qualifying purchases.

This is a request-time flow: the page initiates a request, and your automation chooses from the prompt’s available devices. It is separate from making a page look like it is running on a particular phone or tablet.

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

Arm the prompt wait, trigger the request, then select

  1. Start waiting before the request. Register waitForDevicePrompt() before clicking the control or performing another action that causes the page to request a device.
  2. Wait for the intended entry. Use waitForDevice(filter). It resolves to the first device matching your predicate.
  3. Pass the returned object to select(). Do not pass the device’s name string; pass the device object returned by waitForDevice().
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);

Promise.all starts the wait and the click together, so Puppeteer has registered the wait before the click takes effect. Replace #connect-bluetooth and the name test with values that fit your page and test setup. The predicate shown is an example, not a universal device-identity rule: if names can collide, match using the fields exposed by the device object and the distinctions that matter in your environment.

#1 Best Overall
2 Pack 64GB USB Flash Drive USB 2.0 Thumb Drives Jump Drive Fold Storage Memory Stick Swivel Design - Black
  • What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
  • Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
  • Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
  • Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
  • Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers

Choose a predicate that fits the test

The API resolves the first device matching the predicate. A broad test such as name.includes('Device') may select an unintended entry if multiple devices match. Make the predicate as discriminating as the available device fields allow, and make the test environment’s expected match clear.

The prompt also exposes the current selectable-device list through devices. If your test needs to inspect available choices before selecting, use that list rather than assuming a particular device is present. Device availability and names depend on the request and environment; the API documentation does not prescribe a universal identity strategy.

Rank #2
128GB Flash Drive Aiibe USB Flash Drive 128 GB Thumb Drive USB 2.0 Memory Stick Zip Drive Backup Jump Drive Single 128GB 128G USB Drive for PC Laptop
  • Large Data Storage Capacity: Flash Drive with 128GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer
  • Easy to use: The thumb drive is plug and play without any software installation; Supports Windows 7/8/10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also compatible with USB 2.0 and 1.1 ports; Storage is fast, safe and stable
  • Wide Compatibility: USB flash drive support TV, desktop, notebook computer, car, audio and other device; It is your great data storage and transfer companion with traveling and working
  • Retractable Desgin: The usb drive's retractable design can effectively protect the USB interface; The capless design can avoid losing of cap; Weight: 7g, Size: 2.6 × 0.8 × 0.4 inch. Portable to take your digital world anywhere
  • What You Get: 1 x 128GB USB Flash Drive Thumb Drive, All of usb drives have been rigorously tested and formatted before leaving the factory; The default format of the USB stick is exFAT

Cancel when the prompt should not proceed

Call devicePrompt.cancel() to cancel the prompt. The surfaced API reference identifies this method but does not establish a detailed cancellation-result flow. If subsequent test behavior depends on cancellation, verify that behavior against the documentation and types for the Puppeteer release installed in your project.

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

Do not confuse prompt selection with device emulation

Task Purpose Input Puppeteer API
Respond to a live device request Select a device offered by a page request. A device object from the prompt’s selectable devices. Page.waitForDevicePrompt(), then DeviceRequestPrompt.waitForDevice() and select().
Emulate a device profile Simulate device metrics and user agent for page testing. A predefined profile from KnownDevices. Page.emulate(KnownDevices[...]).

KnownDevices profiles are for emulation; they are not the live devices in a request prompt. Emulation does not replace selecting a device from a page’s prompt.

Rank #3
SANDISK 128GB Ultra Flair, USB-A Flash Drive, Up to 150MB/s Read Speeds
  • High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
  • Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
  • Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
  • Sleek, durable metal casing
  • Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]

Version and timeout considerations

The Puppeteer reference pages surfaced for this API are not all from the same release: the class overview is labeled 25.12.0, the waitForDevice() page 25.2.1, and related prompt and selection material includes /next/ documentation. Check the reference and type definitions matching the Puppeteer version installed in your project before relying on release-specific details.

waitForDevice() accepts optional wait-timeout options. The surfaced reference material does not establish the exact default timeout or detailed behavior when no device matches, so do not assume either; check your installed version’s API reference or type definitions when timeout handling matters.

Rank #4
Sale
Lexar D40E 128GB Dual USB 3.2 Gen 1 Type-C Jump Drive, Champagne Silver
  • USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
  • Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
  • Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
  • Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
  • Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty

Troubleshooting

  • The wait never receives a prompt: Make sure waitForDevicePrompt() is started before the page makes its device request. It does not return an already-active prompt.
  • No device matches: Check that the request actually opened a prompt and that the predicate matches a device in the prompt’s available list. Avoid relying on an assumed name or on a device from a different environment.
  • select() receives the wrong value: Pass the device object resolved by waitForDevice(), not a name or other string.
  • The selected device is not the intended one: Narrow the predicate. Since the first matching device is returned, a predicate that matches multiple entries may select an unintended one.
  • You are trying to test a mobile layout: Use device emulation for profile, metrics, and user-agent testing. A request prompt handles a different task: choosing a device requested by the page.
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 to capture a webpage rather than answer its live device request, ScreenshotNeo is a separate website screenshot API. It cannot select a Bluetooth device for Puppeteer. A single GET request can return an image or PDF; see the ScreenshotNeo API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides screenshot tools for AI agents, and the Free plan includes 1,000 shots per month with no card required; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Best Value
2-Pack 128GB USB C Flash Drive Dual Type C + USB A Memory Stick Jump Drive 2-in-1 Thumb Drive for Storage and Backup (128GB*2 Black&Blue)
  • 2-in-1 Dual Design: Features both USB-C and USB-A connectors, making it compatible with phones, tablets, MacBooks, PCs, and laptops-no adapter needed
  • Wide Compatibility: Works seamlessly with USB A and USB C devices, ensuring reliable file transfers across smartphones, computers, and more
  • Ample Storage Options: Available in 16GB/32GB/64GB/128GB providing plenty of space for photos, videos, music, and documents
  • Portable & Lightweight: Compact and durable design for travel, school, or daily use-take your files anywhere
  • Plug-and-Play Convenience: No software or drivers required; simply insert into USB-C or USB-A ports and start transferring files instantly

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.