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 errorsStore Playwright login state as a short-lived secret, not as a file in your repository. Generate it in a trusted setup job or inject it into a trusted scheduled runner, restrict which workflows can read it, use it only for the screenshot run, and protect screenshots, traces, reports, and logs as carefully as the state itself.
Why Playwright login state needs secret-level protection
Playwright’s storageState is not just browser configuration. It can include cookies, local storage, IndexedDB, origin private file system entries, and virtual WebAuthn credentials. Depending on the application, that data may let someone act as the authenticated user. Playwright explicitly warns that saved authentication files can contain sensitive cookies and headers. Treat the file like a password or session token, and keep it out of source control. Playwright authentication guidance and the BrowserContext API reference describe the data involved.
As an Amazon Associate I earn from qualifying purchases.
If virtual WebAuthn credentials are captured, the storage state can contain their private keys. Enable that capture only when the application requires it, and apply the same or stricter access controls as for other authentication material.
Choose a state lifecycle for the scheduled job
Two patterns work; the right one depends on whether your application supports repeatable automated login and how long its authentication state remains valid. Playwright documents saving and reusing state, but does not prescribe a secret manager or CI delivery mechanism.
#1 Best Overall
- USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
- Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
- Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
- Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
- Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty
| Pattern | How it works | Trade-off |
|---|---|---|
| Generate state on each run | A trusted setup step signs in, writes state, then the screenshot step reuses it within that run. | Reduces state retained between runs, but requires reliable automated login and secure handling of the primary credentials. |
| Inject previously generated state | A trusted scheduled runner receives a protected state file at runtime and uses it for capture. | Can accommodate difficult interactive login flows, but requires careful rotation, expiry checks, and access restriction. |
Before choosing, check whether login can be automated without bypassing required MFA, how often state expires, whether your CI can scope secrets to trusted jobs, how long files persist on runners, and whether screenshots or diagnostic artifacts expose sensitive account data. These details vary by application and CI provider.
Generate and use state within a trusted Playwright run
For a recurring job that can authenticate reliably, generate state in a setup project and use it only in the dependent screenshot project. The following TypeScript example uses the documented Playwright setup-project pattern. Adapt the login steps and the page under capture to your application; the credentials should be provided by your CI’s protected secret mechanism, not hard-coded or committed.
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'setup',
testMatch: /.setup.ts/,
},
{
name: 'screenshots',
dependencies: ['setup'],
use: {
storageState: 'playwright/.auth/user.json',
},
},
],
});
// tests/auth.setup.ts
import { test as setup, expect } from '@playwright/test';
const authFile = 'playwright/.auth/user.json';
setup('sign in and save state', async ({ page }) => {
const username = process.env.APP_USERNAME;
const password = process.env.APP_PASSWORD;
if (!username || !password) throw new Error('Missing login secrets');
await page.goto(process.env.APP_LOGIN_URL!);
await page.getByLabel('Email').fill(username);
await page.getByLabel('Password').fill(password);
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page).toHaveURL(/dashboard/);
await page.context().storageState({ path: authFile });
});
// tests/capture.spec.ts
import { test, expect } from '@playwright/test';
test('capture authenticated page', async ({ page }) => {
await page.goto(process.env.APP_SCREENSHOT_URL!);
await expect(page.getByRole('main')).toBeVisible();
await page.screenshot({ path: 'artifacts/page.png', fullPage: true });
});
Create the auth directory before the setup project runs, or ensure your workflow creates it. Keep the state file in a workspace location that is not uploaded as a normal artifact. Playwright’s configuration can clean output directories between runs; use that behavior where state need not persist. If injecting a pre-generated file instead, write it into the runner’s temporary workspace with restrictive access and point storageState at that path.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
- Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
- Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
- Sleek, durable metal casing
- Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]
Ignore state files in Git
Add the authentication directory to .gitignore, as Playwright recommends:
# .gitignore
playwright/.auth/
Ignoring a file prevents future untracked copies from being added; it does not remove one already committed. If state was committed, revoke or expire the associated sessions where possible, remove the file from the repository history according to your organization’s process, and review any clones or artifacts that may retain it.
Restrict workflow triggers and permissions
Make the screenshot workflow run only on approved schedules or other trusted events. Do not expose authentication secrets to untrusted pull-request code. Playwright’s CI guidance notes that workflows triggered by pull requests from forks cannot access repository secrets; preserve that boundary rather than weakening it to make capture run. Give the job only the CI or cloud permissions it actually requires. Exact permission syntax depends on the provider and is not universal. See Playwright’s CI guidance.
Rank #3
- What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
- Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
- Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
- Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
- Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers
Protect state and artifacts after each run
Authentication state is only one sensitive output. A screenshot of a signed-in page may show private or regulated information. Playwright warns that traces, HTML reports, and console logs can also expose credentials, access tokens, test source code, or application source code.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows 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 reinstall- Upload screenshots and diagnostics only to artifact storage approved for the data they contain; encrypt before sharing if required by your policy.
- Restrict artifact readers and use the shortest retention period that still supports the job. Playwright’s GitHub Actions example uses
retention-days: 30; that is an example configuration, not a universal security recommendation. - Do not print raw cookies, state JSON, authorization headers, or secret values to logs. Avoid uploading the auth file alongside screenshots.
- Use an ephemeral runner or workspace when available, and remove generated state after the job completes. Also check whether your CI preserves workspaces or caches between runs.
Handle expiry, session storage, and refresh failures
Authentication lifetime is set by the application, not by Playwright. Verify the expected lifetime and what an expired session looks like. When the scheduled capture is unauthenticated or redirected to login, fail the run safely and use an approved refresh or login process; do not solve it by dumping state into logs or a broadly readable artifact. Delete expired state rather than continuing to reuse it.
Playwright’s standard storage-state mechanism does not persist sessionStorage. If the application actually depends on it, Playwright’s authentication guide documents a custom save-and-restore pattern. Keep any separately saved session data secret, limit its lifetime, and test the restore behavior against the application. Avoid adding this workaround when cookies or local storage already provide the required session.
Rank #4
- GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
- BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
- EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
- TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
- WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.
For WebAuthn-based flows, confirm whether virtual credential capture is necessary. Since such captured state can include private keys, do not enable it casually or send it to a less-trusted runner.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If you need a screenshot of a public page rather than a page authenticated as your user, ScreenshotNeo can return a screenshot or PDF from one API request. It is a screenshot API and MCP server; it does not replace Playwright state for private pages that require your application login.
For example, a scheduled job can request a public page directly with cURL:
Best Value
- 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
- 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
- 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
- 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
- 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for options and response behavior. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture, with each cleanup step optional. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for the free plan.
Troubleshooting scheduled captures
- The capture redirects to login: the state may have expired, failed to generate, or target a different account or environment. Confirm the setup step reached an authenticated page before saving, then refresh state through the approved flow.
- State file not found: verify the setup job created the parent directory, the path is relative to the runner’s working directory as expected, and a separate job actually received the file securely.
- Login setup hangs or fails at MFA: the application may not support the chosen non-interactive flow. Do not weaken MFA or expose credentials to untrusted jobs; use an approved state-generation process or a trusted pre-generated state workflow.
- Page loads but looks logged out: check whether the application relies on
sessionStorage, whether the saved state is for the correct origin, and whether the app invalidated its session. - Secrets are unavailable in CI: inspect the trigger and trust context. Fork pull-request workflows may not receive repository secrets by design; move capture to an approved trusted schedule rather than broadening secret access.
- Artifacts expose more than the screenshot: review trace, report, and log settings and the artifact upload paths. Exclude auth files and limit access and retention for all outputs.
Frequently Asked Questions
Can I reuse Playwright storageState in CI?
Yes. Reuse it in a trusted job by configuring the browser context with the saved state, while delivering and deleting the file through a protected runtime process.
Where should I keep Playwright auth.json?
Keep it out of source control and outside ordinary artifacts. Use a restricted runner workspace or protected runtime secret delivery for the job that needs it.
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.




