---
name: playwright-visit
description: Visit web pages using Playwright browser automation. Capture screenshots, extract text, get rendered HTML, or save as PDF.
---

# Playwright Visit

Browser automation skill using Playwright to visit web pages and extract content. Uses headless Chromium with a fresh profile (no cookies/history from user's browser).

## When to Use

- "Take a screenshot of [url]"
- "Get the text content from [webpage]"
- "Capture [url] as a screenshot"
- "Extract the rendered HTML from [page]"
- "Save [url] as a PDF"
- When WebFetch fails on JavaScript-heavy sites

## Process

1. Identify the URL and desired output format from user request
2. Run the appropriate helper script command
3. Return the result (file path for screenshot/pdf, content for text/html)

## Helper Scripts

### visit.py

**Screenshot** - Capture page as PNG:
```bash
./scripts/visit.py screenshot "https://example.com" /tmp/screenshot.png
```

**Text** - Extract visible text content:
```bash
./scripts/visit.py text "https://example.com"
```

**HTML** - Get rendered HTML (after JavaScript):
```bash
./scripts/visit.py html "https://example.com"
```

**PDF** - Save page as PDF:
```bash
./scripts/visit.py pdf "https://example.com" /tmp/page.pdf
```

**Options:**
- `--wait <ms>` - Wait after page load (default: 1000ms)
- `--full-page` - Capture full scrollable page (screenshot only)

## Requirements

- NixOS with `python312Packages.playwright` in devShell
- System chromium at `/run/current-system/sw/bin/chromium`
- Run from skill directory or use `nix develop` first

## Notes

- Uses fresh browser profile each run (no login state)
- Headless by default
- For authenticated pages, consider using `storage_state` parameter (not yet implemented)
