mardi 19 janvier 2021

How to run puppeteer tests using Firefox?

My puppeteer version is 5.5.0

All the tests are running fine with chrome.

Here is the function I am using to launch the instance.

    async ensure_browser() {
        if (this.browser === null) {
            const {window_size} = this;
            this.browser = await puppeteer.launch({
                product: 'firefox',
                args: [
                    `--window-size=${window_size.width},${window_size.height}`,
                    "--no-sandbox",
                    "--disable-setuid-sandbox",
                ],
                defaultViewport: {width: 1280, height: 1024},
                headless: true,
            });
        }
    }

I have ran
PUPPETEER_PRODUCT=firefox yarn install and
PUPPETEER_PRODUCT=firefox yarn add puppeteer

but it still shows this error,

(node:122450) UnhandledPromiseRejectionWarning: Error: Could not find browser revision latest. Run "PUPPETEER_PRODUCT=firefox npm install" or "PUPPETEER_PRODUCT=firefox yarn install" to download a supported Firefox browser binary.

Aucun commentaire:

Enregistrer un commentaire