refactor: migrate web-automation to cloakbrowser

This commit is contained in:
Stefano Fiorini
2026-03-11 20:26:59 -05:00
parent c9254ed7eb
commit 4078073f0b
14 changed files with 200 additions and 553 deletions

View File

@@ -1,6 +1,6 @@
# web-automation
Automated web browsing and scraping using Playwright, with one-shot extraction and broader Camoufox-based automation under a single skill.
Automated web browsing and scraping using Playwright-compatible CloakBrowser, with one-shot extraction and broader persistent automation under a single skill.
## What this skill is for
@@ -20,15 +20,14 @@ Automated web browsing and scraping using Playwright, with one-shot extraction a
- Node.js 20+
- `pnpm`
- Network access to download browser binaries
- Network access to download the CloakBrowser binary on first use or via preinstall
## First-time setup
```bash
cd ~/.openclaw/workspace/skills/web-automation/scripts
pnpm install
npx playwright install chromium
npx camoufox-js fetch
npx cloakbrowser install
pnpm approve-builds
pnpm rebuild better-sqlite3 esbuild
```
@@ -48,7 +47,7 @@ pnpm approve-builds
pnpm rebuild better-sqlite3 esbuild
```
Without this, `browse.ts` and `scrape.ts` may fail before launch because the native bindings are missing.
Without this, helper scripts may fail before launch because the native bindings are missing.
## Common commands
@@ -56,7 +55,7 @@ Without this, `browse.ts` and `scrape.ts` may fail before launch because the nat
# One-shot JSON extraction
node skills/web-automation/scripts/extract.js "https://example.com"
# Browse a page
# Browse a page with persistent profile
npx tsx browse.ts --url "https://example.com"
# Scrape markdown
@@ -104,6 +103,24 @@ USER_AGENT="Mozilla/5.0 ..." node skills/web-automation/scripts/extract.js "http
- optional `screenshot`
- optional `htmlFile`
## Persistent browsing profile
`browse.ts`, `auth.ts`, `flow.ts`, and `scrape.ts` use a persistent CloakBrowser profile so sessions survive across runs.
Canonical env vars:
- `CLOAKBROWSER_PROFILE_PATH`
- `CLOAKBROWSER_HEADLESS`
- `CLOAKBROWSER_USERNAME`
- `CLOAKBROWSER_PASSWORD`
Legacy aliases still supported for compatibility:
- `CAMOUFOX_PROFILE_PATH`
- `CAMOUFOX_HEADLESS`
- `CAMOUFOX_USERNAME`
- `CAMOUFOX_PASSWORD`
## Natural-language flow runner (`flow.ts`)
Use `flow.ts` when you want a general command style like: