With Puppeteer, listen for the page’s console event and forward each message to Node.js output:
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
This bridges two separate contexts: the website’s JavaScript runs in Chrome, while the listener runs in your Node.js process. Headless mode does not automatically send page console.log() messages to the terminal. The example follows Puppeteer’s debugging guide; check it against the version installed in your project.
Forward page console messages to Node.js
Attach the listener to the Puppeteer Page before navigating or triggering the action that may log. That way, early messages are less likely to be missed. Prefix the output so it is easy to distinguish browser messages from logs written by your automation script.
const page = await browser.newPage();
page.on('console', msg => {
console.log('PAGE LOG:', msg.text());
});
await page.goto('https://example.com');
When the page calls a console method, Puppeteer emits the event and the callback writes the message text to the Node.js terminal. The prefix is just a label; change it to suit your script.
#1 Best Overall
- BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
- FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
- FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
- BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
- CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)
Run a complete headless Puppeteer example
Install Puppeteer in a Node.js project, then save this as capture-console.js. The package normally manages a compatible Chrome for Puppeteer; if your setup uses a separately installed browser, supply its executable path when launching.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
page.on('console', msg => {
console.log('PAGE LOG:', msg.text());
});
await page.goto('https://example.com', {
waitUntil: 'domcontentloaded',
});
// Trigger an action here if it produces console output.
} finally {
await browser.close();
}
})();
Run it with node capture-console.js. Replace the example URL and add the interaction your page needs. Keep the event listener registered before that interaction.
Rank #2
- BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
- COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
- BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
- VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
- BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
Choose between readable text and richer message details
msg.text() is suitable when you need a readable line of output. Console events can also expose structured metadata. The Chrome DevTools Protocol Runtime reference documents message information such as level, source, text, URL, and line and column numbers. The exact event object and available fields depend on the automation library and protocol version, so consult the documentation for the version you use if you need to filter by severity or report source locations.
For most Puppeteer scripts, its page event is the simpler option. A direct DevTools Protocol client is worth considering when you need lower-level control or structured fields that your high-level library does not expose conveniently. The protocol reference marks the legacy Console domain deprecated and points to Runtime or Log; check current client bindings rather than building new code around the legacy domain.
Rank #3
- FAST PRINT SPEEDS: Print up to 19 pages per minute.
- COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
- WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
- PAPER CAPACITY: Up to 150 sheets.
- SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
Do not confuse page logs with Chrome diagnostics or output flags
- Page console output: messages produced by website JavaScript, such as
console.log(). Subscribe to the page’s console event and forward it. - Chrome diagnostic logging: browser-level diagnostics. Google’s Chrome debug logging instructions describe options including
--enable-logging --v=1. These diagnostics are not a reliable substitute for capturing the page’s JavaScript console stream. --dump-dom: prints the page DOM to stdout; it does not subscribe to console events.--print-to-pdfand--screenshot: create a PDF or image, respectively, rather than forwarding page log messages.- Remote debugging endpoint: when Chrome is launched with
--remote-debugging-port=0, the selected endpoint is written to stderr and to theDevToolsActivePortfile in the browser profile folder. That is connection information, not page console output.
See Google’s Headless Chrome guide for the output flags and the DevTools Protocol documentation for remote debugging details.
Troubleshoot missing or confusing output
- No page messages appear: confirm that the listener is attached to the same
Pagethat loads the site, and that it is attached before navigation or the action that logs. - Only some messages appear: check whether the messages occur in another page or frame, or whether the relevant script runs before your listener is installed. Attach early and verify which page performs the logging.
- Output is hard to distinguish: add a prefix such as
PAGE LOG:and keep your automation’s own messages clearly labeled. - You see Chrome startup or debug messages instead: those come from browser diagnostics or connection setup, not necessarily from page JavaScript. Use the Puppeteer page event for page console messages.
- Your code errors on event fields: check the installed Puppeteer and protocol documentation. The cited Puppeteer page is under
/next/, and the DevTools Protocoltotreference is living documentation, so APIs can vary by version. - You expected a DOM dump, PDF, or screenshot flag to print logs: those options serve different output tasks. Add a console-event listener instead.
Or skip the browser setup
If you need a website screenshot rather than a terminal stream of JavaScript messages, ScreenshotNeo returns a screenshot or PDF from one API request. For this console-capture task, Puppeteer’s event listener above is the direct method.
Rank #4
- BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
- COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
- BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
- VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
- BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
For a screenshot, this cURL request saves a WebP image:
Quick Recap
Best Value
- FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
- WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
- FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
- WIRELESS WITH SELF-RESET – Helps you stay connected
- PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more
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. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, and cache hits are not billed. Its MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
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.

