Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To share session cookies between headless Chrome tabs, open those tabs in the same browser context. In Playwright, create each page with the same BrowserContext; in Puppeteer, create them with the same browser context. Pages in separate contexts have separate cookie jars, so copy or restore authentication state explicitly when isolation is required.

Why the browser context is the sharing boundary

A browser context is an isolated browser session. Pages opened inside one context share its cookies and related browser storage; separate contexts are isolated from one another. In Playwright, browser.newContext() creates an isolated context, and browserContext.addCookies() adds cookies to every page in that context. Playwright BrowserContext documentation

This distinction explains the common symptom of a second automated page appearing logged out: it may have been created in a different context from the page where login occurred. A page opened using window.open remains in its parent page’s context.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Share cookies between Playwright pages

Create one context, complete login in a page belonging to it, then create the other pages from that same context. The following is a runnable structure; replace the example URL and add the site’s actual login steps.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import { chromium } from 'playwright';

const browser = await chromium.launch({ headless: true });
const context = await browser.newContext();

try {
  const login = await context.newPage();
  await login.goto('https://example.com/login');
  // Perform the site's login steps and wait for authentication to complete.

  const tabA = await context.newPage();
  const tabB = await context.newPage();
  await Promise.all([
    tabA.goto('https://example.com/account'),
    tabB.goto('https://example.com/orders')
  ]);
  // Both pages use cookies from the same context.
} finally {
  await context.close();
  await browser.close();
}

The example assumes login has actually completed before the other pages navigate. Adapt the login action and completion check to the application; simply loading a login form does not authenticate the context.

Share cookies between Puppeteer pages

In Puppeteer, create the pages from one browser context. The browser context’s cookies and local storage are not shared with other contexts. Puppeteer BrowserContext documentation

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({ headless: true });
const context = await browser.createBrowserContext();

try {
  const login = await context.newPage();
  await login.goto('https://example.com/login');
  // Perform the site's login steps and wait for authentication to complete.

  const tabA = await context.newPage();
  const tabB = await context.newPage();
  await Promise.all([
    tabA.goto('https://example.com/account'),
    tabB.goto('https://example.com/orders')
  ]);
  // Both pages belong to the same context and use its cookies.
} finally {
  await context.close();
  await browser.close();
}

Use separate contexts when tests represent different users or need isolation. Do not expect a page in another context to inherit the login merely because it belongs to the same browser process.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Transfer authenticated state to an isolated context

For parallel workers or tests that need separate contexts but should begin from one authenticated login, export Playwright storage state after login, then initialize another context with it. Playwright’s storage-state features cover cookies and, depending on the selected options and version, can include local storage, IndexedDB, origin private file-system data, and virtual WebAuthn credentials. Check the API documentation for supported options in the Playwright version used by your project. Playwright BrowserContext documentation

// After login has completed in context:
const state = await context.storageState({ path: 'state.json' });

// Seed an isolated worker context from the saved state:
const workerContext = await browser.newContext({ storageState: 'state.json' });

// Alternatively, use the state object directly where supported:
// const workerContext = await browser.newContext({ storageState: state });

The documented API also supports setting storage state on a context in versions that provide setStorageState; verify availability against the version installed rather than assuming every project has the same API.

Treat the saved file as a credential: it can contain live authentication material. Keep it out of source control, restrict access, and delete or rotate it when no longer needed. A saved state can become stale if the session expires or the application rotates its tokens.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Copy cookies directly when only cookies are needed

If the destination context only needs cookies, retrieve them from the source and add them to the destination. In Playwright:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const cookies = await context.cookies();
await workerContext.addCookies(cookies);

Cookies must be valid for the destination URL. Preserve the cookie’s domain, path, secure, httpOnly, sameSite, and expiry attributes when transferring or creating cookie records. Cookie records require the appropriate name, value, domain, and path. A leading dot on a domain can make a cookie apply to subdomains, where applicable. Playwright BrowserContext documentation

