question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

startCoverage never finish when request interception is enabled

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.18.1
  • Platform / OS version: macOS Mojave 10.14.5
  • URLs (if applicable):
  • Node.js version: v10.15.3

What steps will reproduce the problem?

Please include code that reproduces the issue.

// run.js
const puppeteer = require("puppeteer");

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setRequestInterception(true);
  page.on("request", request => {
    request.continue();
  });

  console.log("run startCoverage");
  await page.coverage.startJSCoverage();
  await page.coverage.startCSSCoverage();
  console.log("finished startCoverage");

  await page.goto("https://google.com");
  console.log(await page.title());

  const coverage = [
    ...(await page.coverage.stopJSCoverage()),
    ...(await page.coverage.stopCSSCoverage())
  ];
  console.log("coverage", coverage);

  await browser.close();
})();
  1. node run.js

Above example code is pushed to the following repository: https://github.com/pirosikick/puppeteer-collect-coverage-with-request-initerception

What is the expected result? The script displays logs and outputs coverage informations the script collected.

What happens instead? startCSSCoverage didn’t finish.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:5

github_iconTop GitHub Comments

2reactions
ryhincheycommented, Jan 22, 2020

@zhujun24 I was able to reproduce this. Funny enough moving await page.setRequestInterception(true); to below the start coverage calls gets puppeteer to successfully run.

await page.coverage.startJSCoverage();
await page.coverage.startCSSCoverage();

await page.setRequestInterception(true);

Here’s a fork of your example code that will run: https://github.com/ryhinchey/puppeteer-collect-coverage-with-request-initerception/blob/master/run.js#L16

0reactions
stale[bot]commented, Jul 24, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Interception - Puppeteer
Once request interception is enabled, every request will stall unless it's continued, responded or aborted. An example of a naïve request interceptor that ......
Read more >
BadgerCare Plus Handbook Release 15-02
1.1.1 Organization of the BadgerCare Plus Handbook. This handbook outlines eligibility policy for Wisconsin's BadgerCare Plus program. This.
Read more >
Consent Calendar Item No. 1 September Financials
NOTICE IS HEREBY GIVEN that on October 27, 2021, commencing no earlier than 11:30 a.m., via. GoToWebinar, the Governing Board of the Tahoe ......
Read more >
Chapter 388-14A WAC: - WA.gov
"Agreed settlement" is an administrative order that reflects the agreement of the noncustodial parent, the custodial parent and the division of child support....
Read more >
Digital Insurance Virtual Event | November 2020
Use live chat and virtual Q&As to benchmark and connect with peers to beat challenges together. You can be an active participant -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found