BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Browser-Automation Library Puppeteer Now Supports Firefox

Browser-Automation Library Puppeteer Now Supports Firefox

This item in japanese

Mathias Bynens, Google developer working on ChromeDevTools and v8, released Puppeteer 3.0. Puppeteer now supports Firefox in addition to the Chrome browser. The new version also upgraded support to the latest Chrome 81, and removed support for Node 8.

Puppeteer is a browser test automation Node.js library that provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. As such, new versions of Puppeteer are often linked to new versions of the Chrome browser and the deprecation of old Node.js versions. This is also the case in this release. While Puppeteer 2.0 supported Chrome 79 and deprecated Node 6, Puppeteer 3.0 supports the latest Chrome browser (Chrome 81) and no longer supports Node 8.

Puppeteer 3.0, however, additionally supports Firefox, a move that is poised to increase its usage for cross-browser testing purposes. Google announced in passing a first effort (code-named puppeteer-firefox) to support Mozilla’s browser at Google I/O ’19 in the Modern Web Testing and Automation with Puppeteer (Google I/O ’19) talk by Andrey Lushnikov and Joel Einbinder. Both developers have since moved to Microsoft working on Playwright, a concurrent cross-browser automation Node.js library which supports all major browser engines (Chromium, WebKit and Firefox) in a single API. Playwright nears the release its first major version with 99% of tests passing (in v0.13).

With Firefox support transitioning to the puppeteer package, the puppeteer-firefox package has been deprecated. Puppeteer can now fetch a Firefox Nightly binary. Bynens links to an example of Firefox automation with Puppeteer, whose excerpt is as follows:

To have Puppeteer fetch a Firefox binary for you, first run:
> PUPPETEER_PRODUCT=firefox npm install

To get additional logging about which browser binary is executed, run this example as:
> DEBUG=puppeteer:launcher NODE_PATH=../ node examples/cross-browser.js

- You can set a custom binary with the `executablePath` launcher option.

Bynens also mentions that improvements in the reliability of file uploads, switching to Mocha over the previous custom test runner framework, and the migration of the source code to TypeScript. Of the latter, Bynens comments:

Although this doesn’t affect the way developers can consume Puppeteer, it improves the quality of the Puppeteer type definitions which can be used by modern editors.

Developers have reacted enthusiastically on Twitter. A developer enquired:

Awesome! Is there also a way to install Firefox if puppeteer is a dependency of another package published on npm, such that npm install foo automatically installs puppeteer + matching Firefox?

Bynens answered that the requested feature would be implemented once Firefox support is no longer experimental.

More coverage on the testing ecosystem is available in the JavaScript and Web Development InfoQ Trends Report. Puppeteer is open-source software available under the Apache 2.0 license. Contributions are welcome and must respect the Puppeteer contribution guidelines.

Rate this Article

Adoption
Style

BT