Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11In both Puppeteer and Playwright, a BrowserContext is the boundary for a browser session: pages in the same context share that session’s identity and storage, while separate contexts isolate them. Create a context for each independent user or test, put its pages inside it, and close it when the session is finished. For signed-in Playwright tests, save and restore storage state; handle sessionStorage separately.
What a browser session means in these frameworks
A session is not the same thing as a single tab. A BrowserContext owns pages and their browser-side identity, including relevant storage such as cookies and local storage. Pages and popups in one context share that context; separate contexts act as isolated profiles. Playwright describes its non-persistent contexts as incognito-like and says they do not write browsing data to disk. See the Playwright isolation guide, Puppeteer BrowserContext API, and Playwright pages guide.
As an Amazon Associate I earn from qualifying purchases.
Use a context when you need a distinct signed-in user, an isolated test, or a clean short-lived browsing task. Use multiple pages in one context when those pages should share the same session. Closing a context closes its pages. Neither framework permits closing the browser’s default context; create and close your own context instead.
Create, use, and end a session
Playwright
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
try {
const context = await browser.newContext();
try {
const page = await context.newPage();
await page.goto('https://example.com');
// Perform work. Any additional pages in this context share its session.
} finally {
await context.close();
}
} finally {
await browser.close();
}
})();
Puppeteer
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
try {
const context = await browser.createBrowserContext();
try {
const page = await context.newPage();
await page.goto('https://example.com');
// Perform work. Create other pages in this context if they need this session.
} finally {
await context.close();
}
} finally {
await browser.close();
}
})();
The examples use the frameworks’ documented context APIs. Keep context lifetime aligned with the identity you intend to share: reuse one context across related pages, but do not share it between users or tests that need isolation.
#1 Best Overall
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
Save and reuse signed-in state with Playwright
Playwright’s authentication workflow lets you capture browser storage to a file and use it to initialize later contexts. This is useful when tests need to start signed in rather than repeat a login flow. The official authentication guide recommends creating authenticated state once, then reusing it in tests.
Capture state
const { chromium } = require('playwright');
const path = require('node:path');
(async () => {
const browser = await chromium.launch();
try {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com/login');
// Complete your application's login flow here.
await page.getByRole('button', { name: 'Sign in' }).click();
await page.waitForURL('**/account');
const authFile = path.join('playwright', '.auth', 'user.json');
await context.storageState({ path: authFile });
await context.close();
} finally {
await browser.close();
}
})();
The login controls and resulting URL are application-specific; replace them with selectors and a success condition for your site. Create the destination directory before writing if it does not already exist.
Restore state in a new context
const { chromium } = require('playwright');
const path = require('node:path');
(async () => {
const browser = await chromium.launch();
try {
const authFile = path.join('playwright', '.auth', 'user.json');
const context = await browser.newContext({ storageState: authFile });
try {
const page = await context.newPage();
await page.goto('https://example.com/account');
// Continue as the authenticated user, subject to the app's session rules.
} finally {
await context.close();
}
} finally {
await browser.close();
}
})();
In Playwright Test, the same state can be configured for test contexts. The test runner creates a fresh context per test by default, which helps prevent one test’s browser state from carrying into another. Follow the authentication guide’s setup pattern for your installed Playwright Test version.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
- Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
- G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
- Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
- The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere
Know which storage is included
Playwright’s guide documents storage-state reuse for cookies and local storage. The current BrowserContext API reference also describes state for IndexedDB, origin private file system entries, and virtual WebAuthn credentials. Some capture options are version-gated: for example, IndexedDB capture is option-controlled, and the API reference identifies virtual WebAuthn credential capture as version-gated. If an application keeps authentication data in IndexedDB, check the installed version’s API options; the guide names Firebase Authentication as one example.
Do not assume a saved state includes every mechanism an application might use. Identify whether it depends on cookies, local storage, IndexedDB, session storage, or WebAuthn before relying on a restored context.
Restore sessionStorage separately
Playwright’s ordinary storage-state workflow does not persist sessionStorage. The authentication guide explains that session storage is scoped to a domain and is not persisted across page loads. If your application requires it, read the values from an authenticated page and inject them into a new context before the application scripts run. Scope the injection to the intended host; do not copy credentials to unrelated origins.
Rank #3
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
// On the page with the desired sessionStorage:
const savedSessionStorage = await page.evaluate(() => {
const values = {};
for (let i = 0; i < window.sessionStorage.length; i++) {
const key = window.sessionStorage.key(i);
values[key] = window.sessionStorage.getItem(key);
}
return values;
});
// In the new context, before navigating to the application:
await context.addInitScript((storage) => {
if (window.location.hostname === 'example.com') {
for (const [key, value] of Object.entries(storage)) {
window.sessionStorage.setItem(key, value);
}
}
}, savedSessionStorage);
const page = await context.newPage();
await page.goto('https://example.com');
Keep the captured values protected like other authentication material. Match the hostname condition to the application and storage you actually intend to restore.
Manage cookies at the context level
For session-wide cookie work, use context APIs rather than treating the page as the session. Playwright provides cookies(), addCookies(), and clearCookies(). Cookie records can be scoped with a URL or a domain-and-path pair and include attributes such as expiry, httpOnly, secure, sameSite, and optional partition keys. Puppeteer documents context-level cookie retrieval, setting, deletion, and deletion of matching cookies; its cookies guide also describes direct browser-storage manipulation for test preparation.
// Playwright examples
const currentCookies = await context.cookies('https://example.com');
await context.addCookies([
{
name: 'example_session',
value: 'replace-with-test-value',
url: 'https://example.com',
httpOnly: true,
secure: true,
sameSite: 'Lax'
}
]);
await context.clearCookies();
Use test credentials and valid cookie attributes for the target application; the sample value is not a real session token. Consult the installed API reference for the precise argument shape supported by your framework version.
Rank #4
- Computer mouse for easily navigating a computer interface; click, scroll, and more
- USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
- High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
- 3 buttons offer effortless fingertip control
- Plug-and-go ready for instant use
Translate common Puppeteer cookie operations to Playwright
Playwright’s migration guide gives these direct mappings. For new Playwright code, prefer the context-level methods.
| Puppeteer operation | Playwright equivalent |
|---|---|
page.setCookie(...cookies) |
browserContext.addCookies(cookies) |
page.cookies([...urls]) |
browserContext.cookies([urls]) |
| Cookie deletion | browserContext.clearCookies() |
The mapping concerns cookies, not a guarantee that all application authentication can be migrated by copying cookies alone. Check other storage mechanisms when a restored session does not behave as expected.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Keep authentication state out of source control
A Playwright storage-state file may contain cookies and headers capable of impersonating an account. Treat it like a password or bearer token: restrict access, avoid logging or sharing it, and exclude the authentication directory from version control. The Playwright guide suggests playwright/.auth and strongly discourages checking state files into repositories, including private ones. Add an ignore rule such as:
Best Value
- 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
- 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
- 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
- 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
- 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.
# .gitignore
playwright/.auth/
Use a minimally privileged test account where possible, and rotate credentials if a state file is exposed.
Common session problems and fixes
- A new page appears signed out: Check that it was created from the intended context, not a separate context or the browser default context. Pages in the same context share session identity.
- A context close unexpectedly closes several tabs: That is expected; the context owns those pages. Use separate contexts for independent lifetimes.
- Restored Playwright state does not authenticate: Verify the saved file was captured after login succeeded, that the new context loads the correct file, and that the application’s authentication data is not in storage omitted by your chosen state capture.
- Authentication works until a reload or new page: Check whether the application relies on
sessionStorage, which the ordinary storage-state flow does not persist. If so, use a narrowly scoped initialization script before navigation. - IndexedDB-backed login is missing: Confirm that the application uses IndexedDB and that your installed Playwright version supports and enables the relevant capture option.
- Cookie is absent or rejected: Confirm its URL or domain/path scope and attributes such as expiry, secure transport, and same-site policy; use the context cookie API and inspect the installed API reference for accepted fields.
- A method or option is unavailable: Check the versions installed in the project before copying version-specific API calls. The Playwright API reference includes recently added methods such as
setStorageStatein v1.59; the Puppeteer BrowserContext reference identifies version 25.12.0.
Or skip the browser setup
If the goal is a page image or PDF rather than an interactive browser session, ScreenshotNeo can capture it with one GET request. For example, using cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.
Sign up for 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Does Playwright storageState save sessionStorage?
No. The standard workflow does not persist it; use a host-scoped initialization script if the application needs it.
Can I use one BrowserContext for several pages?
Yes. Pages in the same context share its session identity; create separate contexts when identities or lifetimes must be isolated.
Can I close the browser’s default context?
No. Create a separate context for work you need to close; closing that context closes its pages.
Recommended Free Tools
Quick Recap
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.




