What Agents Can Do
Screenshots, Video & Viewport
Have your agent save what's in the browser as files: a screenshot, a video of a workflow, or the page shrunk to phone width to check the layout. Screenshots are for records and for you; the agent finds and clicks buttons from the page structure, not from screenshots.
Ask your agent
Take a full-page screenshot of this page and save it in docs/images/.
Captures the full scroll height, not just the visible area.
Record the checkout flow as a video I can send to a colleague.
Pauses after key steps so it's watchable at 1x.
Look at this page at a 375px phone width. What overflows horizontally?
Only the layout width of this tab changes.
What the agent does
screenshotcaptures the viewport,--fullthe whole page, or just one element or region.- When you want to discuss a picture,
--annotatenumbers the elements, and the numbers match the elements the agent read. - Video:
record startandrecord stopwrap the whole workflow, with short waits after key actions. For something to post in an issue or a chat, it records a.gif. - For responsive bugs,
viewportsets width and height, then the agent compares page width with viewport width to find what breaks the layout. - Plain alerts are accepted automatically. When a confirm or prompt dialog blocks the flow,
dialogaccepts or dismisses it.
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. - A screenshot without a path goes to a temp file and the path is printed; tell the agent where you want it instead. Screenshots are scaled to at most 1200px on the longest side by default (full-page shots cap only the width); ask if you need full resolution.
- Video (
.webmor.mp4) needs ffmpeg installed; a.gifdoes not. A GIF runs at 5 frames a second and at most 800px wide, ready to paste into an issue. When connected to your Chrome through the extension, it records the agent's own tabs. - Changing the viewport only affects that tab's layout. Your Chrome window keeps its size.
- 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.
This page is about turning what happens in the browser into files: grab a screenshot, record a workflow video, shrink the viewport to phone width to reproduce a responsive bug, and deal with iframes and dialogs that get in the way. These are all output tools β not for "finding elements and clicking them." For locating and interacting, always go through snapshot + @ref.
snapshot -i to get a @ref, which pierces even
cross-origin iframes (embedded Stripe / Google Payments / checkout frames).
Screenshots only exist to save the rendered result as a reusable image asset (maps, charts, og images, visual-regression baselines, report illustrations).
Screenshots
screenshot --annotate draws numbered labels into the captured image in the CLI, without inserting page nodes or styles. JSON annotation boxes remain capture-relative CSS pixels; labels scale to the image resolution. Explicit clips take precedence over full-page and selector captures. Frame references use their owning renderer and top-viewport geometry. Nested out-of-process frames support rotation, skew, reflection and perspective through protocol quads and isolated-world viewport measurements, including scrollbar space. Annotation boxes enclose the projected corners. Collapsed or ill-conditioned transforms, perspective-horizon crossings and missing frame geometry report errors instead of guessed positions. Cropping also happens in the CLI; an off-viewport region is cropped from a full-page capture. Regions outside the page are refused.
Ordinary selector and --clip screenshots use the same CLI pixel-cropping path, including after page scroll. Viewport regions capture the existing surface; off-screen regions capture the full page before cropping. Neither path scrolls or activates the tab.
The extension relay allows up to 25 seconds for each screenshot capture, below the CLIβs 30-second CDP deadline. Native captures after viewport or DPR changes can take longer than ordinary commands. This waits for the same capture; it does not replay it or activate the tab. A timeout still fails and does not cancel Chrome's pending capture, so avoid overlapping capture retries. Background-color cleanup uses the existing attachment once, without resetting it or retrying on another target. Ordinary commands retain their normal recovery behavior.
Windows relay screenshot requires extension 0.5.101 or later for minimized-window detection. A minimized target window is refused before capture. --allow-window-restore explicitly permits restoring only the bound tabβs existing window to normal; it requests focused: false, leaves the window restored, and may change focus. It never activates a tab or creates a window. A changed target or unverified restoration fails instead of retrying. JSON includes windowPreparation. This option is unavailable outside Windows relay; older extensions retain legacy default capture behavior with a warning.
chrome-use screenshot report.png --full --allow-window-restore
screenshot renders the current page to PNG. With no path, it saves to a temp file and prints the path to
stdout; with a path, it writes to the location you give.
$ chrome-use screenshot # temp path, printed to stdout
$ chrome-use screenshot page.png # specific path
$ chrome-use screenshot --full full.png # entire scroll height
$ chrome-use screenshot --annotate map.png # numbered labels + legend, mapped to snapshot refs
--full captures the full scroll height rather than just the visible area.
--annotate is for multimodal models: each label [N] maps to
@eN in the snapshot, making it easy to line up an image with the structured snapshot.
It refreshes labels without hard-resetting same-document ref identity, so a ref from the immediately
preceding snapshot remains usable after the capture.
Scaling and clipping
Full-page screenshots from a real retina Chrome are often too large to fit into an image reader, so screenshots are
automatically downsampled to a longest edge of β€1200px (width only for full-page shots; --full-res keeps the captured size) β this keeps them readable while pixel coordinates stay aligned with
click x y. Override with the flags below when needed, or capture just one selector / region:
# capture just an element / region, saved as a reusable image asset
$ chrome-use screenshot "selector" --clip x,y,w,h region.png
# override the default downsample cap
$ chrome-use screenshot --max-width 1600 wide.png
$ chrome-use screenshot --scale 1 sharp.png
--hide-scrollbars false at launch to keep the visible native scrollbars.
box @ref to get the element's CSS pixel box and
centerX/centerY, then feed those straight into click <centerX> <centerY> β no screenshot needed at any point.
Recording workflow videos
Record a whole automation run as video, for debugging, documentation, or evidence.
record start begins recording, you run your commands as usual in between, and
record stop ends it and writes to disk.
With extension-connected real Chrome, it records the current session-owned tab directly
instead of calling the forbidden Target.createBrowserContext; --launch
keeps the isolated-context behavior.
$ chrome-use record start demo.webm
$ chrome-use open https://example.com
$ chrome-use snapshot -i
$ chrome-use click @e3
$ chrome-use record stop
There's also a restart subcommand, equivalent to "stop the current recording + start a new one to a new file":
$ chrome-use record start ./output.webm # start recording to a file
$ chrome-use record stop # stop the current recording
$ chrome-use record restart ./take2.webm # stop current + reopen to a new file
Recording a GIF
A path ending in .gif records a looping animated GIF, the kind you paste into an issue, a PR or a chat.
record start --gif with no path writes ./recording.gif; --gif with a path that
does not end in .gif is refused.
$ chrome-use record start ./bug.gif
$ chrome-use click @e3
$ chrome-use record stop # prints the path and frame count
chrome-use encodes the GIF itself while recording, with no ffmpeg, and memory stays flat however long it runs.
It takes 5 frames a second, scales them to at most 800px wide and keeps the first frame's size throughout;
frames where nothing changed merge into one, so an idle page costs almost nothing.
Each frame has at most 256 colours: fine for UI, grainy for photos and video. Record a .webm when quality matters.
Practical recording tips
| Goal | How |
|---|---|
| Make each step clear to watch | Insert chrome-use wait 500 after key actions to give viewers time to react |
| Put context in the filename | login-flow-2024-01-15.webm, checkout-test-run-42.webm |
| Keep the recording even on error | Call chrome-use record stop inside trap cleanup EXIT |
| Keep video + key frames together | While recording, grab a frame at each step with chrome-use screenshot ./stepN.png |
.gif is encoded by chrome-use itself (no ffmpeg), .webm encodes with VP8 (libvpx), any other extension (e.g. .mp4) uses H.264 (libx264).
Recording adds slight overhead to automation, long recordings take a lot of disk, and some headless environments may lack the codec.
More recording recipes live in references/video-recording.md inside the skill package (a repo file β the doc site doesn't link to it).
Iframe scope
Iframe content is automatically inlined into the snapshot, and refs are transparently usable β usually you don't have to do anything:
$ chrome-use snapshot -i
# @e3 [Iframe] "payment-frame"
# @e4 [input] "Card number"
# @e5 [button] "Pay"
$ chrome-use fill @e4 "4111111111111111"
$ chrome-use click @e5
When you want to focus the snapshot on a specific iframe (for concentration, or to handle deep nesting), use
frame to switch context, then frame main to switch back to the main frame when done:
$ chrome-use frame @e3 # switch context into this iframe
$ chrome-use snapshot -i
$ chrome-use frame main # switch back to the main frame
Viewport / window size
To reproduce width-dependent bugs (responsive breakpoints, horizontal-overflow triage, mobile layouts), set the viewport first.
This is a CDP virtual viewport (Emulation.setDeviceMetricsOverride) β
it only changes this tab's layout viewport, and does not actually resize the OS window. So it works headless,
and it works over the extension relay, without yanking around the user's real Chrome window.
$ chrome-use viewport 1280 800 # set width x height (alias: resize)
$ chrome-use viewport 375x812 # WxH shorthand
$ chrome-use viewport 375 812 --dpr 3 --mobile # retina + mobile emulation
$ chrome-use viewport reset # clear the override, restore real size
A typical use β find out what's blowing out the layout at a narrow width:
$ chrome-use viewport 375 812
$ chrome-use eval 'document.documentElement.scrollWidth + " vs " + innerWidth'
set viewport <w> <h> [scale] is equivalent to viewport, and resize is an alias too β
write whichever feels natural.
set device "iPhone 13" uses a 390 Γ 844 CSS viewport at 3Γ scale and an iOS 15 user agent. Use set device off (aliases: reset, none, or device off) to clear device metrics, user-agent and touch overrides on the current tab. Future tabs stop inheriting the emulated UA. The reset restores the browser default UA, not a previous --user-agent or set useragent value; explicit headless launches retain their existing UA compatibility normalization. The reset reads the resulting native viewport and does not resize the Chrome window. On the relay, extension 0.5.98+ forgets cleared metrics after a successful reset so idle reattachment cannot replay the old mobile viewport. A partial failure reports which overrides were cleared. viewport reset only clears metrics; it deliberately keeps any user-agent override.
Dialogs
alert and beforeunload are automatically accepted,
so the agent never gets stuck on a popup. When you need to handle confirm and prompt manually:
$ chrome-use dialog status # is there a pending dialog?
$ chrome-use dialog accept # accept
$ chrome-use dialog accept "text" # accept and fill in the prompt text
$ chrome-use dialog dismiss # cancel
dialog β native alert is already auto-accepted. Only when a page pops a
confirm ("Are you sure you want to delete?") or a prompt (asking for text) and blocks what follows do you
use dialog accept / dialog dismiss to respond explicitly.