| name | sw |
| description | Browser automation CLI with stealth capabilities. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages without being detected as a bot. |
| allowed-tools | Bash(sw:*) |
Browser Automation with sw (Stealth Wright)
Quick start
sw open
sw goto https://example.com
sw click e15
sw type "search query"
sw press Enter
sw screenshot
sw close
Commands
Core Navigation
sw open [url]
sw goto <url>
sw close
sw close-all
sw reload
sw go-back
sw go-forward
sw devices
Page Snapshots & Screenshots
sw snapshot
sw screenshot [ref]
sw screenshot --filename <file>
sw screenshot --full-page
sw screenshot --annotate
Interaction Commands
Ref-based (requires prior sw snapshot):
sw click <ref> [button]
sw dblclick <ref>
sw fill <ref> <text>
sw hover <ref>
sw check <ref>
sw uncheck <ref>
Semantic (no snapshot needed):
sw click --role button --text "Submit"
sw click --label "Close"
sw fill --label "Email" "user@example.com"
sw fill --placeholder "Search" "query"
sw hover --role link --text "About"
sw check --label "Remember me"
sw uncheck --label "Subscribe"
sw find --role button
sw find --text "Sign In"
sw find --label "Username"
sw find --placeholder "Password"
Semantic flags (work on click/fill/hover/check/uncheck/find):
--role <aria-role> ARIA role: button, link, textbox, checkbox, heading, combobox, etc.
--text <string> Visible text content (partial match by default)
--label <string> aria-label attribute (partial match by default)
--placeholder <string> Input placeholder (partial match by default)
--exact Require exact string matches
Other interaction commands:
sw type <text>
sw press <key>
sw select <ref> <value>
Mouse & Keyboard
sw mouse-move <x> <y>
sw mouse-down
sw mouse-up
sw mousewheel <x> <y>
sw key-down <key>
sw key-up <key>
sw drag <ref> <x> <y>
Forms & Upload
sw upload <ref> <file>
Dialogs
sw dialog-accept
sw dialog-dismiss
Tabs
sw tab-new [url]
sw tab-close
sw tab-switch <index>
sw tab-list
Page Data
sw eval <code> [--ref]
sw pdf [--filename <file>]
Browser Size
sw resize <width> <height>
Cookies
sw cookie-list [--domain <domain>] [--path <path>]
sw cookie-get <name>
sw cookie-set <name> <value> [--domain <domain>] [--path <path>] [--expires <timestamp>] [--httpOnly] [--secure] [--sameSite strict|lax|none]
sw cookie-delete <name>
sw cookie-clear
Local & Session Storage
sw localstorage-list
sw localstorage-get <key>
sw localstorage-set <key> <value>
sw localstorage-remove <key>
sw localstorage-clear
sw sessionstorage-list
sw sessionstorage-get <key>
sw sessionstorage-set <key> <value>
sw sessionstorage-remove <key>
sw sessionstorage-clear
State & Data
sw state-save [file]
sw state-load <file>
sw delete-data
Video Recording
sw video-start
sw video-stop
Developer Tools
sw install-browser [--browser <type>]
sw devtools-start
Sessions
sw list
sw kill-all
Network & Monitoring
sw console
sw network
sw route <glob> <url>
sw route-list
sw unroute <glob>
sw tracing-start
sw tracing-stop
Video
sw video-start
sw video-stop
Global Options
-s, --session <name>
-b, --browser <type>
--headed
--persistent
--profile <path>
--config <file>
--stealth
--no-stealth
open-only Options
--device <name>
Environment Variables
All key options can be set via environment variables. CLI flags always take precedence.
| Variable | Flag | Description |
|---|
SW_SESSION | -s / --session | Session name |
SW_BROWSER | -b / --browser | Browser type |
SW_HEADED | --headed | Run in headed mode (true/false) |
SW_STEALTH | --stealth | Stealth mode (true/false, default true) |
SW_PROFILE | --profile | Profile directory path |
SW_DEVICE | --device | Device to emulate |
Legacy alias: PLAYWRIGHT_CLI_SESSION is also accepted for SW_SESSION.
Targeting Elements
Method 1: Ref-based (via snapshot)
Run sw snapshot to assign [ref=eN] to all visible elements. The snapshot shows the ARIA tree:
- textbox "Email" [ref=e1]
- textbox "Password" [ref=e2]
- button "Sign In" [ref=e3]
- link "Forgot password" [ref=e4]
Use the ref in commands:
sw fill e1 "user@example.com"
sw fill e2 "password123"
sw click e3
Method 2: Semantic locators (no snapshot needed)
Target elements by their ARIA role, visible text, label, or placeholder — without running sw snapshot first:
sw fill --label "Email" "user@example.com"
sw fill --label "Password" "secret"
sw click --role button --text "Sign In"
Use sw find to discover what elements are available:
sw find --role button
Method 3: Annotated screenshot
For multimodal AI workflows, capture a screenshot with ref numbers overlaid on every element:
sw screenshot --annotate
This lets a vision model identify elements by ref without reading the ARIA snapshot text.
Stealth Mode
Stealth mode is enabled by default. It:
- Randomizes browser fingerprint
- Hides automation markers
- Adds human-like behavior
- Prevents WebRTC leaks
Disable stealth if needed:
sw --no-stealth open https://example.com
Sessions
Named sessions allow parallel browser contexts:
sw -s=auth open https://login.example.com
sw -s=scrape open https://data.example.com
sw -s=auth fill e1 "user"
sw -s=scrape snapshot
Mobile Device Emulation
Emulate a mobile device to test mobile-specific layouts and behaviors.
sw devices
sw open --device "iPhone 15" https://example.com
sw open --device "Pixel 7"
sw open --device "iPad Pro 11"
sw open --headed --device "Galaxy S8" https://example.com
The --device flag sets the user agent, viewport size, device scale factor, touch events, and mobile flag to match the real device. Use sw devices to see the full list of supported device names.
Example Workflows
Form Submission (ref-based)
sw open https://example.com/login
sw snapshot
sw fill e1 "user@example.com"
sw fill e2 "password123"
sw click e3
sw snapshot
sw close
Form Submission (semantic — no snapshot needed)
sw open https://example.com/login
sw fill --label "Email" "user@example.com"
sw fill --label "Password" "password123"
sw click --role button --text "Sign In"
sw snapshot
sw close
Search with Stealth
sw open https://example.com
sw fill --placeholder "Search" "query"
sw press Enter
sw screenshot result.png
sw close
Annotated Screenshot for AI Vision
sw open https://example.com
sw screenshot --annotate
Video Recording
sw open https://example.com
sw video-start
sw snapshot
sw click e3
sw fill e1 "hello"
sw video-stop
Parallel Sessions
sw -s=site1 open https://site1.com &
sw -s=site2 open https://site2.com &
wait
sw -s=site1 screenshot site1.png
sw -s=site2 screenshot site2.png
sw close-all
State Persistence
sw open https://example.com
sw fill --label "Username" "user"
sw click --role button --text "Login"
sw state-save session.json
sw state-load session.json
sw snapshot