Browser automation CLI tool. Use pw commands to control a headless Chromium browser.
# Fetch page content
pw fetch example.com
# Fetch and take screenshot
pw fetch example.com -o /tmp/screenshot.png
# Full page screenshot
pw fetch example.com -o /tmp/full.png --full-pageThe fetch command is the most useful - it navigates to a URL and extracts content or takes a screenshot in a single operation.
# Get page text content
pw fetch <url>
# Get page HTML
pw fetch <url> --format html
# Take screenshot
pw fetch <url> -o /path/to/screenshot.png
# Full page screenshot
pw fetch <url> -o /path/to/screenshot.png --full-page
# Explicit screenshot flag (same as -o)
pw fetch <url> --screenshotpw navigate <url> # Go to URL (auto-adds https://)
pw back # Go back
pw forward # Go forward
pw reload # Reload pagepw screenshot # Save to default location
pw screenshot -o /path/to/file.png # Save to specific path
pw screenshot --full-page # Capture entire pagepw click <selector> # Click element
pw type <selector> <text> # Type text (appends)
pw fill <selector> <value> # Fill input (replaces)
pw select <selector> <value> # Select dropdown option
pw hover <selector> # Hover over element
pw focus <selector> # Focus element
pw press <key> # Press key (Enter, Tab, Escape, etc.)pw content # Get page text
pw content --format html # Get page HTML
pw text <selector> # Get element text
pw snapshot # Get accessibility treepw wait-selector <selector> # Wait for element
pw wait-text <text> # Wait for text on page
pw wait-navigation # Wait for navigation
pw wait <ms> # Wait millisecondspw status # Check browser status
pw close # Close browserAll commands return JSON:
{
"success": true,
"url": "https://example.com",
"title": "Example Domain",
"content": "...",
"timestamp": "2024-01-15T10:30:00.000Z"
}Error responses include error field:
{
"success": false,
"error": "Element not found",
"timestamp": "2024-01-15T10:30:00.000Z"
}Use CSS selectors or Playwright-specific selectors:
# CSS selectors
pw click "button.submit"
pw click "#login-form input[type=email]"
# Text selectors
pw click "text=Submit"
# Role selectors
pw click "role=button[name='Submit']"pw fetch news.ycombinator.com
# Returns: {"success": true, "content": "...", ...}pw fetch github.com -o /tmp/github.png
# Returns: {"success": true, "screenshot": "/tmp/github.png", ...}pw navigate example.com/login
pw fill "input[name=email]" "user@example.com"
pw fill "input[name=password]" "secret123"
pw click "button[type=submit]"pw navigate example.com
pw text "h1"
# {"success": true, "text": "Example Domain", ...}- Each command is independent - the browser closes after each command
- Use
fetchfor most tasks - it combines navigate + content/screenshot - Always check
successfield in JSON output - Screenshots are useful for debugging