Overview
The Chrome module provides functions to launch and manage Chrome browser instances with the Chrome DevTools Protocol enabled. It automatically downloads Chrome for Testing or chrome-headless-shell when needed.Functions
launchChrome
Launches a Chrome instance with DevTools Protocol enabled.Configuration options for launching Chrome.
Whether to run Chrome in headless mode. When true, uses chrome-headless-shell with frame control enabled.
ensureChrome
Ensures Chrome for Testing is available, downloading it if necessary.Path to the Chrome executable.
- Returns
CHROME_PATHenvironment variable if set - Checks
CHROME_CACHE_DIRfor a previously downloaded Chrome for Testing - Downloads the latest stable Chrome for Testing build
- Falls back to system-installed Chrome if download fails
ensureHeadlessShell
Ensures chrome-headless-shell is available, downloading it if necessary.Path to the chrome-headless-shell executable.
- Returns
CHROME_HEADLESS_PATHenvironment variable if set - Checks
HEADLESS_SHELL_CACHE_DIRfor a previously downloaded build - Downloads the latest stable chrome-headless-shell build
Types
LaunchChromeOptions
Configuration for launching Chrome.ChromeInstance
Represents a running Chrome instance.Constants
CHROME_CACHE_DIR
Directory where Chrome for Testing binaries are cached.~/.webreel/bin/chrome.
HEADLESS_SHELL_CACHE_DIR
Directory where chrome-headless-shell binaries are cached.~/.webreel/bin/chrome-headless-shell.
Headless Mode
Whenheadless: true (default), webreel launches chrome-headless-shell with specialized flags for deterministic rendering:
--enable-begin-frame-control- Manual frame advancement--run-all-compositor-stages-before-draw- Complete rendering pipeline--disable-threaded-animation- Deterministic animations--disable-threaded-scrolling- Predictable scroll behavior--disable-checker-imaging- Immediate image decoding
Platform Support
Chrome for Testing is automatically downloaded for:- macOS (Intel and Apple Silicon)
- Linux (x64 and arm64)
- Windows (x64)
Environment Variables
| Variable | Description |
|---|---|
CHROME_PATH | Path to a Chrome executable to use instead of downloading |
CHROME_HEADLESS_PATH | Path to a chrome-headless-shell executable to use instead of downloading |