Skip to content

Guzl - Playwright Browser CLI

Source: extern/guzl/README.md Last updated: 2024-10

A headless Node.js Playwright CLI tool for capturing screenshots and DOM content from web pages across different browsers.

Installation

npm install -g guzl

# Or run directly with npx
npx guzl --browser chrome --url https://example.com --output screenshot.png

Usage

Basic Usage

# Capture screenshot and DOM to files
guzl --browser chrome --url https://example.com --output capture

# Output to stdout as Base64
guzl --browser firefox --url https://example.com --stdout

# Capture only screenshot
guzl --browser chrome --url https://example.com --screenshot-only --output screenshot.png

# Capture only DOM
guzl --browser firefox --url https://example.com --dom-only --output page.html

Options

Option Description
-b, --browser <browser> Browser type (chrome, firefox, safari, edge) [Required]
-u, --url <url> URL to capture [Required]
-o, --output <file> Output file path
-s, --stdout Output to stdout as Base64 JSON
--dom-only Capture only DOM content
--screenshot-only Capture only screenshot
--timeout <ms> Page load timeout (default: 30000)
--viewport <size> Viewport size, e.g., 1920x1080

Supported Browsers

  • chrome/chromium - Google Chrome/Chromium
  • firefox - Mozilla Firefox
  • safari/webkit - Safari (WebKit)
  • edge - Microsoft Edge

Output Formats

File Output: - Screenshot only: .png file - DOM only: .html file - Both: Two files with the same base name

Stdout Output (JSON):

{
  "screenshot": "iVBORw0KGgoAAAANSUhEUgAA...",
  "dom": "PCFET0NUWVBFIGh0bWw+CjxodG1s..."
}

Examples

# Capture full page screenshot
guzl -b chrome -u https://github.com -o github-screenshot

# Get mobile viewport screenshot
guzl -b firefox -u https://example.com --viewport 375x667 -o mobile.png

# Quick DOM extraction
guzl -b chrome -u https://news.ycombinator.com --dom-only --stdout

# High timeout for slow-loading pages
guzl -b safari -u https://slow-site.com --timeout 60000 -o slow-site