You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Coverage gathers information about parts of JavaScript and CSS that were used by the page.
An example of using JavaScript and CSS coverage to get percentage of initially executed code:
// Enable both JavaScript and CSS coverageawaitPromise.all([page.coverage.startJSCoverage(),page.coverage.startCSSCoverage()]);// Navigate to pageawaitpage.goto('https://example.com');// Disable both JavaScript and CSS coverageconst[jsCoverage,cssCoverage]=awaitPromise.all([page.coverage.stopJSCoverage(),page.coverage.stopCSSCoverage(),]);lettotalBytes=0;letusedBytes=0;constcoverage=[...jsCoverage, ...cssCoverage];for(constentryofcoverage){totalBytes+=entry.text.length;for(constrangeofentry.ranges)usedBytes+=range.end-range.start-1;}console.log(`Bytes used: ${usedBytes/totalBytes*100}%`);
The text was updated successfully, but these errors were encountered:
https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#class-coverage
Coverage gathers information about parts of JavaScript and CSS that were used by the page.
An example of using JavaScript and CSS coverage to get percentage of initially executed code:
The text was updated successfully, but these errors were encountered: