Skip to main content

Browser Tools

Automate and debug Chrome from the command line.

Use bt to launch named browser instances, inspect rendered pages, click and fill elements, and read console or network activity. Commands reuse the running browser's page and cookies. Regular Google Chrome stable is the default. Optional Camoufox support covers browser launch and lifecycle, not CDP page commands.

$ bt launch --headless -- https://example.com
...
$ bt wait-idle
...
$ bt eval 'document.title'
{
  "value": "Example Domain",
  "type": "string",
  ...
}
$ bt stop
...

Install

Requires Python 3.13+ and a local Chrome or Chromium installation. Regular Google Chrome stable is the default; Canary is not required.

uv tool install browser-tools
bt --version

Alternatively, install with pip install browser-tools in a Python environment. The install provides bt, its alias browser-tools, and browser-tools-profiler.

The default install depends on websockets only and brings no Node.js with it. After installation, run the example above to confirm browser access. Use bt launch without --headless for a visible browser.

Usage

Unless a block includes launch, use a browser you already launched. Run bt stop when finished. Commands below omit the instance name; with several browsers, put the name from launch output before the command, as in bt web-01 snapshot.

Read a page and save a screenshot

bt navigate https://example.com
bt wait-idle
bt snapshot
bt screenshot --path example.png

navigate does not wait for loading. A snapshot returns the accessibility tree with element UIDs; use those with bt click --uid UID or bt fill --uid UID --text 'hello'. Take a new snapshot after navigation.

Keep a login across restarts

bt launch --profile demo
# Log in by hand in this window.
bt stop
bt launch --profile demo
bt snapshot

A named profile keeps cookies and login state across restarts. Without --profile, each launch starts with a fresh temporary profile; one live instance can hold a named profile at a time.

Use 1Password in a fresh session

bt launch
# The session is provisioned for 1Password; its preferences pin the extension.

On macOS with the 1Password desktop app installed, every fresh Chrome session this tool launches, named or temporary, is provisioned with the official 1Password native-messaging host and its new preferences pin the 1Password extension. Existing pin choices are never changed, the password-manager preference updates every launch performs still apply, and unpinning works as usual. Other platforms, the Camoufox engine, and machines without the official registration keep a plain launch. See bt guide for boundaries and the --1password flag.

Run dependent steps in one connection

bt run - <<'STEPS'
Page.navigate '{"url":"https://example.com"}'
wait-idle
eval 'document.title'
snapshot
STEPS

Each line is a command without bt; use raw Page.navigate inside a run. The run shares a CDP session and stops at the first failure, reporting completed steps without undoing them.

Inspect console messages and network traffic

bt console-list --duration 2
bt network-get --url example.com --reload
bt network-list --duration 2

network-get --reload reloads the page and returns a matching response body. Network observation covers traffic during that command, not earlier commands; console-list also receives Chrome's buffered console messages.

Capture a page load or memory snapshot

cat > load.steps <<'STEPS'
Page.navigate '{"url":"https://example.com"}'
wait-idle
STEPS
bt trace --steps load.steps --out load.json
bt heap --out page.heapsnapshot

Open the trace in Chrome DevTools' Performance panel and the heap snapshot in its Memory panel. Optional bt insights analyzes traces locally, but needs explicit setup and a compatible trace version.

Launch Camoufox

uv tool install --with-executables-from camoufox 'browser-tools[camoufox]'
camoufox fetch
bt launch --engine camoufox --profile camoufox-demo
bt status
bt stop

Camoufox is an optional anti-detect Firefox browser; camoufox fetch downloads it. Browser Tools manages its launch, profiles, status, and stop, but page-interaction and CDP commands require Chrome or Chromium.

Reference

bt launch [--headless] [--profile NAME] [--name NAME] [--channel stable|beta|dev|canary]
bt [INSTANCE] COMMAND [OPTIONS]
bt [INSTANCE] Domain.method '{"key":"value"}'
bt status [INSTANCE]
bt stop [INSTANCE]
bt guide

launch appends the first free two-digit suffix to its base name, such as web-01. Without --name, the base comes from the current directory. Repeated unnamed launches from one directory succeed with successive suffixes. Each launch prints the chosen name in its JSON result.

