Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check 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 desk4 min

How to Print Console Output in the Terminal with Headless Chrome

Puppeteer does not automatically send page console messages to your terminal. Attach a page console listener before navigation and forward each message to Node.js.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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()));

Register the listener before navigating or running the action that may log. Headless Chrome does not automatically copy a page’s JavaScript console messages into your terminal: the listener bridges the browser page context and the Node.js automation context.

As an Amazon Associate I earn from qualifying purchases.

Forward page console messages with Puppeteer

This complete example launches headless Chrome, attaches a listener before navigation, and then visits a page. Replace the URL with the page you want to inspect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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: 'load' });
    // Perform any actions that may cause additional page console messages here.
  } finally {
    await browser.close();
  }
})();

Run the script with Node.js, for example node capture-console.js. Messages emitted by page JavaScript appear in the terminal with the PAGE LOG: prefix; the prefix helps distinguish them from messages printed by your Node.js code. Puppeteer’s debugging guide demonstrates listening for the console event and forwarding msg.text() to Node output: Puppeteer debugging guide.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Capture messages from a particular action

Install the event listener before the action. This example clicks a button after subscribing, so output triggered by the click can be observed:

page.on('console', msg => console.log('PAGE LOG:', msg.text()));

await page.goto('https://example.com');
await page.click('#run');

Likewise, if page code is executed with page.evaluate(), its browser-side logging can be forwarded by the same listener:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
await page.evaluate(() => console.log('Message from the page'));

Choose stdout or stderr

console.log() writes the forwarded messages to Node.js stdout. If you want page messages separated from normal output—for example, so shell scripts can redirect them independently—write them to stderr instead:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.on('console', msg => console.error('PAGE LOG:', msg.text()));

This changes where the automation process writes the forwarded message; it does not alter the page’s console behavior.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

When readable text is not enough

msg.text() is a convenient way to print the message text. For richer details such as severity, source, URL, and line or column information, use the metadata exposed by the installed Puppeteer event object or a DevTools Protocol client. The exact fields and bindings can vary with the library and protocol version, so check the documentation for the version in use.

The DevTools Protocol reference marks its legacy Console domain deprecated and points readers toward Runtime or Log. If you are implementing protocol access directly, consult the current reference and the bindings for your protocol version rather than copying an older Console-domain example: Chrome DevTools Protocol reference.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Do not confuse page logs with Chrome diagnostics or output flags

  • Page JavaScript console: Subscribe to Puppeteer’s page console event and forward messages to Node.js.
  • Chrome diagnostic logging: Chrome’s --enable-logging --v=1 options enable browser diagnostic logs. Those diagnostics are not a dependable substitute for capturing a page’s console.log() stream. See Google’s Chrome debug logging documentation.
  • --dump-dom: Prints the page DOM to stdout; it does not subscribe to console events.
  • --print-to-pdf and --screenshot: Create a PDF or screenshot, respectively. They do not print page console messages. See the Headless Chrome guide.
  • Remote debugging endpoint: With --remote-debugging-port=0, Chrome writes its selected endpoint to stderr and to the DevToolsActivePort file in the browser profile folder. That is connection information, not page console output. See the DevTools Protocol documentation.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting missing terminal output

The page logs before the listener is attached

Attach page.on('console', ...) immediately after creating the page and before page.goto(), or before the action that triggers the message. A listener added afterward cannot capture earlier events.

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

The message is from Node.js, not page JavaScript

Node output already goes to the terminal through calls such as console.log(). The Puppeteer listener is for messages produced in the browser page context. Add the listener when you need page-side messages forwarded.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

You are looking at a DOM dump or Chrome log

Switch to the page event listener for website console.* calls. DOM, PDF, screenshot, and Chrome diagnostic options have different purposes and do not replace that event subscription.

Your script exits or closes Chrome too early

Keep the browser open until the navigation and any actions of interest have completed. In asynchronous scripts, await those operations before closing the browser; otherwise there may be no opportunity to receive later events.

Protocol fields differ from an example

Check the installed Puppeteer version or the current DevTools Protocol documentation. The protocol reference is living documentation, and its legacy Console domain is deprecated.

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

Or skip the browser setup

If you need screenshots or PDFs rather than a terminal stream of JavaScript console messages, ScreenshotNeo provides a one-request capture API. This does not replace console-event forwarding; it is an alternative for capture output.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo documentation for API options. Before a capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo to get 1,000 screenshots a month free, with no card required.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.