browser object: browser={"profile_id": ...}. On a standalone browser, it is a top-level param: browser_profile_id. The browser starts with the profile’s saved cookies and logins already in place. Don’t have a profile yet? Create one first.
Attach it
Persist state on a browser you drive (CDP)
Profiles work the same whether the agent drives or you do. Passbrowser_profile_id to browsers.create(), set state over CDP, then stop the browser to flush cookies and localStorage into the profile. Reconnect later with the same browser_profile_id and the state is there.
Python
Use a site that actually sets cookies/localStorage to verify persistence —
example.com sets none, so it is a poor test target.Next
Create a profile
Create, list, rename, and delete profiles.
Log in with the agent
Have the agent do the first login and save the session.