Puppeteer is it only used with chrome browser ? what about the others ?
Puppeteer is it only used with chrome browser ? what about the others ?
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.
Microsoft Edge is built upon Chromium so it's supported too.
As iamdlm pointed Firefox is also available in puppeteer.
If you are looking for a similar browser automation API that supports more than puppeteer there is also Playwright from Microsoft.
The core API matches puppeteer's in 90% and there are more browser testing targeted methods additionally. The reason they are this similar: it is written by the ex-puppeteer team (after they moved to Microsoft from Google).
It supports:
Their Firefox and Webkit use so-called "jugglers" - patched binaries of the original browsers. (Puppeteer's Firefox implementation is different, it is communicating to a real Firefox Nightly binary)
Example of browser usage in Playwright:
// @ts-check
const playwright = require('playwright');
(async () => {
// Try to add 'firefox' to the list ↓
for (const browserType of ['chromium', 'webkit']) {
/** @type {import('playwright').Browser} */
const browser = await playwright[browserType].launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: `example-${browserType}.png` });
await browser.close();
}
})();