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 Server Playwright

From Leeroopedia
Revision as of 11:38, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Microsoft_Playwright_Server_Playwright.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Implementation Page

Overview

Server Playwright is the root server-side object that creates and holds references to all browser type instances (Chromium, Firefox, WebKit), the Android and Electron drivers, and the debug controller.

Description

The Playwright class extends SdkObject and serves as the top-level entry point for the server side of Playwright. It instantiates all supported browser types (Chromium, Firefox, WebKit), as well as Electron and Android drivers. It tracks all open browsers and pages through instrumentation listeners, and provides methods to enumerate them.

The factory function createPlaywright creates new instances with specified options including SDK language and server mode flags.

Usage

Created once per Playwright server instance. All browser launches originate from this object's browser type properties.

Code Reference

Source Location

packages/playwright-core/src/server/playwright.ts (79 lines)

Class Signature

export class Playwright extends SdkObject {
  readonly chromium: BrowserType;
  readonly firefox: BrowserType;
  readonly webkit: BrowserType;
  readonly android: Android;
  readonly electron: Electron;
  readonly options: PlaywrightOptions;
  readonly debugController: DebugController;
  constructor(options: PlaywrightOptions)
  allBrowsers(): Browser[]
  allPages(): Page[]
}

export function createPlaywright(options: PlaywrightOptions): Playwright

Import

import { Playwright, createPlaywright } from './server/playwright';

I/O Contract

Inputs

  • options.sdkLanguage: Language -- the client SDK language
  • options.isInternalPlaywright?: boolean -- whether this is an internal instance
  • options.isServer?: boolean -- whether running in server mode

Outputs

  • Browser type instances for Chromium, Firefox, WebKit
  • Android and Electron driver instances
  • Debug controller for inspector integration

Related Pages

Page Connections

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