A command-line tool to control Safari on macOS via WebDriver. No MCP server needed — just a standalone CLI.
Talks directly to safaridriver (built into macOS) using the W3C WebDriver protocol. Session state is persisted to ~/.safari-cli/session.json so commands work across terminal invocations.
Prerequisites
macOS (Safari and SafariDriver are macOS-only)
Node.js 18+
Safari with Remote Automation enabled:
Safari → Settings → Advanced → check "Show features for web developers"
Develop menu → Allow Remote Automation
Run once: sudo safaridriver --enable
Install
# Run directly with npx (no install needed)
npx @tamasno1/safari-cli <command># Or install globally from npm
npm install -g @tamasno1/safari-cli
Quick Start
# Start a Safari session
safari-cli start
# Navigate
safari-cli navigate https://example.com
# Page info
safari-cli info
# Title: Example Domain# URL: https://example.com/# Take a screenshot
safari-cli screenshot --output page.png
# Execute JavaScript
safari-cli execute 'document.title'# Read console logs
safari-cli console
# Inspect an element
safari-cli inspect 'h1'# Click an element
safari-cli click 'a[href]'# Stop the session
safari-cli stop
Performance metrics (load times, paint, transfer size)
Screenshots
Command
Description
screenshot [-o file] [-s selector]
Capture page or element screenshot as PNG
Developer Console
Command
Description
console [--level LEVEL] [--inject]
Get captured console logs (LOG, WARN, ERROR, INFO, DEBUG)
console-clear
Clear captured console logs
network [--inject]
Get captured network requests (fetch + XHR)
network-clear
Clear captured network logs
Note: Console/network capture works by injecting JavaScript hooks. The first call to console or network auto-injects the hooks. Logs from before injection won't be captured. Use --inject to set up capture early.