browser-execute
The browser_execute tool evaluates JavaScript against a connected browser session via the Chrome DevTools Protocol.
The snippet runs in-process; session is bound to a long-lived CDP Session that persists. Connect once, then drive many snippets.
There is no helper namespace, just session, console, and standard JS globals.
Workspace: <projectRoot>/.bcode/agent-workspace/. Read/write your reusable scripts here.
Skills: {{SKILLS_DIR}}/. Read-only browser execute reference docs.
Connecting
Always call session.connect(...) once at the start of your work. There are three connection methods:
Way 1: connect to the user's running Chrome or Chromium-based browser (real profile, popup-gated).
Choose when the task involves the user's logged-in sites, current browser state, cookies, saved data, etc.
// Attempts to connect to every detected Chrome, most-recently-launched first.
await session.connect()
For this to work the user must have navigated to chrome://inspect/#remote-debugging in their target Chrome and ticked "Allow remote debugging for this browser instance". This setting is per-profile and persists across every future launch of that profile. On Chrome 144 and later, the first attach also triggers an in-browser "Allow remote debugging?" popup that the user must click "Allow" on. The popup may reappear on later attaches under conditions that are not fully characterized — browser restart, time elapsed, new CDP session. Ask the user to click Allow again if a previously working connection starts 403'ing.