Logo of LexmountLexmount Browser
DocsBlog
Console→
Logo of LexmountLexmount Browser

Product

  • Features
  • Quick Start
  • Templates

Resources

  • Blog
  • Documentation
  • Changelog

Company

  • About
  • Contact
  • Waitlist
Lexmount Browser

Elastic cloud browser infrastructure for AI agents

GitHubEmail
Cookie PolicyPrivacy PolicyTerms of Service

© 2026 Lexmount Browser All Rights Reserved.

Identity and state

Reuse browser state across Sessions

Store cookies and local storage in a persistent Context for reuse in later Sessions, reducing repeated logins across automation tasks.

View integration options
Example · reuse browser state in a new Session
Example · reuse browser state in a new Session

Integration options

Replace the variables, then copy this prompt to your agent
Mandatory prerequisite: First fetch and fully execute the official Lexmount Setup Prompt returned by https://browser.lexmount.com/api/agent-setup/browser-cli, completing installation, authentication, and environment validation. Continue only after every check passes. If the URL is unreachable or validation fails, stop immediately and report it; never skip the setup or pretend it succeeded.
Task: Use browser-cli only to complete one public demo login at https://www.saucedemo.com/, then create a new Session with the same persistent Context and verify that the authenticated state is reused.
Flow: Create a persistent Context and Session 1. Open the login page and confirm that it displays the public demo username standard_user and password secret_sauce. Enter those values and submit the form. Confirm that the final URL pathname is /inventory.html and that the element matching [data-test="inventory-container"] is visible, then close Session 1 without logging out.
Execution: Wait until the Context is available again, create Session 2 with the same Context, and open https://www.saucedemo.com/inventory.html directly. Confirm that the page does not return to the login form and that [data-test="inventory-container"] remains visible. Never request or use real credentials. If human verification unexpectedly appears, hand control to the user only through Remote View.
State: Save the Context reference, authenticated URL, origin, and ownership metadata to .lexmount/persistent-login-state.json in the working directory. Do not save login values, cookies, or browser storage. If the file already exists, add a UTC timestamp instead of overwriting it.
Acceptance: Success requires both Sessions to use the same Context, Session 2 to retain the authenticated state without another login, both Sessions to close successfully, and the Context to remain reusable. The generated state JSON must be available as a clickable file in the final Codex response.
Cleanup: On success, failure, timeout, or cancellation, close only the Sessions created for this task and retain the Context. If closing fails, report "partial success." Never close a pre-existing Session or Context.
Return only the status, authenticated URL, cross-Session verification result, Context availability, cleanup result, and error summary, then provide the generated state JSON file as the final item so it can be opened directly in Codex. Do not expose API keys, Project IDs, Session IDs, connection URLs, login values, cookies, or browser storage.