What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use an ElementHandle to query descendants within a specific element: handle.$() returns the first match or null, while $eval() and $$eval() run a function on one or all matching descendants. For ordinary clicks, fills, and hovers, Puppeteer recommends Locators instead; they check that an element is ready before acting.
Choose between a Locator and an ElementHandle
| Task | Prefer | Reason |
|---|---|---|
| Click, fill, hover, or wait for a normal page element | Locator | Puppeteer recommends Locators for selecting and interacting. They check relevant readiness conditions, such as visibility and stable position before clicking. |
| Find descendants within a particular element | ElementHandle | $, $eval, and $$eval query within the handle’s element subtree. |
| Use an operation that needs a retained, lower-level element reference | ElementHandle | A handle represents a specific page element, rather than expressing only a selector to act on. |
| Wait across navigation | Page or Frame waitForSelector() |
Page-level waiting works across navigations; an element-scoped wait does not. |
The Puppeteer documentation says, “Locators is the recommended way to select an element and interact with it.” Use a handle when you need its scoped query behavior or a lower-level capability, rather than making it the default for every action. Puppeteer Page interactions guide
Find a descendant within an ElementHandle
First obtain a handle for the container, then query below it. This example checks for a missing child before using it and disposes both manually retained handles when finished:
const container = await page.$('.product-card');
if (!container) {
throw new Error('Product card was not found');
}
let title;
try {
const titleHandle = await container.$('.product-title');
if (!titleHandle) {
throw new Error('Product title was not found inside the card');
}
try {
title = await titleHandle.evaluate(element => element.textContent?.trim() ?? '');
} finally {
await titleHandle.dispose();
}
} finally {
await container.dispose();
}
console.log(title);
handle.$(selector) searches for the first matching descendant and returns an ElementHandle or null. The selector is scoped to the handle, so it does not search unrelated parts of the page. Always check a nullable result before calling methods on it. Puppeteer ElementHandle API
Recommended Free Tools
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Read one or many matches
Use $eval() to run a function on the first matching descendant, or $$eval() to pass all matching descendants as an array. These methods are useful when you only need values and do not need to retain individual handles:
const card = await page.$('.product-card');
if (!card) throw new Error('Product card was not found');
try {
const firstTitle = await card.$eval(
'.product-title',
element => element.textContent?.trim() ?? ''
);
const allTitles = await card.$$eval(
'.product-title',
elements => elements.map(element => element.textContent?.trim() ?? '')
);
console.log({ firstTitle, allTitles });
} finally {
await card.dispose();
}
If no matching descendant exists, an evaluation method cannot run its callback on a match and the call errors. If absence is normal, use $(), check for null, and then inspect the handle. Puppeteer ElementHandle API
Interact with elements reliably
For common actions, use a Locator so Puppeteer can check action readiness instead of querying a handle and immediately acting on a possibly stale node:
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
await page.locator('input[name="email"]').fill('reader@example.com');
await page.locator('button[type="submit"]').click();
Locators check that the target is in the viewport, visible, enabled, and has a stable bounding box before clicking; they perform relevant readiness checks for actions such as filling and hovering as well. A waitForSelector() call is lower-level: waiting for a selector does not automatically retry a later action if that action fails. Puppeteer Page interactions guide
Use a handle when you need it
If an operation specifically needs a retained element reference, query the handle and ensure it remains attached when you act. Dispose it once finished:
const button = await page.$('.dialog button.confirm');
if (!button) throw new Error('Confirm button was not found');
try {
await button.click();
} finally {
await button.dispose();
}
A handle refers to a particular DOM element. If a rerender removes that element, the handle does not automatically find its replacement; use a Locator for an action that should target the current matching element.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Wait for dynamic content
Choose the wait method based on whether the target is scoped to a current container and whether navigation may occur.
Wait inside an existing element
ElementHandle.waitForSelector() waits for a selector within the handle’s subtree:
const panel = await page.$('.results-panel');
if (!panel) throw new Error('Results panel was not found');
try {
const row = await panel.waitForSelector('.result-row', { timeout: 10000 });
if (!row) throw new Error('Result row was not found');
await row.dispose();
} finally {
await panel.dispose();
}
An element-scoped wait does not work across navigations and is subject to the container becoming detached from the DOM. If the page rerenders or navigation replaces the relevant element, reacquire the container or use a page-level wait where appropriate. Puppeteer ElementHandle API
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Wait at page level when navigation is possible
Page.waitForSelector() works across navigations. Its documented default timeout is 30 seconds; change the default with page.setDefaultTimeout(), or set a timeout for an individual wait:
page.setDefaultTimeout(15000);
const result = await page.waitForSelector('.results-panel .result-row');
if (!result) throw new Error('Result row was not found');
await result.dispose();
Use the page-level form when the wait must survive navigation, and use the handle-scoped form when the search must remain within a particular existing element. Puppeteer Page.waitForSelector API
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Understand page-context evaluation
Functions passed to evaluate() run in the browser page context. Return serializable values when you need data in Node.js. Use evaluateHandle() when you need the returned page value wrapped as a handle; if the value is an element reference, it can be used as an ElementHandle.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
const headingText = await page.evaluate(() => {
return document.querySelector('h1')?.textContent?.trim() ?? null;
});
const headingHandle = await page.evaluateHandle(() => document.querySelector('h1'));
try {
const text = await headingHandle.evaluate(element => element?.textContent?.trim() ?? null);
console.log(text);
} finally {
await headingHandle.dispose();
}
For scoped descendant queries, prefer the handle’s own $, $eval, or $$eval methods; they make the search boundary explicit. Puppeteer Page.evaluate API
Troubleshoot common failures
Cannot read properties of nullafter$(): no descendant matched. Test the returned value before callingclick(),evaluate(), or another method; confirm the container and selector are correct.- An evaluation method fails because no element matched:
$eval()and$$eval()require matching descendants for their callback. Use$()when absence needs a separate branch. - An element-scoped wait times out or fails after a rerender: the container may have detached, or the desired content may have been replaced. Reacquire the container; use a page-level wait if navigation can happen.
- A handle action fails after the page changes: the handle identifies the old element, not a selector that automatically resolves again. Use a Locator for actions that should apply to the current match.
- Waiting succeeds but the next action fails: a selector appearing does not guarantee every action precondition is met. Prefer a Locator for routine actions because it checks readiness and handles actionability more directly.
- Long runs accumulate remote objects: dispose handles obtained and retained manually with
await handle.dispose()after the last use. Do not use a handle after disposal.
Or skip the browser setup
For a screenshot of a URL rather than custom in-browser interaction, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API returns an image or PDF, with options for formats such as PNG, JPEG, and WebP:
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 API documentation for request options. It accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be switched 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 take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Learn more at ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.
Version note
The cited Puppeteer documentation identifies version 25.12.0 for the current ElementHandle, Page, and interactions pages; the $$eval() reference result identified version 25.9.0. Check the API signature against the Puppeteer version installed in your project when version-specific behavior matters. ElementHandle API · ElementHandle $$eval API
Frequently Asked Questions
Does `ElementHandle.$()` search the whole page?
No. It searches descendants of the element represented by that handle.
Can I use an ElementHandle after navigation?
A handle may point to a detached element after navigation or rerender. Reacquire the element or use a page-level wait when the wait must cross navigation.
Quick Recap
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.

