If no Page.Request event handler is specified, await page.SetRequestInterceptionAsync(true) causes the browser to hang
See original GitHub issueDescription
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:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 😃
Compiler warning would be nice at least. Node is a constant pain, that’s why we use C# over here