Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Playwright FfBrowser

From Leeroopedia
Knowledge Sources
Domains Browser Automation, Firefox Engine
Last Updated 2026-02-12 00:00 GMT

Overview

Concrete tool for Firefox browser management via the Juggler protocol provided by the Playwright library.

Description

The `FFBrowser` class extends the abstract `Browser` base class to implement Firefox-specific browser management using the custom Juggler protocol (Playwright's Firefox automation protocol). It manages an `FFConnection` for protocol communication, maintains maps of browser contexts (`FFBrowserContext`) and pages (`FFPage`), and handles Firefox-specific features including user preferences (with bandaid prefs for known issues), target discovery, cookie management, permission handling, and download management. The `FFBrowserContext` inner class implements context-specific operations for geolocation, offline mode, HTTP credentials, and extra HTTP headers via the Juggler `Browser.` domain commands.

Usage

Use this class as the Firefox-specific browser implementation for Juggler protocol-based automation. It is instantiated by the Firefox browser type class when launching or connecting to a Firefox browser.

Code Reference

Source Location

Signature

export class FFBrowser extends Browser {
  private _connection: FFConnection;
  readonly session: FFSession;
  readonly _ffPages: Map<string, FFPage>;
  readonly _contexts: Map<string, FFBrowserContext>;

  static async connect(parent: SdkObject, transport: ConnectionTransport, options: BrowserOptions): Promise<FFBrowser>;
  constructor(parent: SdkObject, connection: FFConnection, options: BrowserOptions);
}

export class FFBrowserContext extends BrowserContext {
  readonly _browser: FFBrowser;
  readonly _browserContextId: string | undefined;
}

Import

import { FFBrowser, FFBrowserContext } from '../server/firefox/ffBrowser';

I/O Contract

Inputs

Name Type Required Description
parent SdkObject Yes Parent SDK object for instrumentation
transport ConnectionTransport Yes Transport connection to the Firefox process
options BrowserOptions Yes Browser launch options including persistent context and user preferences

Outputs

Name Type Description
FFBrowser FFBrowser Connected Firefox browser instance
FFBrowserContext FFBrowserContext Isolated Firefox browser context
FFPage FFPage Firefox page within a context

Usage Examples

import { FFBrowser } from 'playwright-core/lib/server/firefox/ffBrowser';

const browser = await FFBrowser.connect(parent, wsTransport, {
  persistent: undefined,
  headful: false,
  firefoxUserPrefs: { 'dom.disable_open_during_load': true },
});

const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com');

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment