capture_web
Screenshot a web page in a headless browser and measure named elements, returning a PNG, exact rects and a spec stub for annotating web UIs.
Instructions
Screenshot a web page in a headless browser (Playwright) and measure named elements, so you can annotate with exact rects. Use it for web UIs; for desktop apps use capture_window, for what is on screen right now capture_screen. Pass url to load a page, or cdp_url + page_url_contains to attach to a browser that is already running and logged in (the tab is captured as is). Loads the page over the network; actions (click, fill) run in that page and can change state on the site, so only pass actions the user asked for. Presets: laptop 1280x800@2, wide 1600x1000@2, phone 390x844@3. Needs ainotate[web] and a Playwright browser (doctor checks). Returns the PNG path (temp folder), rects in CSS px, scale (use it as the spec scale), missing targets with the reason, a spec stub and a preview with the rects outlined.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | Page to load (http/https). Omit when attaching with cdp_url. | |
| preset | No | Viewport: "laptop" 1280x800@2, "wide" 1600x1000@2 or "phone" 390x844@3. | laptop |
| actions | No | Steps run in the page before the capture, in order: {"click": T}, {"fill": T, "value": "..."}, {"wait": T}, {"scroll_to": T}, {"wait_ms": 500}; T is a target as in targets. | |
| browser | No | Engine to launch: "chromium" (default), "firefox" or "webkit". | chromium |
| cdp_url | No | DevTools address of a running browser to attach to, e.g. http://127.0.0.1:9222; captures its logged-in tab instead of launching a new browser. | |
| targets | No | Named elements to measure: {"name": {"text": "Checkout"} | {"selector": "css"} | {"role": "button", "name": "Save"}}, each with optional "within", "nth" (0-based), "exact", "fit". | |
| full_page | No | Capture the whole scrollable page instead of the viewport. | |
| timeout_ms | No | Time limit in ms for loading and for each action or target. | |
| hide_overlays | No | Hide cookie banners and similar overlays before the capture and after each click. | |
| user_data_dir | No | Browser profile folder to reuse (cookies, logins) when launching. | |
| page_url_contains | No | With cdp_url: substring of the URL of the tab to capture. |