A plain launch outlives the command until stopped or until it goes idle. Every managed launch gets a one-hour idle timeout by default: --idle-timeout 2h changes it at launch, and bt configure INSTANCE --idle-timeout 2h changes it on a running instance. --owner PID opts into closing it when that process exits, and bt retain INSTANCE keeps it for a handoff.

Task Commands
Inspect and interact snapshot, click, fill, eval, press, hover, type, detect
Wait for page changes wait-text, wait-idle, wait-stable
Observe browser activity attach, wait, console-list, network-list, network-get
Inspect frames and storage frames, storage get
Capture and profile screenshot, screencast, trace, heap, insights, browser-tools-profiler
Manage saved state profile list, profile delete, profile migrate, cleanup
Manage browser lifetime retain, configure

bt guide is the full installed manual, including raw CDP recipes, dialog policy, frame selection, and command output. bt COMMAND --help lists flags; bt help Domain.method reads the protocol signature from a running browser.

See the reference for the full command inventory, configuration, external-browser setup, compatibility limits, and architecture. To drive a Chrome you started for debugging on its own user-data directory, use --chrome-profile DIR or --endpoint URL; your everyday Chrome profile is not attachable through this path.

Configuration

Named profiles use $BROWSER_TOOLS_PROFILES_DIR, then $XDG_DATA_HOME/browser-tools/profiles, then ~/.local/share/browser-tools/profiles. For example:

BROWSER_TOOLS_PROFILES_DIR="$HOME/.local/share/bt-profiles" bt launch --profile demo

BROWSER_TOOLS_CHROME_BINARY selects an explicit executable. Without an override, regular Chrome stable is auto-detected; --channel selects another installed channel. Other settings include the registry path and window border.

Output and exit codes

Most commands print JSON to stdout. Help and the guide print text; attach streams JSON Lines. Diagnostics go to stderr. Check the exit code before parsing results, because a failed run or capture can still print partial output.

Code Meaning
0 Success
1 Operational failure, such as a closed browser, timeout, or stale UID
2 Invalid or refused usage

Security

A debugging endpoint grants control of the browser and its cookies. Connect only to browsers you started or were authorized to use. External endpoints accept only 127.0.0.1 and ::1; do not assume port 9222 belongs to your instance.

stop and cleanup do not manage external browsers. Browser.close and Browser.crash are refused over external endpoints. profile delete NAME deletes that profile's saved login state. Report vulnerabilities through SECURITY.md.

Contributing

git clone https://github.com/dungle-scrubs/browser-tools.git
cd browser-tools
uv sync
uv run ruff check src/ tests/
uv run pyright src/
uv run pytest tests/ -q

Run the checkout's CLI with uv run bt, since a separately installed bt can be older. See CONTRIBUTING.md for development guidelines and the Code of Conduct.

License

MIT. See LICENSE and third-party attribution in NOTICE.

Metadata

Release files for browser-tools 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for browser-tools 0.11.0
File Size Uploaded Provenance Actions
browser_tools-0.11.0.tar.gz 1.2 MB Without provenance Details for browser_tools-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for browser-tools 0.11.0
File Interpreter ABI Platform Actions
browser_tools-0.11.0-py3-none-any.whl Python 3 none any Details for browser_tools-0.11.0-py3-none-any.whl

Total release size: 1.6 MB

Release files / browser_tools-0.11.0.tar.gz

Download URL browser_tools-0.11.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
e761d90a25309f294720ee6c3372c77cd2ab21590719e20ac9d0fe67339abed0
BLAKE2b-256 checksum
How to use checksums
d03097d950e38538af3dd43b8932d374fe902db8aafeceb1f6f996736ecb345f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / browser_tools-0.11.0-py3-none-any.whl

Download URL browser_tools-0.11.0-py3-none-any.whl
Size 401.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65264dd78833509b3334cf3aa8a08075f23ae5615f487f17921498c3ef700e95
BLAKE2b-256 checksum
How to use checksums
ad3bc1abeb5a6bee23496b0ac28c6963c1377f2150122fed28d8917b0eb9b239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for browser-tools 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page