OpenProgram Docs

Browser tab actions

Reading

Item
Snapshotget_state returns Playwright's AI snapshot: the ARIA tree with a ref on each element (e12, and f1e3 inside a frame). Without include the providers ask for all, the outline and a screenshot, or tree when the call takes no images, as in code mode (browser.built_in.with_include), on the built-in browser and on Chrome and Edge alike.
Playwright versionsPlaywright 1.60 serves it as Frame.ariaSnapshot(mode="ai", track), one text that is incremental when the same document has an earlier tracked snapshot; earlier versions serve Page.snapshotForAI, which returns both.
Whole or changesThe driver asks for the whole page when the document is new or a full read is wanted, and otherwise only for the changes.
MarksChanged lines are marked <changed> and [unchanged] stands for what was already sent.
LimitsPassword field values are redacted from both, and a page is cut at 40,000 characters.

Refs

Item
LifetimePlaywright resolves aria-ref=<ref> against its latest snapshot, and a ref stays the same for as long as its element exists, so refs survive any number of actions and turns.
KeptThe driver keeps each ref's role and name from the snapshots.
LookupA ref that no longer resolves is looked up by that role and name, and so is an element named directly by role and name.
FailureIf that still finds nothing, the action fails with element_gone, which the model reads as ELEMENT_GONE, and the page as it is now. An element that has no box on the page, for a press-and-hold click or a click at its centre, fails the same way before any input is sent.
User's browserIn the user's Chrome or Edge a ref goes to Playwright MCP as it is, and role with name goes as the locator getByRole(role, { name, exact: true }), which its target accepts beside a ref. A locator that matches several elements fails with ambiguous_element, one that matches none with element_gone, and an element action that names nothing with target_required before anything is sent.

Acting

Item
InputClicks, hovers, key presses, type_text (insert_text at the caret, fill with clear: true), set_value (select_option, set_checked or fill), drag_to and set_input_files are Playwright's own trusted input. In the user's Chrome or Edge, type_text inserts through a page script at the caret.
Background tabsThey reach a tab in the background without bringing it forward, which was checked against the App: a background tab receives isTrusted pointer, mouse and click events.
Scrolling and pasteScrolling uses page_actions.SCROLL_SCRIPT, and paste uses PASTE_SCRIPT.
CoordinatesA click by x,y maps screenshot pixels to CSS pixels with the ratio measured when the screenshot was taken, if the screenshot is still current (Coordinates).
CursorBefore a click, the App's agent cursor is armed and placed on the element.
NavigationAfter an action, the driver waits up to 0.3 s for a navigation to start.
LoadIf one starts, it waits for domcontentloaded.
RequestsIt then waits up to 2 s for fetch/XHR requests the action started.
ReturnThen it returns the changes, or the whole page when the URL changed or the document is new.
ExceptionAn exception becomes a result with a reason code and the page as it is now, never a raw error.

Approval. The App's tabs need none: opening or navigating to any site, acting on it and running a script in it ask nothing.

upload_file is never covered by the Page grant: the modes that ask ask and Auto reviews it, on every call; code mode's validator refuses it; the read-only actions (list_tabs, get_state, find, wait, read_console_messages, read_network_requests) are marked as reads for the broker.

File upload

Item
Hidden inputsPages rarely show their file input: it sits behind a styled upload button with display: none, so the outline has only the button, or the page creates the input when the button is clicked.
ApproachThe driver therefore uploads the way a person does, as Playwright MCP does.
ListenerEvery write action runs with a filechooser listener on the page (_catch_choosers), which makes Chromium hand the chooser to the driver instead of opening a window on the user's screen; the listener is removed when the action has settled, so the user's own clicks open the usual window.
Caught chooserA chooser caught that way is kept on the tab and the result carries file_chooser (multiple, accept); upload_file(path) without an element answers it, a bad path leaves it waiting, and any other write drops it.
One stepupload_file(element, path) is the one-step form.
Set or clickWhen the element is a file input or the label of one (FILE_INPUT_SCRIPT), the file is set on that input, hidden or not; anything else is clicked inside expect_file_chooser and the chooser it opens takes the file, or the call fails with no_file_chooser after 3 s.
No guessingThe driver never guesses an input near a button: a page with a second hidden input would take the file into the wrong field and report success, which is also why Codex exposes uploads only through the chooser.
CausesThe page may be stuck in an earlier upload, or open its input only after an await that spent the click's user activation.
ErrorSo the error says what the button reads now and whether it is disabled (ELEMENT_STATE_SCRIPT), and lists the page's enabled file inputs, numbered (FILE_FIELDS_SCRIPT).
EntryEach entry gives its id or name, accept, multiple, the text it sits in, and whether it is the only one in the button's section.
ChoiceThe model picks one with upload_file(field=n, path), which sets the file on that input (Tab.file_fields).
DroppedAny other write action, or a new page, drops the list, and the user's own browser does not support field.
Text resultThe text result names a caught chooser and its accept, so the model knows to answer it.
User's browserThe user's Chrome or Edge follows the same model through Playwright MCP's own file-chooser state: upload_file with an element clicks it first, without one it answers the chooser the last click opened.
Drop zonesDrop zones with no file input at all are not covered.

evaluate

Item
Reachevaluate reads everything a signed-in page holds, including what snapshots redact.
GrantIt is part of operating its browser: in the built-in browser it runs under the Page grant, and in the user's Chrome or Edge under that browser's grant (computer_use(browser chrome), computer_use(browser edge)).
Markpage_script marks a computer_use browser call with an evaluate step (single or in actions); the policy uses the mark for one thing, refusing such a call in a turn someone other than the owner started (IDENTITY_PAGE_SCRIPT: outside MCP clients, agents or schedules someone else set up) or one that works from text the owner did not write (IDENTITY_OUTSIDE_TEXT: a handoff, an automatic Goal).
Code modeCode mode's validator applies the same test (identity.unattended, identity.outside_text) to an evaluate step of a code call.
CardA card that asks about a call with a script shows the arguments untruncated.
RedactionThe result passes the same password redaction.
ElementWith element (a ref, or role and name), a function script receives that element as its argument.
FormsA function script is called; any other script runs as a console runs it, parsed first as an expression, else as statements whose last value is the result, else (with await) as the body of an async function whose return is the result, so it runs once; a promise it returns gets 30 s (SCRIPT_SECONDS).
ErrorsA script that throws fails with script_error and the page's own message.
CapsScripts are capped at 8000 characters and results at 20,000.

Computer and browser use

Last updated · 2026-11-25