Copying only cookies is narrower than transferring storage state: it does not carry local storage, IndexedDB, sessionStorage, or passkeys. It also does not guarantee that the server will accept the copied session. The application may bind a session to a device or IP address, rotate tokens, or enforce other server-side rules.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Choose the right approach

Approach Isolation Survives browser restart? Storage included Parallel testing and identity risk
Pages in the same context Pages share the context’s state; separate contexts remain isolated. No, not by itself. Shared live context state. Simple for tabs representing one identity; do not use one context for tests that must stay separate.
Export/import storageState Each worker can have its own context, seeded from exported state. Saved state can be reused while still valid. Cookies and, depending on options and version, other supported state such as local storage and IndexedDB. Useful for parallel workers; each worker starts with copied authentication state, which can expire or be rotated.
Direct cookie transfer Destination remains a separate context. Only if cookies are separately saved and restored; direct transfer alone is not persistence. Cookies only. Useful when the application authenticates from cookies; easy to mis-scope or expose sensitive values.
Persistent profile State belongs to a user-data directory rather than an ephemeral context. Yes, profile data is stored on disk. Browser session data such as cookies and local storage. Useful for durable profile state; do not launch multiple browser instances against the same user-data directory.

Use a persistent profile for durable browser state

When state must remain across browser launches, Playwright’s launchPersistentContext(userDataDir) uses a user-data directory to retain browser session data such as cookies and local storage. A browser must not have multiple instances launched against the same directory. Keep directories separate when they represent different accounts or identities. Playwright BrowserType documentation

A persistent profile is different from exporting a state snapshot: the browser uses its profile directory over time, while a state export is a transferable snapshot for seeding contexts. Protect the profile directory as carefully as a credential store.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When cookies are not the whole login

Some applications keep authentication or related state outside cookies. Playwright’s authentication guidance covers cookies, local storage, IndexedDB, and passkeys. sessionStorage is scoped to an origin and is not persisted by a built-in Playwright API; where an application depends on it, save and restore it with an initialization script appropriate to the site’s origin and timing. Playwright authentication documentation

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Cookie behavior is also affected by domain, path, Secure, HttpOnly, SameSite, and expiration settings. A cookie visible in one context may not be sent on a request to a different host, path, or protocol. Inspect the target site’s actual cookie scope rather than broadening a cookie’s domain speculatively.

Troubleshoot a second page that appears logged out

  • Check the context: confirm both pages came from the same Playwright context or Puppeteer context, not separate context-creation calls.
  • Wait for login completion: create or navigate the other pages only after the application has established the session. Wait for an authenticated URL, UI element, or other app-specific signal.
  • Check the cookie scope: verify domain, path, Secure and SameSite attributes, and expiry against the destination URL.
  • Check non-cookie state: determine whether the app depends on local storage, IndexedDB, sessionStorage, or passkeys, and use a storage-state mechanism that carries the required data.
  • Check server-side session rules: a transferred cookie may be expired, rotated, device-bound, or rejected for application-specific reasons.
  • Check isolation choices: if identities are mixing, stop sharing a context or profile directory and create separate ones for separate users.
  • Protect credentials: do not print cookie values or commit storage-state files, profile directories, or logs containing session material.

Or skip the browser setup

If your goal is a screenshot rather than controlling a logged-in browser session, ScreenshotNeo provides a website screenshot API and MCP server. A single GET request returns a PNG, JPEG, WebP, or PDF. It is not a replacement for transferring an authenticated session into your own browser automation; use it when you need to capture a page through the service.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for request options. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers indicate the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.

Sign up for 1,000 free screenshots a month, with no card.

Frequently Asked Questions

Does opening a new tab share cookies?

It does when the new page belongs to the same browser context; a page in another context has separate state.

Will a copied cookie always keep me logged in?

No. The cookie must match the destination’s scope and remain valid, and the application can apply server-side session rules.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.