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.

If no Page.Request event handler is specified, await page.SetRequestInterceptionAsync(true) causes the browser to hang

See original GitHub issue

Description

If no Page.Request += event handler is specified, await page.SetRequestInterceptionAsync(true); causes the browser to hang

Complete minimal example reproducing the issue

    public static async Task Do()
    {
        await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
        var browser = await Puppeteer.LaunchAsync(new LaunchOptions
        {
            Headless = false,
        });
        var page = (await browser.PagesAsync()).First();
        await page.SetRequestInterceptionAsync(true);
        await page.GoToAsync("https://www.google.com/");
    }

Expected behavior:

I would assume it shouldn’t hang just because there is no event handler defined

Actual behavior:

It hangs

Versions

  • Which version of PuppeteerSharp are you using? 2.0.4
  • Which .NET runtime and version are you targeting? 4.8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
KoalaBear84commented, Dec 14, 2020

Well, I did also went down this rabbit hole and was lost for maybe an hour why it didn’t work anymore 😃

I wouldn’t mind that it throws and exception when SetRequestInterceptionAsync is set but no event handler is set. But maybe that could break something indeed. Just wanted to let you know that you are not alone 😃

1reaction
d668commented, Dec 9, 2020

Compiler warning would be nice at least. Node is a constant pain, that’s why we use C# over here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use PuppeteerSharp.Page.SetCacheEnabledAsync in ...
Use the SetCacheEnabledAsync method in PuppeteerSharp package in your next Puppeteer-sharp project with LambdaTest Automation Testing Advisor.
Read more >
Request Interception
Puppeteer requires request.continue() to be called explicitly or the request will hang. Even if your handler means to take no special action, or...
Read more >
Puppeteer-sharp: page is crashed from browser. ...
I am using example code from Puppeteer-sharp but faced timeout error when calling browser.NewPageAsync() . Then I turned on Devtools and saw the ......
Read more >
puppeteer-sharp
trying to run Puppeteer synchronously as I need the results of the 'scraped' page so await is a pain (and happy to wait...
Read more >
Api Documentation PuppeteerSharp
If request gets a 'redirect' response, the request is successfully finished with the RequestFinished event, and a new request is issued to a...
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