Skip to Content
Puppeteer + Firefox Setup

How to Use Puppeteer with Firefox

Puppeteer was built for Chrome, but foxbridge lets you use it with Firefox — including anti-detect browsers like Camoufox. This guide walks through the complete setup.

Why Use Puppeteer with Firefox?

Chrome is the default for browser automation, but it has critical limitations for AI agents and web scraping:

  • Bot detection: Chrome is trivially detectable by anti-bot systems. Sites like Cloudflare, DataDome, and PerimeterX fingerprint Chrome’s automation markers.
  • No anti-detect: Chrome doesn’t support per-context fingerprint spoofing. Every tab looks identical.
  • Memory: Chrome uses 50-80MB per context vs Firefox’s 10-15MB.

Foxbridge solves this by translating CDP (Chrome DevTools Protocol) to Firefox’s native Juggler or WebDriver BiDi protocols. Puppeteer connects to foxbridge thinking it’s Chrome, but the actual browsing happens in Firefox.

Prerequisites

  • Go 1.21+ — foxbridge is written in Go
  • Firefox or Camoufox — the browser foxbridge will control
  • Node.js 18+ — for Puppeteer

Step 1: Install Foxbridge

go install github.com/VulpineOS/foxbridge/cmd/foxbridge@latest

Step 2: Start Foxbridge with Firefox

foxbridge --binary /path/to/camoufox --port 9222 --headless

With standard Firefox (via BiDi backend)

foxbridge --backend bidi --binary /path/to/firefox --port 9222 --bidi-port 9224 --headless

Step 3: Connect Puppeteer

const puppeteer = require('puppeteer-core'); const browser = await puppeteer.connect({ browserWSEndpoint: 'ws://127.0.0.1:9222/devtools/browser/foxbridge', defaultViewport: null, }); const page = await browser.newPage(); await page.goto('https://example.com'); console.log(await page.title()); // "Example Domain" // Screenshots work await page.screenshot({ path: 'screenshot.png' }); // $eval works const heading = await page.$eval('h1', el => el.textContent); console.log(heading); // "Example Domain" // Request interception works await page.setRequestInterception(true); page.on('request', req => { if (req.url().includes('analytics')) req.abort(); else req.continue(); }); await browser.disconnect();

What Works

Foxbridge passes 74/74 Puppeteer tests on Camoufox (Juggler backend) and 62/62 tests on Firefox (BiDi backend). This includes:

  • Navigation (goto, reload, goBack, goForward)
  • Screenshots (viewport and full-page)
  • PDF generation with IO streaming
  • $eval, $$eval, evaluate, evaluateHandle
  • Request interception (block, modify, fulfill)
  • Cookies (set, get, delete, per-context isolation)
  • Device emulation (viewport, user agent, geolocation, timezone)
  • Mouse, keyboard, and touch input
  • Multiple browser contexts with isolated state

Foxbridge vs Playwright for Firefox

Playwright also supports Firefox, but via its own custom Juggler fork. Key differences:

FoxbridgePlaywright
ProtocolCDP (standard)Playwright protocol (proprietary)
Camoufox supportFullNo
Anti-detect fingerprintsPer-context via BrowserForgeNo
Puppeteer compatibleYesNo
OpenClaw compatibleYesNo

Next Steps

Once Puppeteer is connected, you can use the full Puppeteer API — no modifications needed. For production use with AI agents, consider VulpineOS  which embeds foxbridge and manages hundreds of agents on a single Camoufox instance.


See also

Last updated on