Chrome headless
CLIScreenshot or print any web page (local file or URL) to PNG/PDF with the browser you already have.
Visual check of a page or HTML → PDF without Playwright or Puppeteer
Verified commands
Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.
Screenshot a page (macOS, Google Chrome)
macOS only
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --window-size=1280,800 --screenshot=shot.png "http://localhost:3000/"Common failures (2)
- chrome: command not foundmacOS has no chrome on PATH; call the app binary by its full path
- window narrower than requestedChrome enforces a minimum window width (~500px); use device emulation for real mobile sizes
Print a page to PDF (macOS, Google Chrome)
macOS only
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --no-pdf-header-footer --print-to-pdf=out.pdf "file://$PWD/page.html"Screenshot a page (Linux, chromium)
Linux only
chromium --headless=new --no-sandbox --disable-gpu --hide-scrollbars --window-size=1280,800 --screenshot=shot.png "http://localhost:3000/"Common failures (1)
- Running as root without --no-sandbox is not supportedcontainers and CI usually run as root: add --no-sandbox
Print a page to PDF (Linux, chromium)
Linux only
chromium --headless=new --no-sandbox --disable-gpu --no-pdf-header-footer --print-to-pdf=out.pdf "file://$PWD/page.html"Install
Homebrew
brew install google-chromeapt
sudo apt install chromiumAgent notes
- When to use
- Verifying UI changes, capturing a rendered page for a vision model, converting HTML to PDF
- Quick examples
chromium --headless=new --screenshot=shot.png https://example.com
Use from an agent
curl -s https://clihub.com/api/tools/chrome-headless | jq '.agentHints.provenRecipes[] | {task, command, verified}'Or call get_tool with slug chrome-headless on the MCP server at https://clihub.com/mcp.