Profiles
A profile saves your login, your cookies and site data, so you don't have to sign in again. Log in once, attach the profile to any session, and you start already signed in.
Create a profile
const profile = await client.profiles.create({ name: "amazon-seller" })
console.log(profile.id) // "prof_abc123"Log in from your browser
Open the profile in the console → Profiles → Open editor to drive a live browser right in your tab. Log into your sites, click through any prompts, then hit Save. This is the easy way to handle sites with 2FA or captchas.
Upload an existing login
Already have a working storageState.json from Playwright? Upload it directly:
import { readFile } from "node:fs/promises"
const storageState = JSON.parse(await readFile("./storage-state.json", "utf-8"))
await client.profiles.save(profile.id, storageState)Attach to a session
const session = await client.sessions.create({
profileId: "prof_abc123",
})
console.log(session.storageState?.cookies?.length, "cookies loaded")A profile can only be applied when a browser context is created: there is no way to retrofit cookies onto a context that already exists. That means attaching a profile seeds exactly one context: the session's default one.
The launch() wrapper (TS and Python) handles this for you: it creates that default context itself and exposes it as session.context (session.context/browser_session.context); use that, or session.newPage(), rather than browser.contexts()[0], which is not guaranteed to be the seeded one.
A context you create yourself (via session.newContext(), or by connecting with raw CDP and calling the browser's own newContext()) does not carry the profile. Apply session.storageState to it yourself at creation time if you need the login there too.
Edit an existing profile
To change what a profile holds (sign in again, add another site, remove a login), start an edit. It returns a link to the profile editor. A person opens the link, makes the changes in a live browser, and your code then saves them or throws them away.
- The link is valid for 30 minutes, or until the edit is saved or exited. The editor starts when the person opens it.
- Nothing is saved automatically. Save and close saves the changes and closes the editor; exit closes it and discards them. There is no way to save without closing.
TypeScript
const editor = await client.profiles.edit("prof_abc123", {
reason: "Sign in to GitHub again", // optional, shown to the person
})
console.log(editor.url, editor.expiresAt) // show the link to the person
// Option A: wait for them to save in the editor, then you are done.
await editor.waitForSave({ timeoutMs: 10 * 60_000 })
// Option B: you decide when it is over.
await editor.saveAndClose() // saves and closes
// await editor.exit() // closes without saving
const state = await editor.status() // { editorStatus, version }Python
editor = await solari.profiles.edit("prof_abc123", reason="Sign in to GitHub again")
print(editor.url, editor.expires_at) # show the link to the person
# Option A: wait for them to save in the editor.
await editor.wait_for_save(timeout_s=600)
# Option B: you decide when it is over.
await editor.save_and_close() # saves and closes
# await editor.exit() # closes without saving
state = await editor.status() # editor_status, versionGo
ed, err := client.Profiles.Edit(ctx, "prof_abc123", "Sign in to GitHub again") // "" = no reason
if err != nil { return err }
fmt.Println(ed.URL, ed.ExpiresAt) // show the link to the person
// Option A: wait for them to save in the editor (0 = until the link expires).
version, err := ed.WaitForSave(ctx, 10*time.Minute)
// Option B: you decide when it is over.
version, err = ed.SaveAndClose(ctx) // saves and closes
// err = ed.Exit(ctx) // closes without saving
state, err := ed.Status(ctx) // state.EditorStatus, state.VersionRust
let ed = client.profiles().edit("prof_abc123", Some("Sign in to GitHub again")).await?;
println!("{} {:?}", ed.url, ed.expires_at); // show the link to the person
// Option A: wait for them to save in the editor (None = until the link expires).
let version = ed.wait_for_save(Some(Duration::from_secs(600))).await?;
// Option B: you decide when it is over.
let version = ed.save_and_close().await?; // saves and closes
// ed.exit().await?; // closes without saving
let state = ed.status().await?; // state.editor_status, state.versionC++
solari::browser::ProfileEditor ed = client.profiles.edit("prof_abc123", "Sign in to GitHub again");
std::cout << ed.url << "\n"; // show the link to the person
// Option A: wait for them to save in the editor (0ms = until the link expires).
long long version = ed.waitForSave(std::chrono::minutes(10));
// Option B: you decide when it is over.
version = ed.saveAndClose(); // saves and closes
// ed.exit(); // closes without saving
solari::browser::EditorState state = ed.status(); // state.editorStatus, state.versionMCP
Two tools. solari_browser_edit_profile takes a profileId and returns the link, its expiry and a handoffId; show the link to the person and keep the handoffId. When they say they are done, call solari_browser_finish_profile_edit with the profileId, the handoffId and save: true (save and close) or save: false (close without saving).
{ "tool": "solari_browser_edit_profile", "arguments": { "profileId": "prof_abc123" } }
{ "tool": "solari_browser_finish_profile_edit",
"arguments": { "profileId": "prof_abc123", "handoffId": "<from the first call>", "save": true } }Errors
The link and the editor each fail in a way you can recover from by starting a new edit:
- 404: the link expired, was already used, or is not for this profile. Start a new edit for a fresh link.
- 409: the editor is not open, either because the person has not opened the link yet or because it was already closed.
- 502 on save: the save failed on our side and the editor goes into an error state, so saving again is refused with a 409. Do not retry the save: exit the editor, then start a new edit for a fresh link.
- 408 from the wait-for-save helpers: no save happened before your timeout or before the link expired.
List and delete
const profiles = await client.profiles.list()
for (const p of profiles) console.log(p.id, p.name)
await client.profiles.delete("prof_abc123")What's inside
Profiles use Playwright's standard storageState, the same JSON that context.storageState({ path }) writes.
type StorageState = {
cookies?: Array<{
name: string
value: string
domain?: string
path?: string
expires?: number
httpOnly?: boolean
secure?: boolean
sameSite?: "Strict" | "Lax" | "None"
}>
origins?: Array<{
origin: string
localStorage?: Array<{ name: string; value: string }>
}>
}
