Browser Infrastructure Browser
Fundamentals/Beginner

Cookies

Parsing, serializing, and injecting cookies to maintain persistent session states and bypass repeat logins.

Dependency Path
Requires:
Used By:
Environment Target
Compatibility: Chrome >= 110
Last Reviewed: 2026-07-18
Recipes: 10 (6 cookbook / 4 playbook)

Why It Matters

Parsing, serializing, and injecting cookies to maintain persistent session states and bypass repeat logins.Also known as: cookie, cookie jar, session cookie.

cookieshttpstate

Cookies are key-value state parameters sent by the browser in HTTP headers. In browser automation, dumping active cookies allows you to recreate states without walking through interactive login steps.

Strategic Implementation

  1. JSON Serialization: Convert cookies into array schemas containing expiry dates, domain bounds, and paths.
  2. Injecting Before Navigation: Set cookies via CDP before triggering page navigation to prevent redirection loops.
  3. Decoupled domains: Inject cookies targeting specific subdomains separately to honor security scopes.

Example Recipes

+4 more recipes in the knowledge base

Book Coverage

Python Browser Automation Cookbook
6 recipes covering this concept
Browser Automation Playbook
4 recipes covering this concept

Next Steps