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 LaunchApp

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

Template:Implementation Page

Overview

LaunchApp provides a utility function for launching browser-based applications in app mode, primarily used for Playwright's built-in UI tools like the trace viewer and code generator.

Description

The launchApp function launches a persistent browser context configured for app-mode usage. For Chromium, it uses the --app flag and configures window size/position. It auto-detects the best Chromium channel when no explicit channel or executable path is provided. The function handles error cases gracefully, including situations where no browsers are installed, and provides setup for page-level interactions.

Usage

Used internally by Playwright CLI tools to open UI applications like the Trace Viewer.

Code Reference

Source Location

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

Function Signature

export async function launchApp(browserType: BrowserType, options: {
  sdkLanguage: string;
  windowSize: types.Size;
  windowPosition?: types.Point;
  persistentContextOptions?: Parameters<BrowserType['launchPersistentContext']>[2];
}): Promise<{ context: BrowserContext; page: Page }>

Import

import { launchApp } from './server/launchApp';

I/O Contract

Inputs

  • browserType: BrowserType -- the browser type to launch (typically Chromium)
  • options.sdkLanguage: string -- SDK language for channel detection
  • options.windowSize: Size -- desired window dimensions
  • options.windowPosition: Point -- optional window position
  • options.persistentContextOptions -- additional context launch options

Outputs

  • Returns an object with context and page for the launched application
  • Throws descriptive errors if browser launch fails

Related Pages

Page Connections

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