Principle:Getgauge Taiko Browser Installation
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, DevOps |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Process of automatically downloading and managing a compatible browser binary for use in automated testing.
Description
Browser automation requires a specific browser binary that matches the automation protocol version. Automatic browser installation solves version compatibility issues by downloading the exact browser revision that the automation library is tested against.
This involves platform detection (Windows/macOS/Linux), downloading the compressed browser binary from a CDN, extracting it to a local directory, setting executable permissions, and cleaning up old versions. The download targets a revision-specific binary to ensure deterministic behavior across environments and team members.
Environment variables allow skipping the download when using a custom browser path, which is particularly useful in containerized CI environments where a browser is already baked into the image. This flexibility ensures the installation process adapts to both local development and production CI pipelines without requiring code changes.
Usage
Triggered automatically during package installation (npm install). Can be skipped via the TAIKO_SKIP_CHROMIUM_DOWNLOAD environment variable when using a pre-installed browser, or TAIKO_BROWSER_PATH for specifying a custom browser location. This is commonly configured in CI/CD environments where a system-level browser is preferred over a per-project download.
Theoretical Basis
The installation follows a post-install hook pattern that executes as part of the package manager lifecycle:
- Check skip conditions -- Evaluate environment variables (TAIKO_SKIP_CHROMIUM_DOWNLOAD, TAIKO_BROWSER_PATH) to determine whether download is necessary.
- Detect platform and architecture -- Identify the operating system (win32, darwin, linux) and CPU architecture to select the correct binary variant.
- Download revision-specific binary from CDN -- Fetch the compressed browser archive matching the pinned revision number from the browser vendor's distribution endpoint.
- Extract archive -- Decompress the downloaded archive (ZIP on Windows/macOS, TAR on Linux) into the local storage directory.
- Set permissions -- On Unix systems, ensure the browser binary has executable permissions.
- Clean old revisions -- Remove previously downloaded browser revisions to conserve disk space.
This ensures reproducible builds with known-good browser versions, eliminating the "works on my machine" class of failures caused by browser version drift.