Listen for the page’s console event and call msg.type() on the ConsoleMessage Puppeteer passes to the handler. It returns the message category as a string, such as error, warn, or log.
Read a console message’s type
page.on('console', msg => {
console.log(msg.type());
});
Puppeteer emits a ConsoleMessage through the page’s console event. Use that event-provided object; the ConsoleMessage class reference marks its constructor as internal, so application code should not create these objects directly.
As an Amazon Associate I earn from qualifying purchases.
To branch on a category, compare the return value with a supported type string:
page.on('console', msg => {
const type = msg.type();
const text = msg.text();
if (type === 'error') {
console.error('Page console error:', text);
}
});
This reports browser-page console messages. It does not, by itself, capture every kind of page failure, such as failed network requests; those require their corresponding Puppeteer events.
#1 Best Overall
What values can type() return?
The Puppeteer ConsoleMessageType reference, labeled version 25.3.0, documents these strings:
log,debug,info,warn,error,verbosedir,dirxml,table,trace,clear,assertstartGroup,startGroupCollapsed,endGroupprofile,profileEnd,count,timeEnd
For portability, check the type reference that matches the Puppeteer version installed in your project. The documented union is versioned API surface; do not assume another release has exactly the same list.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Choose the right inspection method
type() answers what category Puppeteer assigned. Other methods on the same event object expose different information, as listed in the class reference:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →text()returns the rendered message text.args()exposes the arguments passed to the console call.location()provides source-location information.stackTrace()provides stack-trace information.
For example, log the category and text together when you need readable diagnostic output. Inspect arguments or source context when the rendered text alone is insufficient.
Rank #3
Troubleshoot common mistakes
- Getting message text instead of its category: call
msg.type();msg.text()is for the rendered message. - Listening on the wrong event: register a
consolelistener on the Puppeteerpageto receiveConsoleMessageobjects. - Only handling three familiar values: the documented type union includes additional categories such as
table,assert, andverbose. - Constructing a message in application code: use the object Puppeteer emits; its constructor is documented as internal.
- A type comparison does not match: compare the returned string with the documented literal, including capitalization, and confirm the type list for your installed Puppeteer version.
Or skip the browser setup
If your goal is a screenshot rather than inspecting Puppeteer console events, ScreenshotNeo can return a page capture with one GET request. The API accepts a URL and can return PNG, JPEG, WebP, or PDF. Its cleanup can accept cookie/consent banners and remove 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and whether the request was billed. ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents.
Install no browser automation for this call; create an API key and replace the example URL as needed. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for free and get 1,000 screenshots a month with no card.
Quick Recap
Best Value
Rank #4
- 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.

