puppeteer: Firefox: page.setRequestInterception throws protocol error.
Steps to reproduce
Using
await page.setRequestInterception(true)
throws the following error
Protocol error (Fetch.enable): Fetch.enable RemoteAgentError@chrome://remote/content/Error.jsm:25:5
UnknownMethodError@chrome://remote/content/Error.jsm:108:7
execute@chrome://remote/content/domains/DomainCache.jsm:96:13
Use Case
Right now, cookies don’t work correctly in puppeteer due to missing headers https://github.com/puppeteer/puppeteer/issues/4918, so it’s impossible to test an application that uses authentication. In order to make it work, I tried using this hack https://github.com/puppeteer/puppeteer/issues/4918#issuecomment-663478790 and it worked in Chrome but doesn’t work in firefox.
Tell us about your environment:
- Puppeteer version: 5.2.1
- Platform / OS version: Linux
- URLs (if applicable):
- Node.js version: 12.16.2
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 15 (2 by maintainers)
@stale please leave it as confirmed. It’s being tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1587857
EDIT: should I make a bot that adds a comment here every 29 days ?
CDP is not a cross-browser protocol and our support in Firefox was always experimental. We are actually going to deprecate it over the next months because WebDriver BiDi is in a much better shape right now. You can already use WebDriver BiDi with Puppeteer.
We are not going to implement network request interception for the CDP protocol in Firefox, but will work on it soon for the WebDriver BiDi backend.
I’ve tried playwright with firefox using Network: https://playwright.dev/docs/network#handle-requests and it worked perfectly, I’m wondering what playwright has done with firefox. According to their docs: https://playwright.dev/docs/browsers, seems that they compiled customized browser binaries to operate with playwright, and I’ve tried puppeteer firefox using playwright firefox binary and it did not work. I’m wondering if anyone could investigate what playwright has done with firefox to support this feature?
The protocol implementation in Firefox doesn’t include
Fetch.enable
yet. The tracking bug is https://bugzilla.mozilla.org/show_bug.cgi?id=1587857Similarly, the workaround you’re trying depends on
Network.responseReceivedExtraInfo
, which also not yet implemented in Firefox.Feel free to get in touch about your use case; it can help us prioritize.