What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Listen for the page’s console event and call msg.type() on the ConsoleMessage object Puppeteer passes to your handler:

page.on('console', msg => {
  console.log(msg.type());
});

The result is a string identifying the console message category, such as 'error', 'warn' or 'log'.

Read a console message’s type

Puppeteer emits a ConsoleMessage through the page’s console event. Call type() on that event-provided object to get its category; use text() when you need the rendered message text.

page.on('console', msg => {
  const type = msg.type();
  const text = msg.text();

  if (type === 'error') {
    console.error('Page console error:', text);
  }
});

This example logs only messages categorized as 'error'. To inspect every console event, log both values without filtering. See the Puppeteer ConsoleMessage class reference and the ConsoleMessage.type() method reference.

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

Which type strings can you check?

The Puppeteer ConsoleMessageType reference, labeled version 25.3.0, documents these values:

  • 'log', 'debug', 'info', 'error' and 'warn'
  • 'dir', 'dirxml', 'table' and 'trace'
  • 'clear', 'startGroup', 'startGroupCollapsed' and 'endGroup'
  • 'assert', 'profile', 'profileEnd', 'count', 'timeEnd' and 'verbose'

Compare against the exact string you want to handle, for example msg.type() === 'warn'. Because the documented set belongs to a versioned API, check the type reference matching the Puppeteer version installed in your project before relying on less common categories.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Choose the right inspection method

The ConsoleMessage exposes several methods for different debugging needs. The class reference documents these methods and notes that its constructor is internal; use the object emitted by Puppeteer rather than trying to create one yourself.

  • type() returns the message category.
  • text() returns the rendered message text.
  • args() exposes the arguments passed to the console call.
  • location() and stackTrace() provide source-location and stack information.

Common mistakes

  • Using text() as the category: it returns the message text, not its type. Compare msg.type() to a category string instead.
  • Listening on the wrong event: attach a handler to the page’s console event to receive ConsoleMessage objects.
  • Constructing a message yourself: Puppeteer marks the constructor internal. Inspect the object passed to the event handler.
  • Assuming only three categories exist: the version 25.3.0 type reference lists additional values such as 'table', 'assert' and 'verbose'.
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 a screenshot rather than inspecting Puppeteer console events, ScreenshotNeo can return an image or PDF with one GET request. Its API removes cookie banners, newsletter popups and chat widgets before capture; bot checks, blank pages and failed loads are not billed; and an MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.

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

For example, using cURL:

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 and sign up for 1,000 free screenshots a month with no card.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

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.