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

  1. 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.
  2. 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.
  3. Otherwise extract --schema takes the repeating row and the fields per row and returns JSON in one call; unusual shapes get a short eval script.
  4. Multi-page data goes into one script loop (page, extract, merge).
  5. Finally the agent turns the JSON into the CSV, table or summary you asked for.

What you'll see


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 wantWhat to use
Discover what's out there / find sourcesWebSearch
A specific fact on a static or public pageWebFetch or curl (no browser)
Structured data from a known site (GitHub issues, Reddit/HN search, Bilibili/Twitter feeds), especially when logged inchrome-use site <name>/<cmd> (see below) β€” skip snapshot+click
Structured data from any page (no community adapter) β€” tables, search results, feed rows, dashboardschrome-use extract --schema '{rows,fields}' β€” clean JSON in one call
A logged-in session, interaction, JS rendering, or an anti-bot pagechrome-use (this tool)
A page the user saved earlier / an internal systemchrome-use find-url <keywords>
βœ… Tip
Don't hand-craft deep links stuffed with query parameters. A link obtained through interaction carries the right hidden context and can pass anti-bot checks; a hand-assembled URL usually does neither.

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.

bash
# 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.

bash
# targeted extraction by ref
$ chrome-use snapshot -i
$ chrome-use get text @e5
$ chrome-use get attr @e10 href
ℹ️ Note
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.

extract-rows.sh
# 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
⚠️ Don't cram complex scripts into an inline string
Whenever your JS contains quotes, non-ASCII identifiers/strings (e.g. Chinese), or is on the longer side, use 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.
ℹ️ Use --json for array/object results
The normal renderer pretty-prints results across multiple lines, which gets shredded the moment you 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.

Full site-adapters guide β†’


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.

bash
# 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"}}}'
stdout Β· JSON
# 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"}
]
ℹ️ Omit rows to get a single object for the whole page
With no 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).
βœ… v1.5.73: no more silent []
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"}]}.
ℹ️ A spec extract does not understand is an error, not a silent null
The "@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).
ℹ️ Multi-page / paginated crawls
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.