feat(text): frame-aware text extraction — get text --all-frames / --main + frames (#27)

On listing/marketplace pages (Yahoo Auctions, Rakuten, Mercari shops) the
seller's description lives in a child frame or under a related-items sidebar,
so 'get text body' returned only header/nav boilerplate.

- get text --all-frames: aggregate visible text across every reachable frame.
  Same-process child frames are read via Page.createIsolatedWorld; OOPIFs via
  their auto-attached debugger session (iframe_sessions). Each non-top frame is
  labelled with a '----- frame [kind] url -----' separator.
- get text --main: readability-lite — prefer the densest <main>/<article>
  region over the whole body, dropping global header/nav/footer chrome.
- frames: enumerate frames (kind + url + per-frame text length) so an agent can
  see where a page's text actually lives and pick the right read.

Verified live: inline srcdoc frame text aggregated through --all-frames; Yahoo
Auctions <main> (2881 chars) extracted via --main, stripping the Yahoo header.
This commit is contained in:
leeguooooo
2026-06-15 12:51:59 +09:00
parent f7a657ac46
commit 2707ceb1c4
5 changed files with 370 additions and 1 deletions
+11
View File
@@ -208,6 +208,9 @@ For unstructured reading (no refs needed):
```bash
chrome-use get text @e1 # visible text of an element
chrome-use get text --all-frames # whole page, aggregated across ALL frames
chrome-use get text --main # main content only — skip nav/header/sidebar
chrome-use frames # list every frame + where the text lives
chrome-use get html @e1 # innerHTML
chrome-use get attr @e1 href # any attribute
chrome-use get value @e1 # input value
@@ -216,6 +219,14 @@ chrome-use get url # current URL
chrome-use get count ".item" # count matching elements
```
On listing/marketplace pages (Yahoo Auctions, Rakuten, Mercari shops) the seller's
description often lives in a **child frame** or is buried under a "related items"
sidebar, so a plain `get text body` returns only header/nav boilerplate. When the
text you expect is missing: run `chrome-use frames` to see where it is, then
`get text --all-frames` (reads every reachable frame incl. cross-origin iframes)
or `get text --main` (drops the global chrome). If the content is lazy-loaded,
`scroll` it into view first.
## Interacting
```bash