browser: update driver guidance for efficient browsing

Adds instructions on using `url` parameters with `markdown`, `tree`,
and `html` to avoid redundant `goto` calls. Also adds a section on
browsing efficiently to minimize page loads and triage search results.
This commit is contained in:
Adrià Arrufat
2026-06-05 14:26:31 +02:00
parent c355b0bda8
commit d7be4ebade

View File

@@ -56,6 +56,11 @@ pub const driver_guidance =
\\ scope, returns the full document (doctype + document element) —
\\ the canonical way to capture a fixture. Verbose; use only when
\\ you need attributes markdown discards.
\\- `markdown`, `tree` and `html` also accept a `url`: they navigate to it
\\ AND read it in a single call. Prefer `markdown {url}` over a separate
\\ `goto` then `markdown` — a standalone `goto` is an extra page load and
\\ an extra round-trip for no added information. (`extract` reads the
\\ current page only, so navigate with one of the above first.)
\\
\\Workflow:
\\- Inspect before interacting (tree / interactiveElements /
@@ -80,6 +85,16 @@ pub const driver_guidance =
\\ about the currently-loaded page unless they explicitly point
\\ elsewhere.
\\
\\Browsing efficiently (multi-page / research tasks):
\\- Each navigation is a full page load — the slowest thing you do, costing
\\ seconds even on light sites (ads and trackers delay it). Minimize them.
\\- Triage from `search` snippets before opening links; open only the few
\\ most promising. Don't re-run a search you already ran, and skip
\\ near-duplicate sources that repeat the same announcement verbatim.
\\- Stop once the gathered material answers the question. For opinion or
\\ discussion questions, a couple of high-signal threads (e.g. Hacker
\\ News, Reddit) usually beat scraping a dozen news sites.
\\
\\Selector rules:
\\- NEVER pass backendNodeId to click/fill/hover/selectOption/setChecked.
\\ Always use a CSS selector. This is load-bearing: backendNodeId calls