Recommended Free Tools
Register the Node.js callback with page.exposeFunction(name, callback), then call it from browser-side code as window[name](...). The callback runs in Node.js, and the browser receives a Promise for its result. Use page.evaluate() to run the calling code in the page context.
How the Node-to-page bridge works
Puppeteer’s Page.exposeFunction() method “adds a function called name on the page’s window object,” according to the Puppeteer API reference for Page.exposeFunction(). The function is registered by your Node.js program, but page code calls it through window. Puppeteer invokes the supplied callback in Node.js and returns its value to the page asynchronously as a Promise.
page.evaluate() has the opposite role: it runs the function you pass in the browser page context and returns that function’s result to Node.js. If the evaluated page function returns a Promise, Puppeteer waits for it. See the Puppeteer API reference for Page.evaluate().
Expose and call a Node.js function
This complete example registers a Node-side MD5 function and calls it from the page. It follows Puppeteer’s documented pattern; the code is an example, not an independently reported test.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →#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.
const puppeteer = require('puppeteer');
const crypto = require('node:crypto');
async function main() {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
// Register this Node.js callback on this page's window.
await page.exposeFunction('md5', text =>
crypto.createHash('md5').update(text).digest('hex')
);
// This function runs in the browser context.
const digest = await page.evaluate(async () => {
return await window.md5('PUPPETEER');
});
console.log(digest);
} finally {
await browser.close();
}
}
main().catch(error => {
console.error(error);
process.exitCode = 1;
});
- Launch Puppeteer and create the
Pagethat needs access to the function. - Call and await
page.exposeFunction('md5', callback)from Node.js before calling the exposed name. - Run page-context code with
page.evaluate(), invokewindow.md5(...), and await its Promise. - Close the browser when the work is complete.
The official API reference also demonstrates exposing a readfile function backed by Node.js fs.readFile. In both cases, the file or hashing work happens in the Node callback, not inside page.evaluate().
Choose the right Puppeteer method
| Method | Where it runs | Use it for | Result |
|---|---|---|---|
page.exposeFunction(name, callback) |
Registers a callback that Puppeteer executes in Node.js when page code calls it. | Letting page code request work handled by your Node program. | The page receives a Promise for the callback’s return value. |
page.evaluate(pageFunction, ...args) |
The supplied function runs in the browser page context. | Reading or changing page state, including calling a function exposed on window. |
The Node caller receives the evaluated function’s result; Puppeteer waits if it is a Promise. |
Register the exposed function on the specific Page whose page context needs it. A Puppeteer browser can contain multiple pages, so exposing a function on one page does not mean you registered it on every page. The Puppeteer Page reference describes a page as a tab or extension background page.
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.
Keep the bridge available or remove it
Exposed functions survive navigations, according to the Page.exposeFunction() reference. To remove a previously exposed name from the page’s window, call page.removeExposedFunction(name) from Node.js:
await page.removeExposedFunction('md5');
Check the API reference matching the Puppeteer version installed in your project before relying on a method signature or behavior. The linked exposeFunction() and evaluate() references identify version 25.12.0; the linked removal reference identifies version 25.3.0.
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.
Troubleshooting
window.md5is not a function: Confirm thatpage.exposeFunction('md5', ...)completed before the page calls it, that the spelling matches, and that you exposed it on the samePageyou are evaluating.- The Node callback does not run: Check that the call to
window.md5(...)is inside page-context code, such as the function passed topage.evaluate(). Writing a function in the Node script does not by itself make it available to page code. - The evaluated result arrives too soon or is missing: Await the exposed function in the page context and await
page.evaluate()in Node. Both calls can involve Promises. - The exposed function is unavailable after cleanup: Check whether your code called
page.removeExposedFunction(name). Exposed functions otherwise survive navigation according to Puppeteer’s API reference. - You need the function on another tab: Register it separately on the other page. Exposure is attached to a
Page.
Or skip the browser setup
If your goal is simply to capture a website rather than run custom browser-side logic, ScreenshotNeo offers a screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP, or PDF, without launching and configuring Puppeteer yourself. Its capture options include device and viewport settings, full-page shots, CSS selectors, custom CSS and JavaScript, cookies, and wait conditions.
Quick Recap
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.
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
For example, use cURL to save a WebP screenshot:
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 parameters. ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan.
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.

