Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesStart JavaScript coverage before the page activity you want to measure, then stop it to retrieve script entries and their executed ranges. In Puppeteer, use page.coverage.startJSCoverage() and page.coverage.stopJSCoverage(). For coverage across documents, stop and restart around navigation; setting resetOnNavigation: false does not guarantee Chrome will retain the previous document’s data.
How to get JavaScript coverage in Puppeteer
The Coverage object belongs to a Puppeteer Page. Start collection before navigation or interactions, perform the work being measured, and stop collection to receive an array of JavaScript entries.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.coverage.startJSCoverage({
resetOnNavigation: true,
reportAnonymousScripts: false,
includeRawScriptCoverage: false,
useBlockCoverage: true,
});
await page.goto('https://example.com');
// Perform the interactions whose execution should be included.
const entries = await page.coverage.stopJSCoverage();
console.log(`Collected coverage for ${entries.length} scripts`);
// Process entries or pass them to an Istanbul conversion tool.
} finally {
await browser.close();
}
The four explicit values above are the documented defaults in Puppeteer’s 25.10.0 startJSCoverage() reference. A minimal setup can omit the options object:
await page.coverage.startJSCoverage();
await page.goto('https://example.com');
const entries = await page.coverage.stopJSCoverage();
Use a try/finally around browser work so the browser is closed even if navigation or processing throws. The measurement window is defined by the start and stop calls: actions that happen before starting or after stopping are not part of that collection.
#1 Best Overall
What the JavaScript coverage options do
Puppeteer’s 25.12.0 JSCoverageOptions reference documents these four options:
| Option | Default | Effect |
|---|---|---|
useBlockCoverage |
true |
Collect block-level coverage. Set to false for function-level collection. |
reportAnonymousScripts |
false |
Include dynamically created scripts that do not have a URL. |
includeRawScriptCoverage |
false |
Include raw V8 script coverage entries in each result where available. |
resetOnNavigation |
true |
Reset coverage on navigation. It does not guarantee that the previous document’s data can be preserved by changing it to false. |
Block-level or function-level data
Block coverage is the default and gives finer-grained execution information. Choose useBlockCoverage: false when function-level reporting is sufficient for your analysis.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Anonymous and dynamically generated scripts
Scripts created with eval or new Function may not have a URL and are omitted by default. Set reportAnonymousScripts: true if those scripts matter to the measurement. Such entries generally have URLs beginning with debugger://VM; a script that supplies a //# sourceURL comment can instead be reported under that source URL. See the method reference.
Raw V8 coverage
Leave includeRawScriptCoverage off unless downstream processing needs the raw V8 protocol data. When enabled, an entry can include rawScriptCoverage, typed as the V8 protocol script coverage object. The returned entry shape is described in Puppeteer’s 25.5.0 JSCoverageEntry reference.
Recommended Free Tools
Rank #3
Why coverage can be empty after navigation
Start collection before navigation if the goal is to include scripts executed while the document loads. Starting after page.goto() excludes that earlier execution.
Do not rely on resetOnNavigation: false to preserve coverage from a document you leave. Puppeteer’s current options reference warns that Chrome may discard the previous page’s JavaScript execution environment and coverage data on navigation. To collect across documents, stop before leaving each document, start a fresh collection on the next one, and merge the resulting reports in your own processing pipeline.
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
await page.coverage.startJSCoverage();
await page.goto('https://example.com/first');
const firstPageEntries = await page.coverage.stopJSCoverage();
await page.coverage.startJSCoverage();
await page.goto('https://example.com/second');
const secondPageEntries = await page.coverage.stopJSCoverage();
const allEntries = [...firstPageEntries, ...secondPageEntries];
This example combines the returned arrays; it does not itself deduplicate scripts or create an Istanbul report. The navigation caveat and recommended stop/restart approach are documented in the options reference.
How to read, measure, and export the result
Each result represents a script and carries coverage ranges. The Coverage class reference, version 25.9.0, demonstrates a byte-based calculation: sum each script’s text length and the lengths of its used ranges, then divide used bytes by total bytes. This is one possible metric, not a universal definition of test coverage; choose the measure that matches what you need to assess.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
For an Istanbul-compatible report, Puppeteer points to the separate puppeteer-to-istanbul package. Coverage collection alone returns Puppeteer entries; it does not automatically produce Istanbul’s report format.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting common coverage problems
- No entries or missing page-load execution: Ensure
startJSCoverage()runs beforepage.goto()or other activity being measured. - Anonymous scripts are missing: Enable
reportAnonymousScripts: truefor scripts such asevalornew Functionthat have no URL. - Coverage disappears after navigation: Do not assume
resetOnNavigation: falsepreserves the prior document. Stop collection before navigating, start it again on the next document, and merge the entries. - The report granularity is too coarse: Keep
useBlockCoverage: truefor block-level data;falsechanges collection to function-level. - The processor needs V8 protocol details: Enable
includeRawScriptCoverageand check the entry’srawScriptCoveragefield. - The output is not in Istanbul format: Convert Puppeteer’s entries with the separate
puppeteer-to-istanbulpackage.
The option defaults cited here come from Puppeteer’s references labelled versions 25.10.0 and 25.12.0; related API pages are labelled 25.5.0 and 25.9.0. Check the documentation and types for the Puppeteer version installed in your project before relying on version-specific behavior.
Or skip the browser setup
If you need a rendered screenshot rather than execution coverage, ScreenshotNeo returns a screenshot or PDF from one GET request. For example, using cURL:
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 API documentation for request options. It accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; these steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers indicate the page verdict and billing status. Its MCP server provides screenshot and PDF tools for AI agents. The Free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
Quick Recap
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.




