49 lines
1.8 KiB
Markdown
49 lines
1.8 KiB
Markdown
---
|
|
name: web-automation
|
|
description: Browse and scrape web pages using Playwright with Camoufox anti-detection browser. Use when automating web workflows, extracting page content to markdown, handling authenticated sessions, or scraping websites with bot protection.
|
|
---
|
|
|
|
# Web Automation with Camoufox (OpenCode)
|
|
|
|
Automated web browsing and scraping using Playwright with Camoufox anti-detection browser.
|
|
|
|
## Requirements
|
|
|
|
- Node.js 20+
|
|
- pnpm
|
|
- Network access to download browser binaries
|
|
|
|
## First-Time Setup
|
|
|
|
```bash
|
|
cd ~/.opencode/skills/web-automation/scripts
|
|
pnpm install
|
|
npx camoufox-js fetch
|
|
```
|
|
|
|
## Prerequisite Check (MANDATORY)
|
|
|
|
Before running any automation, verify Playwright + Camoufox dependencies are installed and scripts are configured to use Camoufox.
|
|
|
|
```bash
|
|
cd ~/.opencode/skills/web-automation/scripts
|
|
node -e "require.resolve('playwright-core/package.json');require.resolve('camoufox-js/package.json');console.log('OK: playwright-core + camoufox-js installed')"
|
|
node -e "const fs=require('fs');const t=fs.readFileSync('browse.ts','utf8');if(!/camoufox-js/.test(t)){throw new Error('browse.ts is not configured for Camoufox')}console.log('OK: Camoufox integration detected in browse.ts')"
|
|
```
|
|
|
|
If any check fails, stop and return:
|
|
|
|
"Missing dependency/config: web-automation requires `playwright-core` + `camoufox-js` and Camoufox-based scripts. Run setup in this skill, then retry."
|
|
|
|
## Quick Reference
|
|
|
|
- Browse page: `npx tsx browse.ts --url "https://example.com"`
|
|
- Scrape markdown: `npx tsx scrape.ts --url "https://example.com" --mode main --output page.md`
|
|
- Authenticate: `npx tsx auth.ts --url "https://example.com/login"`
|
|
|
|
## Notes
|
|
|
|
- Sessions persist in Camoufox profile storage.
|
|
- Use `--wait` for dynamic pages.
|
|
- Use `--mode selector --selector "..."` for targeted extraction.
|