What Agents Can Do
Collect Data
Have your agent turn lists, tables and search results into data. Popular sites have site adapters that call the site's own API; on any other page the fields you name come back as JSON in one call, and the agent converts them to the format you want.
Ask your agent
Put the title, price and link of the first 50 items in this list into a CSV.
The agent gets JSON and writes the CSV; it handles paging and infinite scroll.
List every open issue in this GitHub repo, grouped by label.
GitHub has a ready-made site adapter, so there is no clicking through pages.
Go through three pages of search results and keep only items rated 4.5 or higher.
Paging, extraction and filtering run in one script.
What the agent does
- First it decides whether a browser is needed: public static pages are faster to fetch directly; pages that need sign-in, interaction or JavaScript rendering go through chrome-use.
- If the site has an adapter (GitHub, Reddit, Bilibili and others),
site <name>/<cmd>calls the site's own API from your signed-in tab. - Otherwise
extract --schematakes the repeating row and the fields per row and returns JSON in one call; unusual shapes get a shortevalscript. - Multi-page data goes into one
scriptloop (page, extract, merge). - Finally the agent turns the JSON into the CSV, table or summary you asked for.
What you'll see
- Your tabs stay as they are: the agent opens background tabs in a
β¦ <project>tab group in your Chrome and does not take focus. Click over whenever you want to watch. - Sign-ins come from your Chrome's existing sessions. When there is a choice to make (such as whether to sign in from your password vault) or a step only you can do (scanning a QR code, confirming), the agent stops, asks you, and continues after you finish.
- chrome-use returns JSON. The CSV or table file is written by the agent; tell it where to save it.
- If a selector matches nothing,
extractlists the repeating containers it did find instead of quietly returning an empty array, and a field that is empty on every row gets a warning. Check the row count and empty fields first. - At the end the agent runs
done: tabs it opened along the way close, and pages you need to see or keep using stay open.
Under the hood
The commands and flags the agent runs. Read on if you write your own scripts, debug a run, or want the details.
When what you want is the data on a page rather than to act on it, don't dump the whole
HTML into your context. chrome-use offers a full ladder of extraction techniques from light to heavy: a structured
snapshot, precise reads by ref, custom-shaped eval, community site adapters, all the way up to the
one-shot extract --schema. This page helps you pick the cheapest one for each kind of page.
Pick the cheapest tool first
Driving a real browser is heavy work. chrome-use is only worth starting up when you genuinely need a logged-in session, interaction, JS rendering, or an anti-bot page. To read a piece of public, static text, don't open a browser at all. Use the table below to decide whether to open a browser at all.
| What you want | What to use |
|---|---|
| Discover what's out there / find sources | WebSearch |
| A specific fact on a static or public page | WebFetch or curl (no browser) |
| Structured data from a known site (GitHub issues, Reddit/HN search, Bilibili/Twitter feeds), especially when logged in | chrome-use site <name>/<cmd> (see below) β skip snapshot+click |
| Structured data from any page (no community adapter) β tables, search results, feed rows, dashboards | chrome-use extract --schema '{rows,fields}' β clean JSON in one call |
| A logged-in session, interaction, JS rendering, or an anti-bot page | chrome-use (this tool) |
| A page the user saved earlier / an internal system | chrome-use find-url <keywords> |
Structured snapshot: snapshot --json
To make a model reason about page content, the best input is a structured snapshot.
snapshot -i --json outputs the interactive elements together with their refs as a single line of
parseable JSON β compact and stable, ready to feed straight into downstream logic. For how to read the snapshot
itself, see Reading Pages.
# structured snapshot β best for letting AI reason over page content
$ chrome-use snapshot -i --json > page.json
Precise extraction: get text / get attr
Once you already have an @ref from a snapshot, reading by ref is the least effort:
get text pulls the visible text, get attr pulls a given attribute (such as a link's
href). Refs are reassigned on every snapshot, so snapshot first, then read.
# targeted extraction by ref
$ chrome-use snapshot -i
$ chrome-use get text @e5
$ chrome-use get attr @e10 href
get text also accepts a CSS selector; pair it with switches like --main (body only, skip
nav/sidebar) and --pierce (read through closed shadow DOM). For more ways to locate elements, see
Finding Elements.
Any shape: extract with eval
For data that needs a custom shape, like tables and lists, a snippet of JavaScript is the most direct:
querySelectorAll in the page and map it into the array of objects you want. eval runs in
the page's MAIN world, so it reads the real DOM directly.
# feed the script to eval --stdin via a heredoc
$ cat <<'EOF' | chrome-use eval --stdin
const rows = document.querySelectorAll("table tbody tr");
Array.from(rows).map(r => ({
name: r.cells[0].innerText,
price: r.cells[1].innerText,
}));
EOF
eval --stdin (heredoc), eval --file <path>, or eval -b <base64>.
Inline chrome-use eval "..." gets mangled by shell escaping and only works for simple ASCII expressions.
tail/head/pipe it. eval --json outputs a single line of
parseable JSON, ready for programmatic consumption.
MAIN-world state persists across calls
Because eval runs in the page's MAIN world and state persists across calls, a
top-level const x/let x/var x in one call collides with the next
(SyntaxError: Identifier 'x' has already been declared). The fixes: use non-colliding variable names,
assign to window.x, or wrap the whole snippet in an IIFE
(() => { const x = β¦; return x; })().
Site adapters: the cheapest path to "structured data from site X"
A site adapter is a small piece of community-written JS that hits a site's own JSON API
from your logged-in tab and returns clean structured data β no clicking, no scraping, no screenshots,
much cheaper than snapshot+click. Prefer one when it exists.
One shot: extract --schema
When there's no community adapter and you don't feel like writing eval, use
extract --schema: give it a {rows, fields} shape and it extracts tables, search results,
feed rows, and dashboards into clean JSON in a single call β no N rounds of
find/get, and no dumping the whole page's HTML into your context to blow out the window.
# rows = selector for the repeating container; fields = what to pull per row
# a field is shorthand CSS (text by default), "@href" (an attribute of the row element itself), or { "sel": "β¦", "get": "text|@attr|html|value" }
$ chrome-use extract --schema '{"rows":".product","fields":{"name":".name","price":".price","href":{"sel":"a","get":"@href"}}}'
# with rows, you get a JSON array β one object per matched container
[
{"name": "Widget A", "price": "$12.00", "href": "/p/a"},
{"name": "Widget B", "price": "$8.50", "href": "/p/b"}
]
rows, fields read against the whole document and return one object β handy for
page-header / metadata:
extract --schema '{"fields":{"title":"h1","canonical":{"sel":"link[rel=canonical]","get":"@href"}}}'.
For a long schema, pass it via --schema-file <path> or --stdin (heredoc).
rows and field selectors are CSS. If rows isn't valid CSS or
matches nothing, extract auto-detects the page's dominant repeating container
(li/tr/a repeated class) as a fallback; if there genuinely is none, it returns a
diagnostic listing the repeating containers that ARE present
(liΓ3, a[href*=pulls]Γ3) instead of a signal-less []. An array-shaped schema
works too: {"items":[{"title":"β¦","url":"@href"}]}.
"@href" shorthand reads an attribute of the row element itself (of the document root when
there are no rows); to read a descendant's attribute write {"sel":"a","get":"@href"}.
An unknown key (such as selector), "get":"href" without the @, or a field
selector that is not valid CSS is refused with the forms that work. A field that comes back empty in every
row is named in a β warning (meta.emptyFields with --json).
extract --schema is one call over one page. To accumulate across pages and filter by condition, wrap
it in a script loop: paginate β extract β merge. Measured: crawling 3 HN pages for high-score stories
drops from 13+ calls to one. See Scripting & Batching.
How to choose: a cheat card
The same page of data often has several routes; roughly from cheap to expensive, this is the order. The full "which extraction tool" decision table (with a "why" column) is maintained on the Site Adapters page.