Log in once in a Playwright setup step, verify that authentication completed, save the browser context’s storage state, and load that state in the context that visits the protected page. Wait for the page’s actual content to be ready before capturing it. Treat the saved state like a password: it can contain credentials that let someone impersonate the account.
Set up Playwright and choose an authentication route
This workflow uses Playwright Test and TypeScript. Install the test runner if it is not already in the project:
As an Amazon Associate I earn from qualifying purchases.
npm init playwright@latest
For a normal sign-in flow, automate the website’s login form. If the application provides a supported authentication API, Playwright also documents signing in through an API request and saving that request context’s storage state; this can be a better fit than driving the UI. Use the route the application supports, and do not assume a private or undocumented endpoint is stable.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsLog in, confirm success, and save the state
Create tests/auth.setup.ts. Replace the example URL, selectors, and signed-in destination with values for the application under test.
#1 Best Overall
- Individual A-Z Tabs for Quick Access: No need for annoying searches! With individual alphabetical tabs, this password keeper book makes it easier to find your passwords in no time. It also features an extra tab for your most used websites. All the tabs are laminated to resist tears.
- Medium Size & Ample Space: Measuring 5.3"x7.6", this password book fits easily into purses, handy for accessibility. Stores up to 560 entries and offers spacious writing space, perfect for seniors. It also provides extra pages to record additional information, such as email settings, card information, and more.
- Spiral Bound & Quality Paper: With sturdy spiral binding, this logbook can 180° lay flat for ease of use. Thick, no-bleed paper for smooth writing and preventing ink leakage. Back pocket to store your loose notes.
- Never Forget Another Password: Bored of hunting for passwords or constantly resetting them? Then this password book is absolutely a lifesaver! Provides a dedicated place to store all of your important website addresses, emails, usernames, and passwords. Saves you from password forgetting or hackers stealing.
- Discreet Design for Secure Password Organization: With no title on the front to keep your passwords safe, it also has space to write password hints instead of the password itself! Finished with an elastic band for safe closure.
import { test as setup, expect } from '@playwright/test';
import path from 'node:path';
const authFile = path.join(__dirname, '../playwright/.auth/user.json');
setup('authenticate', async ({ page }) => {
await page.goto('https://example.com/login');
await page.getByLabel('Email').fill(process.env.TEST_USERNAME ?? '');
await page.getByLabel('Password').fill(process.env.TEST_PASSWORD ?? '');
await page.getByRole('button', { name: 'Sign in' }).click();
// Prefer a stable app-specific success signal. A final URL is one option.
await expect(page).toHaveURL('https://example.com/dashboard');
// Alternatively, assert a signed-in element:
// await expect(page.getByRole('button', { name: 'Account' })).toBeVisible();
await page.context().storageState({ path: authFile });
});
Do not save immediately after clicking the sign-in button. Authentication may involve redirects or asynchronous cookie updates; save only after a signal that is meaningful for the app, such as the final URL or a visible signed-in control. Sites with multi-step redirects may need the UI signal or another application-specific check.
Create the directory before running setup, and exclude it from version control. Add this to .gitignore:
playwright/.auth
Playwright also documents putting transient state in a test project output directory that is cleaned before the next run, when the state does not need to persist between runs.
Restore authentication and capture the protected page
Configure a setup project that runs before the project using the saved state. In playwright.config.ts:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
projects: [
{
name: 'setup',
testMatch: /auth.setup.ts/,
},
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
storageState: 'playwright/.auth/user.json',
},
dependencies: ['setup'],
},
],
});
Then write a test that visits the protected URL, waits for a real ready condition, and captures a screenshot:
Rank #2
- Never Forget a Password Again: Tired of forgetting your passwords? Say goodbye to the frustration of constantly juggling and resetting passwords. Our Password Book with Colorful Alphabetical Tabs helps you easily store and keep all your passwords in one secure place, saving you from the hassle of managing multiple passwords, with no visible labels or titles, protecting your sensitive information.
- Find Your Passwords Quickly & Easily: Need to find a password in seconds? This password keeper with alphabetical tabs makes it simple. With vibrant colors and clear A-Z prints, you can quickly locate what you need, making it a breeze to access your accounts.
- Easily Store Up to 900 Passwords: This password notebook features 240 pages of 120gsm thick paper, offering the capacity to store up to 900 passwords. Additionally, it provides ample space for internet service providers, wireless router settings, software licenses, email settings, frequently visited websites, and extra notes.
- Intimate Add-Ons for Enhanced Functionality: Measuring 8.4" x 5.8", this password keeper includes 2 ribbon bookmarks for easy navigation, a fine inner pocket at the back for additional storage, an elastic pen holder for convenience, and 120gsm paper to prevent ink bleeding. It's perfect for managing your passwords and more.
- A Thoughtful Gift for Any Occasion: Looking for a practical gift for your loved ones or colleagues? This Password Book is an ideal choice to alleviate the stress of password memorization. Suitable for both men and women, it's a considerate gift for family, friends, and colleagues on birthdays, holidays, or any special occasion.
import { test, expect } from '@playwright/test';
test('capture the signed-in report page', async ({ page }) => {
await page.goto('https://example.com/account/report');
await expect(page.getByRole('heading', { name: 'Report' })).toBeVisible();
await expect(page.getByTestId('report-content')).toBeVisible();
await expect(page).toHaveScreenshot('signed-in-report.png', {
fullPage: true,
});
});
Run the dependent project with npx playwright test. The setup project authenticates first; the Chromium project’s browser context then starts with the saved state. For a one-off capture outside a test, create a browser context with storageState: 'playwright/.auth/user.json', open a page, navigate, wait for the app-specific ready condition, and call page.screenshot({ path: 'signed-in-report.png', fullPage: true }).
Choose the right state and account strategy
Shared account or one account per worker
A single reusable account is reasonable when parallel runs do not interfere with shared server-side state and authentication is not browser-specific. If tests modify shared data, use distinct accounts per parallel worker so one test does not change another worker’s assumptions. For scenarios that need administrator and ordinary-user access at once, use separate contexts, each with the appropriate saved state.
Separate states for separate roles
Save separate administrator and user state files after authenticating each role, then assign the relevant state to each test project or context. Keep each file out of source control and limit access to the people and systems that need it.
UI login or API login
Use UI automation when the browser sign-in journey itself is part of what you need to exercise, or when the application has no supported easier route. Use API authentication when the application supports an authentication endpoint suitable for tests; save the request context’s state and load it into browser contexts. The API route can avoid repeated UI work, but it does not test the sign-in interface.
Know what storage state does—and does not—preserve
Playwright’s authentication state flow covers cookies and local storage, and documents support for IndexedDB and passkey (WebAuthn) authentication in supported flows. Feature availability is version-sensitive: the API reference identifies IndexedDB capture as added in v1.51, virtual WebAuthn credential capture in v1.61, and OPFS capture in v1.63. The same reference says OPFS is not supported in ephemeral WebKit contexts. Check the installed Playwright version and the specific API options before depending on these capabilities.
Rank #3
- 【Tired of constantly searching for or resetting your passwords?】 MOSA BEAR password keeper book is the perfect solution for you! This password book provides a dedicated place to securely store all your important website addresses, emails, usernames and passwords, ensuring your information is protected and easy to find. The well-designed log pages help you manage multiple accounts in a systematic way, saying goodbye to password confusion.
- 【Premium Design & Password Security】 The password book with alphabetical tabs features an anonymous cover design with no title on the cover, effectively avoiding information exposure. The password keeper design is specifically designed with password security in mind, providing space to record password hints instead of writing directly on the password itself, further protecting your important information.
- 【Simple Layout and Plenty of Space】The 160-page password logbook is designed to provide ample space to record passwords and other important information. It can store up to 414 passwords. In addition, it provides extra pages to record other information, such as email setup, card information, computer operating system information, software licenses, and more. The journal also includes 3 blank pages at the end for you to add additional notes.
- 【Palm-sized Size & Premium Quality】 This password notebook has an ideal size, 4.3" x 5.7", for carrying around, whether in a purse or pocket. Its sturdy glue binding allows the notebook to unfold smoothly and is more comfortable to use. The inner pages are made of high-quality 100GSM thick paper, which can effectively reduce ink penetration and ensure a cleaner and neater writing effect. The overall design takes into account both portability and durability, making it an ideal choice for recording important passwords.
- 【A-Z Tabs for Quick Search 】Our password book comes with alphabetical tabs to help you find the password you need quickly and easily. Alphabetically organized tabs ensure that you can quickly flip to the right section, saving you the time and hassle of searching for your password.
Session storage is a notable exception: the usual storage-state snapshot does not persist it. Playwright’s guide demonstrates saving it separately and restoring it with context.addInitScript on the matching hostname. Keep that script scoped to the intended origin, and do not place secrets in widely accessible files or logs. This matters when a site stores a required login token or other session data only in session storage.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Official guidance: Playwright authentication and the storageState API reference.
Make captures useful and repeatable
A URL change alone does not prove the protected page is ready. Wait for a meaningful app-specific element or content region before capturing; pages may render data after navigation completes. For visual comparisons, Playwright Test’s toHaveScreenshot assertion stores PNG snapshots by default. Naming a snapshot with a .webp extension selects WebP, which Playwright documents as lossless.
- Use a stable viewport, browser and application state when comparing captures.
- Wait for the content being evaluated, not just the navigation event.
- Use the screenshot assertion’s
stylePathoption to hide volatile elements, such as iframes, when they undermine deterministic comparisons. - Use
fullPage: truewhen the whole document matters; omit it when the intended result is only the visible viewport.
For ordinary page screenshots, use the Page API’s screenshot method. For a visual regression test, use toHaveScreenshot so the capture participates in Playwright Test’s snapshot assertion workflow. See Playwright screenshot assertions.
Protect saved authentication state
Playwright warns that a browser state file may contain sensitive cookies and headers that could be used to impersonate you or your test account. Do not commit it, including to a private repository. Keep credentials in environment variables or an appropriate secret store, restrict access to generated state, and avoid printing its contents in logs. Delete obsolete state when it is no longer needed.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, 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 minuteRank #4
- No more Password Aggravation:This book will simplify your electronic life and free you from the constant frustration of trying to remember and reset your passwords. You can record longer and more complex passwords and never forget them again.
- Alphabetical Tabs (A-Z): We upgraded to one letter one tab(A-Z),others are two letters share 5 pages(AB-YZ). Our password journal has 6 pages per alphabetical tab. Makes your password easy to find and keeps organized.
- Plenty of Space for Information: Each tab has 6 pages with 3 entries per page, it can contain over 414 passwords. There're additional pages, PC info, email settings and 8 pages of notes. We have reserved a place to write a password hint instead of the password itself to ensure password security.
- 100GSM No-Bleed Paper: This password notebooks are made of very thick 100gsm paper, no bleed through. Size 4.3in x 5.7in, suitable size for carry-on. 180°lay flat so it’s easy to write in.
- Excellent Gift to All Ages:Easy to use, keeps passwords organized. With an elastic band, pen holder, bookmarker and inner pocket. A great present for friends and family.
Troubleshoot login and screenshot failures
The protected URL redirects back to login
- Confirm setup waited for the final redirect or a signed-in UI signal before saving.
- Check that the protected project or context loads the exact state file written by setup.
- Determine whether the application depends on session storage, browser-specific authentication, or another state mechanism not represented in the saved snapshot.
- If the state expired, remove it and run authentication again.
The setup test does not run in UI mode
Playwright’s documentation notes that the setup project does not run by default in UI mode. When existing state has expired, manually run the authentication setup project to regenerate it.
Parallel tests change each other’s results
If workers mutate shared server-side data, replace the shared account with isolated accounts per worker. Separate browser contexts alone do not isolate data stored by the application’s server.
The screenshot is blank or incomplete
Check that the authenticated page actually loaded and that the readiness assertion targets content rather than merely the page shell. A successful login can still be followed by delayed data rendering; wait for the specific content the screenshot is meant to show.
State features behave differently across browsers or versions
Verify the installed Playwright version and browser context. IndexedDB, WebAuthn, and OPFS state behavior is version-sensitive, and OPFS capture is not supported in ephemeral WebKit contexts according to the API reference.
Free tools Windows power users keep installed
One-click scans. No signup required.
Or skip the browser setup
If you need a captured page rather than control over an authenticated Playwright session, ScreenshotNeo offers a screenshot API and MCP server. A request to its API returns an image or PDF; for login-protected pages, use Playwright when you must manage the site’s authenticated browser context yourself.
Best Value
- NEVER FORGET A PASSWORD AGAIN: Almost every App. has a password, it is almost impossible to remember all the password log in details. This password book is specifically designed to help you create secure passwords and store all your passwords safely in one place. You will never forget your password log-in details again with this password keeper.
- ALPHABETICAL A-Z TABS FOR QUICK ACCESS: Alphabetical tabs design allows you to store your passwords alphabetically so you can find what you want faster, no more annoying searches!
- ANONYMOUS WITHOUT ANY TITLE: On the outside, this password notebook organizer looks just like those writing journals, there is no title listed on the cover, so no one would know it's a password book. But we still recommend keeping the internet password logbook in a safe place such as a locked drawer or a shelf full of books.
- THICK NO-BLEED PAPER: This 5.2" x 7.6" password book contains 74 sheets of thick 120gsm paper that resists ink smearing, say goodbye to those cheap password books that bleed ink!
- PREMIUM QUALITY & PERFECT MEDIUM SIZE: This password journal comes with a high-quality leatherette hardcover, an elastic band, pen holder, ribbon bookmarker, and inner accordion pocket. It measures 5.2 inches wide and 7.6 inches long, which is the perfect size for your needs.
For a public page, this cURL request saves a WebP screenshot. See the ScreenshotNeo documentation for the API options and authentication details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never 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 ScreenshotNeo’s free plan.
Frequently Asked Questions
Can I use one saved Playwright state file for every test?
Only when tests can share the same account without conflicting server-side changes and the authentication is compatible with the browser context. For state-changing parallel tests, use separate accounts per worker.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Does Playwright’s storage state include sessionStorage?
No. The usual storage-state snapshot does not persist session storage; save and restore it separately when the application requires it.
Can Playwright take a screenshot of a page after login without a test assertion?
Yes. Navigate with a page in a context configured with the saved state, wait for the protected content, then call the Page API’s screenshot method.
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.




