Guides / Guide
What is a persistent browser profile?
Understand saved browser state, profile ownership, expiry, and safe reuse between tasks.
A persistent browser profile is saved browser data that can be reused across browser runs. It commonly helps automation reuse cookies and site storage after a previous login. A profile is different from a browser process: saving data does not keep pages executing after the process stops.
Profile, context, and session
A browser profile holds data associated with a browser identity. A browser context provides a separate browsing state within a browser. A hosted session provides the running runtime. These objects can be connected by a service, but their lifetimes and isolation guarantees are different.
Playwright also supports exporting authentication state. That is a library-level mechanism with its own coverage; it should not be assumed to be a complete disk profile. Consult the Playwright authentication guide when choosing between saved state and a provider-managed profile.
Choose a profile ownership boundary
Create a mapping between an authorized website account, a tenant, and the profile permitted to hold that account's state. Use opaque identifiers in operational logs instead of human-readable account secrets. Restrict both profile access and browser endpoint access: either may expose a logged-in account.
Avoid sharing one writable profile among concurrent jobs unless the service explicitly supports that pattern. Two workers can otherwise navigate the same session, change account settings, or overwrite saved state. A queue or ownership lease is often easier to reason about than unrestricted shared access.
Persistence is not permanent authentication
Websites can expire cookies, revoke sessions, require two-factor authentication, or ask for a fresh login. Persistence reduces repeated setup when the website accepts the saved state; it does not bypass those controls.
Before a task with side effects, verify the account and destination. A successful page load is not proof that the correct account is active. Build a recovery step for login renewal and use the 2FA workflow when human participation is needed.
Separate retained state from temporary evidence
Decide independently how long to retain the profile, screenshots, downloads, and recordings. A profile may contain long-lived credentials, while screenshots may contain sensitive business data. Each requires an access policy and a deletion path.
A practical evaluation should test saving, terminating, reopening, checking the account, renewing expired authentication, and deleting the profile. Document which state survives each transition and which must be reconstructed.
For Remote Browser configuration, use the profile documentation. For the broader lifecycle, read what a browser session is.