Skip to content
fastbrowsefastbrowse

Browsers and logins

Connect an agent to a running Chrome over CDP

Drive a Chrome or Electron app you already have open over its DevTools port: the launch flag, picking a window, and keeping a signed-in browser open.

·all posts

Attaching to a running Chromefastbrowse connects over the Chrome DevTools Protocol on port 9222 to a signed-in Chrome and opens a background tab for the run.CDPfastbrowse--cdp-port 9222Your ordersInboxrun tabASigned in, with your profile--user-data-dir ~/.fastbrowse/chromethe run tab closes when the run ends
fastbrowse connects to a Chrome you started with a debugging port. The run works in a background tab, using the session already in that profile.

fastbrowse can drive a browser you already have open, signed in with your profile. Any Chromium app works, including Electron apps, as long as it exposes its DevTools port.

Start the app with the debugging port

--remote-debugging-port is read at launch. A running app ignores it, so quit the app and start it again with the flag.

open -a "Visual Studio Code" --args --remote-debugging-port=9222 ~/code/my-project

On Linux and Windows, pass the same flag to the binary. Then point a run at that port and name the window it should use:

fastbrowse "Open the Extensions view and report how many extensions are installed." \
  --cdp-port 9222 --target-match my-project

Keep a signed-in Chrome open

Chrome ignores the debugging port on its default profile, so give it a data directory of its own. Sign in once by hand and leave it running:

google-chrome --remote-debugging-port=9222 --user-data-dir="$HOME/.fastbrowse/chrome"
fastbrowse "Report my open orders." --start https://www.amazon.com/ --cdp-port 9222

Each run opens a background tab in that browser and closes it afterwards. The agent never holds the password, because the session is already in the profile. For runs that need credentials handed over, see browser agent logins without sharing passwords.

Focus while a run works

A run in a visible window works in a tab behind the current one and does not raise the window. Three things still bring it forward:

To keep a run out of sight, run it headed in a separate session.

Close the port when you are done

Anything on the machine that can reach a DevTools port can read every page, cookie and signed-in session in that browser. Bind the port to loopback only, and close the app or restart it without the flag when you finish.

The attach guide is the reference for the flags, and run statuses and exit codes lists how a run ends.

Next: your first run.