What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
To find where a Puppeteer console message came from, call msg.location() on the ConsoleMessage received by the page’s console event. It returns an object with optional url, lineNumber, and columnNumber fields. The line and column values are zero-based, and either can be undefined when Puppeteer does not have that coordinate.
Get a console message’s source location
Register a listener for the page’s console event, then read the message location from the event argument:
page.on('console', msg => {
const { url, lineNumber, columnNumber } = msg.location();
console.log({
type: msg.type(),
text: msg.text(),
url,
lineNumber,
columnNumber
});
});
The event argument is a ConsoleMessage; location() returns a location object, not a formatted string. This API is documented in Puppeteer’s ConsoleMessage class reference. Puppeteer’s Page event documentation describes the console event as carrying a ConsoleMessage and lists the page events in the PageEvent reference.
What the location fields mean
| Field | Meaning | What to handle |
|---|---|---|
url |
URL of the resource associated with the message, when known. | May be undefined; do not assume every message points to a resource URL. |
lineNumber |
Zero-based line position in the resource, when known. | May be undefined. Add 1 only if presenting it in a one-based display. |
columnNumber |
Zero-based column position, when known. | May be undefined. Convert deliberately if the consuming UI expects one-based positions. |
The optional fields and zero-based coordinate convention are documented in the ConsoleMessageLocation interface. The pinned Puppeteer declarations in Chromium’s DevTools Frontend also show these optional properties: Puppeteer type declarations.
#1 Best Overall
Why a location can be missing
A console message does not guarantee a known source coordinate. Treat url, lineNumber, and columnNumber as optional data: log or display whichever fields are present, and avoid arithmetic or string formatting that assumes a number or URL exists.
For example, to render a one-based line for a person while retaining Puppeteer’s original value for diagnostics:
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
page.on('console', msg => {
const location = msg.location();
const displayLine = location.lineNumber === undefined
? 'unknown'
: location.lineNumber + 1;
console.log({
url: location.url ?? 'unknown',
puppeteerLine: location.lineNumber,
displayLine,
columnNumber: location.columnNumber
});
});
This conversion changes only the displayed line. Do not label a converted number as Puppeteer’s raw coordinate.
When to use location() versus stackTrace()
location() gives one primary source-location object. If that position is not enough to trace the message, use msg.stackTrace(), which is a separate method returning an array of locations on the message’s stack. The ConsoleMessage reference documents both methods; use the location object for a concise source reference and the stack array when you need additional stack locations.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #3
What the console event captures
Puppeteer documents the Page console event for JavaScript console API calls such as console.log and console.dir; it is also emitted when the page throws an error or warning. Its payload is a ConsoleMessage. The event documentation is in the project’s PageEvent reference.
Version context
The live ConsoleMessage class reference displayed Puppeteer 25.12.0, while the ConsoleMessageLocation interface reference displayed documentation version 25.3.0. The documented optional fields and zero-based coordinate convention are consistent, but check the API reference and types for the Puppeteer version installed in your project, particularly if its version differs from those displayed documentation versions.
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
Or skip the browser setup
If your goal is a clean visual capture rather than tracing a JavaScript console message, ScreenshotNeo can return a screenshot or PDF from one GET request. It does not replace Puppeteer’s console-location API: use Puppeteer to inspect message coordinates. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before a capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
cURL example, with the request options documented at ScreenshotNeo docs:
Free tools Windows power users keep installed
One-click scans. No signup required.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Quick Recap
Best Value
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.




