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:Puppeteer Puppeteer LaunchOptions

From Leeroopedia
Revision as of 11:46, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Puppeteer_Puppeteer_LaunchOptions.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Property Value
sources packages/puppeteer-core/src/node/LaunchOptions.ts
domains Node, Configuration, Launch
last_updated 2026-02-12 00:00 GMT

Overview

Description

The LaunchOptions module defines the TypeScript interfaces and types that configure browser launching in Puppeteer. It contains the LaunchOptions interface (the primary configuration object passed to puppeteer.launch()), the ChromeReleaseChannel type re-export, and a helper function convertPuppeteerChannelToBrowsersChannel that maps Puppeteer's channel names to the @puppeteer/browsers library's channel enum values.

The LaunchOptions interface extends ConnectOptions and provides properties for:

  • Browser selection -- browser (chrome or firefox), channel (chrome, chrome-dev, chrome-beta, chrome-canary), and executablePath.
  • Process control -- handleSIGINT, handleSIGTERM, handleSIGHUP, signal (AbortSignal), and dumpio.
  • Startup behavior -- timeout, waitForInitialPage, headless (true, false, or 'shell'), and devtools.
  • Browser configuration -- args, env, userDataDir, pipe, debuggingPort, ignoreDefaultArgs, enableExtensions, and extraPrefsFirefox.

Usage

LaunchOptions is the type for the options parameter of puppeteer.launch(). All properties are optional with sensible defaults applied by BrowserLauncher.

Code Reference

Source Location

packages/puppeteer-core/src/node/LaunchOptions.ts

Signature

export type ChromeReleaseChannel = 'chrome' | 'chrome-dev' | 'chrome-beta' | 'chrome-canary';

export function convertPuppeteerChannelToBrowsersChannel(
  channel: ChromeReleaseChannel,
): BrowsersChromeReleaseChannel;

export interface LaunchOptions extends ConnectOptions {
  channel?: ChromeReleaseChannel;
  executablePath?: string;
  ignoreDefaultArgs?: boolean | string[];
  enableExtensions?: boolean | string[];
  handleSIGINT?: boolean;
  handleSIGTERM?: boolean;
  handleSIGHUP?: boolean;
  timeout?: number;
  dumpio?: boolean;
  env?: Record<string, string | undefined>;
  pipe?: boolean;
  browser?: SupportedBrowser;
  extraPrefsFirefox?: Record<string, unknown>;
  waitForInitialPage?: boolean;
  headless?: boolean | 'shell';
  userDataDir?: string;
  devtools?: boolean;
  debuggingPort?: number;
  args?: string[];
  signal?: AbortSignal;
}

Import

import type {LaunchOptions, ChromeReleaseChannel} from '../node/LaunchOptions.js';

I/O Contract

Property Type Default Description
channel ChromeReleaseChannel -- Chrome release channel to use
executablePath string -- Custom browser executable path
ignoreDefaultArgs string[] false Skip or filter default browser arguments
enableExtensions string[] -- Enable extensions or load specific extension paths
handleSIGINT boolean true Close browser on Ctrl+C
handleSIGTERM boolean true Close browser on SIGTERM
handleSIGHUP boolean true Close browser on SIGHUP
timeout number 30000 Browser startup timeout in ms
dumpio boolean false Pipe browser stdout/stderr to process
env undefined> process.env Environment variables for the browser
pipe boolean false Use pipe connection instead of WebSocket
browser SupportedBrowser 'chrome' Which browser to launch
headless 'shell' true Headless mode configuration
userDataDir string -- Custom user data directory
devtools boolean false Auto-open DevTools (forces headless: false)
args string[] -- Additional command line arguments
signal AbortSignal -- Signal to abort and close the browser
Function Input Output Description
convertPuppeteerChannelToBrowsersChannel ChromeReleaseChannel BrowsersChromeReleaseChannel Maps Puppeteer channel names to @puppeteer/browsers enum values

Usage Examples

import puppeteer from 'puppeteer';

// Launch with various options
const browser = await puppeteer.launch({
  headless: true,
  browser: 'chrome',
  channel: 'chrome-canary',
  timeout: 60000,
  args: ['--no-sandbox', '--disable-setuid-sandbox'],
  handleSIGINT: true,
  dumpio: false,
});
// Launch with a custom executable and user data directory
const browser = await puppeteer.launch({
  executablePath: '/usr/bin/google-chrome',
  userDataDir: '/tmp/my-chrome-profile',
  headless: 'shell',
});

Related Pages

Page Connections

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