Implementation:Puppeteer Puppeteer Chrome Browser Data
| Property | Value |
|---|---|
| sources | packages/browsers/src/browser-data/chrome.ts |
| domains | Browser Management, Download Resolution, Platform Detection |
| last_updated | 2026-02-12 00:00 GMT |
Overview
Description
The Chrome Browser Data module provides platform-specific resolution logic for Chrome browser downloads, executable paths, system installation locations, and user data directories. It is a core component of the @puppeteer/browsers package that enables Puppeteer to locate, download, and launch Chrome across all supported operating systems (Windows, macOS, Linux) and release channels (Stable, Beta, Dev, Canary).
The module resolves Chrome for Testing download URLs from Google's official infrastructure, determines the correct executable path within extracted archives for each platform, and can locate system-installed Chrome binaries including WSL (Windows Subsystem for Linux) environments. It also resolves build IDs from channel names, milestone numbers, or build prefixes by querying Google's version metadata APIs.
Usage
This module is used internally by the @puppeteer/browsers package to:
- Construct download URLs for Chrome for Testing binaries
- Determine relative executable paths within extracted browser archives
- Locate system-installed Chrome browsers by release channel
- Resolve default user data directories for each platform and channel
- Convert channel names, milestones, or build prefixes into concrete version strings
- Compare Chrome version strings using semver
Code Reference
Source Location
packages/browsers/src/browser-data/chrome.ts
Signature
export function resolveDownloadUrl(
platform: BrowserPlatform,
buildId: string,
baseUrl?: string,
): string;
export function resolveDownloadPath(
platform: BrowserPlatform,
buildId: string,
): string[];
export function relativeExecutablePath(
platform: BrowserPlatform,
_buildId: string,
): string;
export async function getLastKnownGoodReleaseForChannel(
channel: ChromeReleaseChannel,
): Promise<{version: string; revision: string}>;
export async function getLastKnownGoodReleaseForMilestone(
milestone: string,
): Promise<{version: string; revision: string} | undefined>;
export async function getLastKnownGoodReleaseForBuild(
buildPrefix: string,
): Promise<{version: string; revision: string} | undefined>;
export async function resolveBuildId(
channel: ChromeReleaseChannel | string,
): Promise<string | undefined>;
export function resolveSystemExecutablePaths(
platform: BrowserPlatform,
channel: ChromeReleaseChannel,
): [string, ...string[]];
export function resolveDefaultUserDataDir(
platform: BrowserPlatform,
channel: ChromeReleaseChannel,
): string;
export function compareVersions(a: string, b: string): number;
Import
import {
resolveDownloadUrl,
resolveDownloadPath,
relativeExecutablePath,
resolveBuildId,
resolveSystemExecutablePaths,
resolveDefaultUserDataDir,
compareVersions,
} from './browser-data/chrome.js';
I/O Contract
Inputs
| Parameter | Type | Description |
|---|---|---|
| platform | BrowserPlatform |
Target platform (LINUX, LINUX_ARM, MAC, MAC_ARM, WIN32, WIN64) |
| buildId | string |
Chrome version/build identifier (e.g., "131.0.6778.109") |
| baseUrl | string (optional) |
Custom base URL for downloads, defaults to Google's Chrome for Testing storage |
| channel | ChromeReleaseChannel or string |
Release channel (stable, beta, dev, canary) or milestone/build prefix |
| milestone | string |
Chrome milestone number (e.g., "131") |
| buildPrefix | string |
Chrome build prefix without patch (e.g., "112.0.23") |
Outputs
| Function | Return Type | Description |
|---|---|---|
| resolveDownloadUrl | string |
Full download URL for Chrome for Testing archive |
| resolveDownloadPath | string[] |
Path segments for the download URL |
| relativeExecutablePath | string |
Relative path to the Chrome executable within extracted archive |
| resolveBuildId | undefined> | Resolved version string from channel/milestone/build prefix |
| resolveSystemExecutablePaths | [string, ...string[]] |
Array of possible system-installed Chrome executable paths |
| resolveDefaultUserDataDir | string |
Default user data directory path for Chrome |
| compareVersions | number |
-1, 0, or 1 for version comparison |
Usage Examples
import {BrowserPlatform, ChromeReleaseChannel} from './browser-data/types.js';
// Resolve a download URL for Chrome
const url = resolveDownloadUrl(
BrowserPlatform.LINUX,
'131.0.6778.109'
);
// => 'https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.109/linux64/chrome-linux64.zip'
// Get the executable path within the extracted archive
const execPath = relativeExecutablePath(BrowserPlatform.MAC, '131.0.6778.109');
// => 'chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing'
// Resolve a build ID from the stable channel
const buildId = await resolveBuildId('stable');
// => '131.0.6778.109'
// Resolve a build ID from a milestone
const milestoneVersion = await resolveBuildId('131');
// => '131.0.6778.109'
// Find system-installed Chrome
const paths = resolveSystemExecutablePaths(
BrowserPlatform.LINUX,
ChromeReleaseChannel.STABLE
);
// => ['/opt/google/chrome/chrome']
// Get default user data directory
const dataDir = resolveDefaultUserDataDir(
BrowserPlatform.MAC,
ChromeReleaseChannel.STABLE
);
// => '/Users/<user>/Library/Application Support/Google/Chrome'