Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Puppeteer Puppeteer PuppeteerNode Launch

From Leeroopedia
Knowledge Sources
Domains Browser_Automation, Node_JS
Last Updated 2026-02-11 23:00 GMT

Overview

Concrete tool for launching browser processes and returning connected Browser instances, provided by the puppeteer-core library.

Description

The PuppeteerNode.launch() method is the primary entry point for starting browser automation. It accepts a LaunchOptions configuration object and dispatches to the appropriate browser-specific launcher (ChromeLauncher or FirefoxLauncher). The launcher resolves the executable path, constructs CLI arguments, spawns the browser process, and establishes a protocol connection (CDP or WebDriver BiDi).

The method is defined on the PuppeteerNode class, which extends the base Puppeteer class with Node.js-specific capabilities (process spawning, file system access).

Usage

Import and call this method at the start of any Puppeteer automation script. Use it when you need to start a new browser process. For connecting to an already-running browser, use puppeteer.connect() instead.

Code Reference

Source Location

  • Repository: puppeteer
  • File: packages/puppeteer-core/src/node/PuppeteerNode.ts
  • Lines: 150-164

Signature

class PuppeteerNode {
  launch(options: LaunchOptions = {}): Promise<Browser>
}

Import

import puppeteer from 'puppeteer';
// or for puppeteer-core:
import puppeteer from 'puppeteer-core';

I/O Contract

Inputs

Name Type Required Description
options LaunchOptions No Configuration object for browser launch
options.headless 'shell' No Run browser in headless mode (default: true)
options.args string[] No Additional CLI arguments for the browser process
options.executablePath string No Path to a custom browser executable
options.browser 'firefox' No Which browser to launch (default: 'chrome')
options.protocol 'webDriverBiDi' No Communication protocol (Chrome defaults to CDP, Firefox defaults to BiDi)
options.userDataDir string No Path to a user data directory for persistent state
options.dumpio boolean No Pipe browser process stdout and stderr to Node.js process
options.timeout number No Maximum time in ms to wait for browser to start (default: 30000)

Outputs

Name Type Description
return Promise<Browser> A Browser instance connected to the launched browser process

Usage Examples

Basic Headless Launch

const puppeteer = require('puppeteer');

const browser = await puppeteer.launch();
// Browser is now running in headless mode
const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();

Launch With Custom Options

const puppeteer = require('puppeteer');

const browser = await puppeteer.launch({
  headless: false,          // Show browser window
  args: ['--window-size=1920,1080'],
  dumpio: true,             // See browser console output
});

Launch Firefox With WebDriver BiDi

const puppeteer = require('puppeteer');

const browser = await puppeteer.launch({
  browser: 'firefox',
  protocol: 'webDriverBiDi',
});
const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

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