Skip to content
fastbrowsefastbrowse

Browsers and logins

Connect an agent to a running Chrome over CDP

Drive signed-in Chrome through the fastbrowse extension, or connect an SDK to an Electron app over its DevTools port.

·verified against v0.11.0 on ·this post’s source·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. From the command line that is your own Chrome, through the extension. Any other Chromium app, including an Electron app, needs its DevTools port and an SDK.

Drive a window in your own Chrome

The command line runs in your own Chrome through the fastbrowse extension. Run fastbrowse extension install once and add the extension from the Chrome Web Store. Then name the window the run should use:

fastbrowse "Report my open orders." --start https://www.amazon.com/ --target-match amazon

Without --attach, each run works in a tab group of its own and closes its tabs afterwards. A run that stops for you to confirm a step, fill in a value or sign in leaves that tab open, so you can finish in the page it filled. The agent never holds the password, because the session is already in your Chrome. For runs that need credentials handed over, see browser agent logins without sharing passwords.

Connect an Electron app or a debugging port from an SDK

The command line refuses --cdp-url and --cdp-port. An Electron app, or a Chrome you start with a debugging port, has no extension, so connect from the Python, Node or Go SDK with cdp_port= or cdp_url=.

--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:

from fastbrowse import run_task

await run_task(
    "Open the Extensions view and report how many extensions are installed.",
    cdp_port=9222,
    attach=True,
    target_match="my-project",
)

Chrome can still ask you to allow remote debugging on each connection, and the run waits for that approval. Chrome ignores the debugging port on its default profile, so for a signed-in browser that stays open, 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"

Without attach=True, each run opens a background tab in that browser and closes it afterwards.

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

A DevTools port is for SDK runs. Anything on the machine that can reach one 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.

hosted

Run fastbrowse over an API

The same agent behind an API. Keys, secrets, run history and spend limits live in the console. Free to start.

create an account·plans and pricing