Michał Schielmann
Michał Schielmann

Reputation: 1382

setRequestInterception support for Firefox in Puppeteer

Does setRequestInterception work for Firefox on Puppeteer?

In my tests, whenever launching with Firefox, I do get:

Protocol error (Fetch.enable): Fetch.enable RemoteAgentError@chrome://remote/content/Error.jsm:25:5

on await page.setRequestInterception(true);

I know that currently Firefox is in experimental mode for Puppeteer. So I expect this feature may not be supported. Is there any other way that I could handle requests (like alter requests, mock responses) when running on Firefox?

This is how I launch the browser (I can see Firefox window, and all other tests pass):

browser = await puppeteer.launch({
  product: "firefox", 
  headless: false,
  slowMo: 50,
});

Upvotes: 1

Views: 1490

Answers (1)

Akhil Mordia
Akhil Mordia

Reputation: 142

Puppeteer for Firefox does not support setRequestInterception yet. You can keep a track of passing tests at https://puppeteer.github.io/ispuppeteerfirefoxready/

Here is how we launch firefox:

During installation, choose Puppeteer version ^3.0.0

PUPPETEER_PRODUCT=firefox npm install

Options:

puppeteerOptions: {
        args: args,
        //ignoreDefaultArgs: ['--enable-automation'],
        headless: false,
        //slowMo: 17,
        //executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
        executablePath: './node_modules/puppeteer/.local-firefox/mac-79.0a1/Firefox Nightly.app/Contents/MacOS/firefox'
    },

Upvotes: 2

Related Questions