Skip to content
fastbrowsefastbrowse

docs

Attach to a running browser

Drive a Chrome or Electron window over its DevTools port, or attach to a window that is already open.

fastbrowse.ai·all docs·source at the pinned commit·Raw Markdown·llms.txt

Open windows and Electron apps

An Electron app is Chromium underneath, so a run can drive it once the app exposes a DevTools port. Quit the app, start it again with --remote-debugging-port (an app that is already running ignores the flag), then attach to its window by title or URL. VS Code titles each window after the folder it has open:

open -a "Visual Studio Code" --args --remote-debugging-port=9222 ~/code/my-project   # elsewhere, pass the flag to the binary
uv run fastbrowse "Open the Extensions view and report how many extensions are installed." \
  --cdp-port 9222 --target-match my-project

The same works for a Chrome you started with --remote-debugging-port. With --attach, the run takes over an existing window instead of opening a tab of its own. Without --start it begins on whatever the window shows, and the window stays open when the run ends. --target-match picks the first window whose title or URL contains the text; --attach alone takes the first window, skipping DevTools. Popups the window opens join the run. Windows that nothing opened, as an Electron app's main process opens them, join only with --target-match, because in a browser such a window could equally be a tab you opened yourself.

A DevTools port gives any program on the machine full control of the app, including its signed-in sessions. Close the app, or restart it without the flag, when you are done.