| name | browser-switch |
| description | Choose between agent-browser and Playwright CLI for browser automation tasks. |
Browser Switch
Choose between agent-browser (Rust) and Playwright CLI (Node.js) for browser automation.
Quick Choice
Need max speed & token efficiency? → agent-browser
Need cross-browser or debugging? → Playwright CLI
Complex component frameworks (e.g. Gradio, MUI, Ant Design)? → Playwright CLI
When to Use agent-browser
- Token efficiency matters (5.7x better than Playwright)
- Speed is critical (~100ms per action)
- Chrome-only is acceptable
- AI agent workflows where tokens are limited
- Rust performance preferred
- Simple web pages with standard HTML elements
When to Use Playwright CLI
- Need Firefox, Safari, or Edge testing
- Complex auto-waiting/retry logic required
- Already invested in Playwright ecosystem
- Better debugging and tracing needed
- Formal testing scenarios
- Complex component frameworks (e.g. Gradio, MUI, Ant Design)
- Tab/dialog state must persist across navigation
Key Differences
| Feature | agent-browser | Playwright CLI |
|---|
| Language | Rust | Node.js |
| Browser | Chrome only | Chrome, Firefox, Safari |
| Token Usage | ~5.5K chars | ~31K chars |
| Speed | ~100ms/action | ~200-300ms |
| Maturity | New (Vercel) | Mature (Microsoft) |
| Custom components | May miss some | Better snapshot coverage |
Examples
AI Agent Task (agent-browser)
agent-browser open example.com
agent-browser snapshot -i
agent-browser click @e2
agent-browser fill @e3 "test@example.com"
Cross-Browser Test (Playwright CLI)
playwright-cli open https://example.com
playwright-cli snapshot
playwright-cli click e2
playwright-cli fill e3 "test@example.com"
Decision
Use agent-browser unless you specifically need:
- Cross-browser testing
- Advanced debugging features
- Playwright ecosystem compatibility
- Complex component frameworks (e.g. Gradio, MUI, Ant Design)
Troubleshooting
agent-browser can't find an element
If agent-browser snapshot -i doesn't show the element:
- Try CSS selector:
agent-browser click "#my-button"
- Try text search:
agent-browser find text "Submit" click
- Try JavaScript:
agent-browser eval "document.querySelector('.my-class').click()"
- Fall back to Playwright CLI for better snapshot coverage
Tab/dialog state lost on navigation
agent-browser may lose tab state when navigating away and back. Use CSS selectors for tab switching:
agent-browser click "[role=tab]:nth-child(2)"
Or fall back to Playwright CLI for reliable tab persistence.
Complex component frameworks
Apps built with Gradio, MUI, Ant Design, or other component libraries often use custom elements and deep nesting that agent-browser's accessibility tree doesn't fully capture. Common symptoms:
- Tabs, modals, or drawers appear
- text: "..." with no interactable refs
- Custom dropdowns, selects, or sliders are invisible in the snapshot
- API documentation popups or settings panels don't appear at all
Try Playwright CLI when agent-browser struggles with these patterns.