| name | browser-use |
| description | Browser automation CLI for the Cheatcode coding agent. Use when the user needs to interact with websites, take screenshots, fill forms, click elements, navigate pages, or automate any browser task. |
| category | Builder & Apps |
| tags | browser, automation, screenshots, qa |
| compatibility | Requires the preinstalled cheatcode-browser CLI and headed Chromium runtime. |
| allowed-tools | shell_exec browser_open browser_act browser_observe browser_extract browser_screenshot |
Browser Use
Use cheatcode-browser for all browser automation — navigating pages, interacting with elements, taking screenshots, extracting data, and testing web apps.
The --cloud flag spins up a remote cloud browser instance, so there is no need to install or run a browser locally in the sandbox.
Command
cheatcode-browser --cloud <action> [args...] [flags]
Cheatcode tool contract
Run every cheatcode-browser command with shell_exec and pass the command as an argv array.
Do not use shell_terminal for browser commands: it is reserved for persistent project work and
attaches a project workspace. Browser-only work must remain projectless.
For example, this documented shell command:
cheatcode-browser --cloud open https://example.com
must be sent to shell_exec as:
{"command":["cheatcode-browser","--cloud","open","https://example.com"]}
Issue sequential shell_exec calls when commands depend on earlier output. Do not turn &&
examples in this document into shell_terminal calls. If cheatcode-browser is unavailable,
fall back directly to the native browser_open, browser_observe, browser_act,
browser_extract, and browser_screenshot tools without creating a project.
Before You Act — THINK FIRST
CRITICAL: Before issuing any browser commands, stop and reason about the task. Do not jump straight into commands. Browser automation fails when you act mechanically without understanding the website.
1. Understand the end goal
What is the user actually trying to accomplish? If they say "find the cheapest flight from SF to NYC," the goal isn't "click a search box" — it's navigating an airline/travel site's full search flow: entering origin, destination, dates, hitting search, reading results, and comparing prices. Plan the full sequence before starting.
2. Anticipate the site structure
Think about what kind of website you're working with and how it's likely organized:
- E-commerce (Amazon, Shopify): search bar → results grid → product detail → cart → checkout
- Search engines (Google, DuckDuckGo): search box → results list with links → target pages
- Auth-gated apps (dashboards, SaaS): login page → redirect → sidebar/nav → content views
- Content sites (Wikipedia, docs): nav/sidebar → article content → internal links
- Forms/wizards: multi-step flows with validation, progress indicators, conditional fields
Knowing the pattern tells you what to expect after each action.
3. Plan for state transitions
Every action changes the page. Before you click or submit, ask yourself:
- Will this navigate to a new page or stay on the same one?
- Will a modal, dropdown, or toast appear?
- Will there be a loading spinner or network delay?
- Could this trigger a redirect (e.g., auth redirect, region redirect)?
Always re-snapshot after a state change to confirm you're where you expect.
4. Handle obstacles proactively
Real websites have friction. Before interacting with main content, check for and dismiss:
- Cookie consent banners / GDPR popups
- Login walls or signup modals
- CAPTCHA challenges (use
request_user_control for these)
- Newsletter popups or promotional overlays
- "Accept terms" dialogs
If you see these in a snapshot, handle them first.
5. Verify before proceeding
After each major step, confirm the page state before continuing. Don't chain 5 actions blindly — one failed click silently breaks everything after it. The pattern is: act → verify (snapshot) → act → verify.
Core Workflow (DOM-based) — ALWAYS USE THIS FIRST
For standard web pages, use the snapshot → use refs → re-snapshot loop:
cheatcode-browser --cloud open https://example.com/form
cheatcode-browser --cloud snapshot -i
cheatcode-browser --cloud fill @e1 "user@example.com"
cheatcode-browser --cloud fill @e2 "password123"
cheatcode-browser --cloud click @e3
cheatcode-browser --cloud snapshot -i
CRITICAL: When you have refs from a snapshot, ALWAYS use them. Do NOT use find, CSS selectors, or any other locator strategy when you already have @e refs — refs are the fastest and most reliable way to target elements. Only use find when you need to locate elements without a prior snapshot.
After any navigation or DOM change (clicking a link, submitting a form, opening a modal), always re-snapshot to get fresh refs.
Computer Use (Screenshot + Coordinates)
For tasks that are not DOM-based or where the DOM is hard to work with — canvas elements, maps, games, complex visual UIs, iframes, visual verification — use the screenshot -> observe -> coordinate loop:
cheatcode-browser --cloud screenshot --annotate
cheatcode-browser --cloud mouse click 150 300
cheatcode-browser --cloud screenshot
Available coordinate actions:
cheatcode-browser --cloud mouse click <x> <y>
cheatcode-browser --cloud mouse move <x> <y>
cheatcode-browser --cloud mouse dblclick <x> <y>
cheatcode-browser --cloud mouse scroll <x> <y> <scroll_y>
cheatcode-browser --cloud mouse down left
cheatcode-browser --cloud mouse up left
cheatcode-browser --cloud mouse wheel 100
cheatcode-browser --cloud keyboard type "some text"
cheatcode-browser --cloud press Enter
When to use coordinates vs DOM:
- Prefer DOM-based actions (
click, fill, snapshot) first — they are more reliable.
- Fall back to screenshot + coordinates when:
- The page uses
<canvas>, WebGL, or complex SVG that snapshots can't express
- Elements are inside cross-origin iframes
- You need to verify visual layout, colors, or positioning
- The snapshot output is unclear or missing interactive elements
Actions Reference
Navigation
cheatcode-browser --cloud open <url>
cheatcode-browser --cloud close
cheatcode-browser --cloud tab
cheatcode-browser --cloud tab new [url]
cheatcode-browser --cloud tab <n>
cheatcode-browser --cloud tab close [n]
Multi-tab workflows: Always run cheatcode-browser --cloud tab first to list tabs and check which tab is currently active before switching or interacting. Tab indices can change after opening or closing tabs, so never assume a tab index — always list tabs to confirm.
Observation
cheatcode-browser --cloud snapshot
cheatcode-browser --cloud snapshot -i
cheatcode-browser --cloud snapshot -c
cheatcode-browser --cloud snapshot -d 3
cheatcode-browser --cloud snapshot -s "#main"
cheatcode-browser --cloud screenshot
cheatcode-browser --cloud screenshot --full
cheatcode-browser --cloud screenshot --annotate
Screenshot path: Do NOT save screenshots to /tmp. By default, screenshots are saved to the working directory (/home/user/computer). Only specify a path if the user explicitly asks to save to a specific location.
DOM Interaction (use refs from snapshot)
cheatcode-browser --cloud click <selector>
cheatcode-browser --cloud click <selector> --new-tab
cheatcode-browser --cloud dblclick <selector>
cheatcode-browser --cloud fill <selector> <text>
cheatcode-browser --cloud type <selector> <text>
cheatcode-browser --cloud select <selector> <value>
cheatcode-browser --cloud check <selector>
cheatcode-browser --cloud uncheck <selector>
cheatcode-browser --cloud hover <selector>
cheatcode-browser --cloud focus <selector>
cheatcode-browser --cloud scroll down 500
cheatcode-browser --cloud scroll down 500 --selector ".container"
cheatcode-browser --cloud scrollintoview <selector>
cheatcode-browser --cloud drag <selector> <targetSelector>
cheatcode-browser --cloud upload <selector> <path>
cheatcode-browser --cloud download <selector> [path]
Keyboard
cheatcode-browser --cloud press Enter
cheatcode-browser --cloud press Tab
cheatcode-browser --cloud press Control+a
cheatcode-browser --cloud press Control+c
cheatcode-browser --cloud press Control+v
cheatcode-browser --cloud press Escape
cheatcode-browser --cloud keyboard type "some text"
cheatcode-browser --cloud keyboard inserttext "text"
Note: Meta/Command/Cmd keys are automatically mapped to Control inside the sandbox (Linux environment). Use Control+ for key combinations.
Get Information
cheatcode-browser --cloud get text @e1
cheatcode-browser --cloud get html @e1
cheatcode-browser --cloud get value @e1
cheatcode-browser --cloud get attr @e1 href
cheatcode-browser --cloud get title
cheatcode-browser --cloud get url
cheatcode-browser --cloud get cdp-url
cheatcode-browser --cloud get count ".item"
cheatcode-browser --cloud get box @e1
cheatcode-browser --cloud get styles @e1
Wait
cheatcode-browser --cloud wait @e1
cheatcode-browser --cloud wait 2000
cheatcode-browser --cloud wait --text "Success"
cheatcode-browser --cloud wait --url "**/dashboard"
cheatcode-browser --cloud wait --load networkidle
cheatcode-browser --cloud wait --fn "window.ready"
cheatcode-browser --cloud wait --download [path]
Semantic Locators (only when you don't have refs)
Use find only when you haven't taken a snapshot or need to locate elements without refs. If you have @e refs from a snapshot, always use those instead.
cheatcode-browser --cloud find role button click --name "Submit"
cheatcode-browser --cloud find text "Sign In" click
cheatcode-browser --cloud find text "Sign In" click --exact
cheatcode-browser --cloud find label "Email" fill "user@test.com"
cheatcode-browser --cloud find placeholder "Search Amazon" type "query"
cheatcode-browser --cloud find alt "Logo" click
cheatcode-browser --cloud find title "Close" click
cheatcode-browser --cloud find testid "submit-btn" click
cheatcode-browser --cloud find first ".item" click
cheatcode-browser --cloud find last ".item" click
cheatcode-browser --cloud find nth 2 "a" hover
JavaScript
IMPORTANT: eval runs code as a top-level expression. Do NOT use return — it causes SyntaxError: Illegal return statement. Just write the expression directly.
cheatcode-browser --cloud eval 'document.title'
cheatcode-browser --cloud eval 'document.querySelectorAll("img").length'
cheatcode-browser --cloud eval 'JSON.stringify([...document.querySelectorAll("a")].map(a => a.href))'
Session & User Control
cheatcode-browser --cloud get_live_preview_link
cheatcode-browser --cloud request_user_control --title "Title" --description "Instructions"
Other
cheatcode-browser --cloud pdf /tmp/page.pdf
cheatcode-browser --cloud help
Efficiency — CRITICAL
Every Bash call is expensive. Minimize round-trips aggressively. This is the #1 factor in browser automation speed.
1. Always use the snapshot flow first
Use snapshot -i → interact → re-snapshot. This is the fastest, most reliable approach. Only fall back to screenshots when the DOM can't express what you need.
2. Chain commands with &&
If you don't need intermediate output, chain multiple commands in a single Bash call:
cheatcode-browser --cloud open https://example.com && cheatcode-browser --cloud snapshot -i
cheatcode-browser --cloud fill @e1 "user@example.com" && cheatcode-browser --cloud fill @e2 "password" && cheatcode-browser --cloud click @e3 && cheatcode-browser --cloud snapshot -i
3. Use eval for bulk operations
A single eval replaces many individual calls. Use it for scraping, form filling, bulk interactions, and data extraction. Never use return — just write the expression.
cheatcode-browser --cloud eval 'JSON.stringify(Array.from(document.querySelectorAll("tr")).map(r => r.innerText))'
cheatcode-browser --cloud eval 'document.querySelectorAll("input[type=checkbox]").forEach(cb => { if (!cb.checked) cb.click() }); "done"'
cheatcode-browser --cloud eval 'JSON.stringify({ title: document.title, links: Array.from(document.querySelectorAll("a")).map(a => ({ text: a.innerText, href: a.href })) })'
4. Don't over-observe
- Only snapshot/screenshot when you need fresh refs or visual confirmation. If you already know the next selector or coordinate, just act.
- Prefer
snapshot -i over snapshot — interactive-only is smaller and faster.
- Prefer
snapshot over screenshot — text is fast, images are slow. Only use screenshots when you need visual information the DOM can't provide.
Requesting User Control (Human-in-the-Loop)
When a task requires human interaction — typically logging in, solving a CAPTCHA, or confirming a sensitive action — hand control to the user:
cheatcode-browser --cloud request_user_control --title "Log in to GitHub" --description "Please sign in with your credentials. Click 'Return control' when done."
This halts the current agent run and shows the user a prompt with your title and description. The user interacts with the browser directly, then clicks Return control when finished. You may continue working after the user resumes.
When to use:
- Login / OAuth flows where the agent must not see credentials
- CAPTCHAs or 2FA prompts
- Any confirmation the user must do themselves
Live Preview Link
Get an interactive browser preview URL that you can share with the user so they can see and interact with the current browser session directly:
cheatcode-browser --cloud get_live_preview_link
Returns a JSON object with livePreviewUrl — a URL the user can open to view and interact with the live browser session.
When to use:
- The user needs to manually interact with a page (login, CAPTCHA, review)
- You want to show the user what the browser is currently displaying
- Any situation where the user needs to see or do something in the browser themselves
Always send the link via sendMessage so the user can tap it directly.
Tips
- Use
--annotate on screenshots to get numbered labels on interactive elements — useful for finding coordinates or verifying which element is which.
- Re-snapshot after DOM changes. Element refs are invalidated after navigation, form submissions, or dynamic content loading.
Errors
- If cloud mode cannot install the browser runtime in the sandbox, surface that install error directly.