chrome-to-har

command module
v0.0.0-...-23fd28c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 25 Imported by: 0

README

chrome-to-har

Go Reference

Command chrome-to-har records browser activity and generates HAR (HTTP Archive) files.

This tool launches Chrome/Chromium, navigates to specified URLs, and captures all network traffic in the standard HAR format. It supports both interactive browsing and automated capture modes.

Usage:

chrome-to-har [flags] [URL...]

Common flags:

-o file        Output HAR file (default: output.har)
-profile name  Use specific Chrome profile
-timeout sec   Global timeout in seconds (default: 30)
-headless      Run in headless mode
-filter regex  Filter requests by URL pattern
-block regex   Block requests matching pattern
-interactive   Enable interactive JavaScript mode

Examples:

# Record a single page
chrome-to-har https://example.com

# Use a specific Chrome profile
chrome-to-har -profile "Default" https://github.com

# Filter only API requests
chrome-to-har -filter "api\." https://example.com

# Block tracking scripts
chrome-to-har -block "analytics|tracking" https://news.site.com

# Interactive mode with JavaScript console
chrome-to-har -interactive https://example.com

The tool captures detailed timing information, request/response headers, cookies, and response content. The output HAR file can be analyzed using various HAR viewers and development tools.

Interactive mode provides a JavaScript console for executing commands in the browser context, useful for debugging and automation tasks.

Installation

Prerequisites: Go Installation

You'll need Go 1.21 or later. Install Go if you haven't already.

Setting up your PATH

After installing Go, ensure that $HOME/go/bin is in your PATH:

For bash users

Add to ~/.bashrc or ~/.bash_profile:

export PATH="$PATH:$HOME/go/bin"

Then reload your configuration:

source ~/.bashrc
For zsh users

Add to ~/.zshrc:

export PATH="$PATH:$HOME/go/bin"

Then reload your configuration:

source ~/.zshrc
Install
go install github.com/tmc/misc/chrome-to-har@latest
Run directly
go run github.com/tmc/misc/chrome-to-har@latest [arguments]

Documentation

Overview

Command chrome-to-har records browser activity and generates HAR (HTTP Archive) files.

This tool launches Chrome/Chromium, navigates to specified URLs, and captures all network traffic in the standard HAR format. It supports both interactive browsing and automated capture modes.

Usage:

chrome-to-har [flags] [URL...]

Common flags:

-o file        Output HAR file (default: output.har)
-profile name  Use specific Chrome profile
-timeout sec   Global timeout in seconds (default: 30)
-headless      Run in headless mode
-filter regex  Filter requests by URL pattern
-block regex   Block requests matching pattern
-interactive   Enable interactive JavaScript mode

Examples:

# Record a single page
chrome-to-har https://example.com

# Use a specific Chrome profile
chrome-to-har -profile "Default" https://github.com

# Filter only API requests
chrome-to-har -filter "api\." https://example.com

# Block tracking scripts
chrome-to-har -block "analytics|tracking" https://news.site.com

# Interactive mode with JavaScript console
chrome-to-har -interactive https://example.com

The tool captures detailed timing information, request/response headers, cookies, and response content. The output HAR file can be analyzed using various HAR viewers and development tools.

Interactive mode provides a JavaScript console for executing commands in the browser context, useful for debugging and automation tasks.

Directories

Path Synopsis
cmd
cdp command
cdp: Interactive Chrome DevTools Protocol Command-Line Tool
cdp: Interactive Chrome DevTools Protocol Command-Line Tool
churl command
Command churl is like curl but runs through Chrome and can handle JavaScript/SPAs.
Command churl is like curl but runs through Chrome and can handle JavaScript/SPAs.
native-host command
Native messaging host for Chrome AI extension
Native messaging host for Chrome AI extension
internal
browser
Package browser provides abstractions for managing Chrome browser instances.
Package browser provides abstractions for managing Chrome browser instances.
errors
Package errors provides comprehensive error handling utilities for chrome-to-har.
Package errors provides comprehensive error handling utilities for chrome-to-har.
health
Package health provides comprehensive health check functionality for Chrome AI integration
Package health provides comprehensive health check functionality for Chrome AI integration
langmodel
Package langmodel provides access to Chrome's LanguageModel APIs for on-device inference.
Package langmodel provides access to Chrome's LanguageModel APIs for on-device inference.
limits
Package limits provides resource limiting and DoS prevention functionality.
Package limits provides resource limiting and DoS prevention functionality.
output
Package output handles different output formats for Chrome data.
Package output handles different output formats for Chrome data.
secureio
Package secureio provides secure file system operations with proper validation and limits.
Package secureio provides secure file system operations with proper validation and limits.
validation
Package validation provides comprehensive input validation for security hardening.
Package validation provides comprehensive input validation for security hardening.
visual
Package visual provides comprehensive visual regression testing capabilities
Package visual provides comprehensive visual regression testing capabilities

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL