Implementation:Microsoft Playwright FfPage
| Knowledge Sources | |
|---|---|
| Domains | Page Automation, Firefox Engine |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Concrete tool for Firefox page-level automation via the Juggler protocol provided by the Playwright library.
Description
The `FFPage` class implements the `PageDelegate` interface for Firefox browsers using the Juggler protocol. It manages page lifecycle including frame execution contexts (via `FFExecutionContext`), input dispatching (mouse, keyboard, touchscreen via Firefox-specific raw implementations), network management (via `FFNetworkManager`), dialog handling, worker management, and init script injection. The class handles the `cspErrorsAsynchronousForInlineScripts` quirk specific to Firefox where CSP errors are dispatched asynchronously for inline scripts. It maps context IDs to `FrameExecutionContext` instances and maintains a utility world (`__playwright_utility_world__`) for isolated script execution.
Usage
Use this class as the Juggler protocol backend for page operations in Firefox. It is created by `FFBrowserContext` when a new page is opened and provides the bridge between Playwright's abstract page model and the Juggler protocol commands.
Code Reference
Source Location
- Repository: Microsoft_Playwright
- File: packages/playwright-core/src/server/firefox/ffPage.ts
Signature
export class FFPage implements PageDelegate {
readonly cspErrorsAsynchronousForInlineScripts: true;
readonly rawMouse: RawMouseImpl;
readonly rawKeyboard: RawKeyboardImpl;
readonly rawTouchscreen: RawTouchscreenImpl;
readonly _session: FFSession;
readonly _page: Page;
readonly _networkManager: FFNetworkManager;
readonly _browserContext: FFBrowserContext;
readonly _opener: FFPage | null;
constructor(session: FFSession, browserContext: FFBrowserContext, opener: FFPage | null);
}
Import
import { FFPage } from '../server/firefox/ffPage';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| session | FFSession | Yes | Juggler session for protocol communication |
| browserContext | FFBrowserContext | Yes | Browser context this page belongs to |
| opener | FFPage or null | Yes | The page that opened this page, if any |
Outputs
| Name | Type | Description |
|---|---|---|
| _page | Page | The Playwright Page instance backed by this delegate |
| screenshots | Buffer | Screenshot data captured via Juggler |
Usage Examples
// Created internally by FFBrowser when a page target is discovered
const ffPage = new FFPage(ffSession, browserContext, openerPage);
// Used via the Page abstraction
const page = ffPage._page;
await page.goto('https://example.com');
await page.screenshot({ path: 'firefox-screenshot.png' });