Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk6 min

How to Capture Website Screenshots After Signing In with Playwright

Reuse Playwright authentication state to capture protected pages, with guidance for readiness checks, full-page images, session storage, and visual tests.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save Playwright’s authentication state after signing in, load it into the browser context that opens the protected page, wait for a site-specific sign-in-ready signal, and then call page.screenshot(). Use fullPage: true when you need the full scrollable document instead of the visible viewport. Treat the saved state as a credential: keep it out of version control.

What you need before capturing a signed-in page

  • A Playwright project with the browser you intend to use installed.
  • A valid authentication state for the account and environment under test.
  • A reliable, application-specific signal that confirms the protected page is ready, such as an account control or a known destination URL.
  • A safe location for the state file. It can contain cookies and headers that let someone impersonate the account.

The examples below use Playwright Test and a setup project to create reusable state. Adjust the URL and readiness selector to match your application; neither a generic navigation event nor a successful HTTP response alone proves that the page’s authenticated content has finished rendering.

As an Amazon Associate I earn from qualifying purchases.

Save the authentication state once

Create a setup test that completes the sign-in flow, confirms the resulting authenticated page, and saves the browser context state. For example, create tests/auth.setup.ts:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { test as setup, expect } from '@playwright/test';
import path from 'node:path';

const authFile = path.join(__dirname, '../playwright/.auth/user.json');

setup('sign in and save state', async ({ page }) => {
  await page.goto('https://example.com/login');

  // Replace these selectors and credentials with your app's sign-in flow.
  await page.getByLabel('Email').fill(process.env.TEST_EMAIL ?? '');
  await page.getByLabel('Password').fill(process.env.TEST_PASSWORD ?? '');
  await page.getByRole('button', { name: 'Sign in' }).click();

  // Confirm an application-specific signal after redirects and rendering.
  await expect(page.getByTestId('account-menu')).toBeVisible();
  await page.context().storageState({ path: authFile });
});

Keep secrets such as test credentials in environment variables or your CI secret store, not in source code. Ensure the state directory exists before running the setup test. Add playwright/.auth to .gitignore so the saved state is not committed:

#1 Best Overall
Sale
MNN 15.6" FHD 60Hz Portable Monitor USB-C HDMI IPS HDR Gaming Laptop
  • Full HD Portable Monitor - MNN 15.6inch portable laptop monitor with 1920*1080 resolution, advanced IPS glossy screen support 178° full viewing angle, it renders accurate and bright color, draws you into the video or game with lifelike colors and amazing detail.It can effectively reduce blue light radiation damage, no flickering, eye-care, and make it easier to watch for a long time.A second monitor for working from home.
  • Double Type-C Port -For Plug & Play, the MNN monitor provides 2 Full Feature Type-C ports. Only One USB Type-C Cable is required to connect to the power supply & display signal transmission. NOTE: Your device should support thunderbolt 3.0 or USB 3.1 Type C DP ALT-MODE.which supports multiple connect ways to your laptops, PC, Phones, Macbooks, PS5/PS4, Xbox, and Switch.
  • Lightweight Ultra Slim for Travel - As a portable external monitor,MNN portable laptop monitor easily accommodate to every suitcase and backpack and stress-free when you are holding it for a long time. They are truly portable computer monitors for travelers, students, gamers,engineers, and everyone.
  • Give consideration to work and games - through multiple display modes [Copy Mode/Extended Mode/Second Screen Mode/Portrait Mode], we can bring you a clear second screen in the meeting, and expand the screen anytime and anywhere to improve work efficiency and improve the quality of life. Adjusting to HDR mode can upgrade the image to a new level, providing you with brighter highlights,deeper and more realistic colors, more realistic images, and amazing viewing/gaming experience.
  • Powerful Smart Cover - MNN portable external monitor can work in both landscape and portrait mode, can be used as a gaming monitor, screen extender for laptop or phone. Comes with a scratch-proof smart cover made of durable PU leather exterior, doubles as a stand, provides comprehensive protection for this portable computer monitor.
playwright/.auth

Playwright’s authentication guide describes saving a context’s state for reuse and warns that state files can contain sensitive cookies and headers: Playwright authentication.

Reuse the state and capture the protected page

Configure a setup project and a dependent test project in playwright.config.ts. The dependent project loads the state file as its browser context’s storageState:

import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './tests',
  projects: [
    {
      name: 'setup',
      testMatch: /auth.setup.ts/,
    },
    {
      name: 'chromium-authenticated',
      use: {
        ...devices['Desktop Chrome'],
        storageState: 'playwright/.auth/user.json',
      },
      dependencies: ['setup'],
      testMatch: /signed-in.spec.ts/,
    },
  ],
});

Then create tests/signed-in.spec.ts:

import { test, expect } from '@playwright/test';

 test('capture an authenticated page', async ({ page }) => {
  await page.goto('https://example.com/account');

  // Use a signal that means the protected content is ready in your app.
  await expect(page.getByTestId('account-menu')).toBeVisible();
  await expect(page.getByRole('heading', { name: 'Account' })).toBeVisible();

  await page.screenshot({ path: 'signed-in.png' });
  await page.screenshot({ path: 'signed-in-full.png', fullPage: true });
});

Run the project with npx playwright test. The setup project runs first, writes the state file, and the dependent project uses it to open the protected route. Remove the extra leading space before test( in the sample if your formatter flags it; it has no effect on execution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
InnoView Portable Monitor, 15.6 Inch FHD 1080P HDMI USB C Second External Monitor for Laptop, Desktop, MacBook, Phones, Tablet, PS5/4, Xbox, Switch, Built-in Speaker with Protective Case
  • [Portable Monitor Laptop] InnoView laptop screen extender is no need of app and drivers! 15.6 in is a more suitable size for traveling or remote work. Suitable for traveler, student, gamer, engineer, and white-collar worker to connect HP laptop, Lenovo laptop, Dell laptop, Asus laptop, Macbook, iPhone, game console, tablet, PS, Xbox, etc. The laptop screen can expand the viewing area and be more efficient when playing games, working, meeting and studying
  • [Plug and Play] The travel monitor for laptop provides 2 full-function Type-C ports and 1 HDMI port to connect most devices. Only one USB-C cable is needed to connect the external display to computer, and it supports power pass-through reverse charging. Note: Your device should support Thunderbolt 3.0/4.0 or USB 3.1 Type-C DP ALT-MODE. If not, you can connect via HDMI and power cable(NOT INCLUDE IN THE PACKAGE)
  • [IPS FHD USB C Monitor] 15.6 inch portable screen with a resolution of 1920*1080P, made of A+ IPS screen, supports 178° full viewing angle, can present accurate and vivid colors. Combined with HDR, images and videos present realistic colors and amazing details. Low blue light can effectively reduce blue light radiation damage, no flicker, eye protection, making it easier for you to work and perform multiple tasks at the same time
  • [Versatile Cover and Stand] Equipped with a scratch-resistant smart protective cover made of durable PU leather, it can also be used as a stand when working. Two grooves are used to adjust the angle and fix the external monitor. It can also provide all-round protection for the 1080p monitor when going out or traveling, suitable for putting in a backpack to avoid squeezing. Optional landscape and portrait modes, save more desktop space
  • [Worry-free Purchase] Since the output power of each device is different, the screen may flicker or restart. You can power the laptop monitor to solve it. Provide a 30-day return policy and 18-month warranty (excluding external force damage). If you have any concerns, please let us know (displayed on the back of the monitor)

The browser context is the owner of the page and its restored cookies/local storage. The storageState option can be set in project configuration as above, or supplied when creating a context yourself. See Playwright test configuration options.

Choose viewport or full-page capture

  • await page.screenshot({ path: 'signed-in.png' }) saves what is currently visible in the viewport.
  • await page.screenshot({ path: 'signed-in-full.png', fullPage: true }) captures the full scrollable page.

Use viewport capture when the screenshot should represent a user’s current screen. Use full-page capture for a long account page, report, or dashboard that must be inspected as one artifact. The Page screenshot API also documents image type, scale, animation handling, clipping, and masking options: Page.screenshot().

Authentication cases that need extra handling

Expired state

Authentication state can expire or be invalidated by the application. When the protected route redirects to sign-in or the expected account control does not appear, rerun the setup project to authenticate and write fresh state. Avoid relying on a fixed state file indefinitely.

Rank #3
Sale
KYY Portable Monitor 15.6" 1080P Computer Monitor Screen Extender w/Cover
  • [ FHD 1080P PORTABLE MONITOR ]: KYY using a 15.6''(8.8"x14.2") advanced IPS screen with 178° wide viewing angle, Delivers 1920*1080 breathtaking viewing quality and HDR technology, KYY portable gaming monitor has excellent color rendering ability, provide you the clearer, smooth, excellent performance in gaming/multimedia. It can effectively reduce blue light radiation damage, no flickering, eye-care, and make it easier to watch for a long time
  • [ WIDE COMPATIBILITY ]: KYY portable monitor for laptop equipped with 2 Full Function Type-C ports and Mini-HDMI port, easy access to your favorite devices with 1 cable solution as long as your device support Thunderbolt 3 or 3.1 USB-Type-C, compatible with most laptop, smartphone, PC, PS4, XBOX and more.
  • [ ULTRA-SLIM PORTABLE DISPLAY ]: KYY USB C portable monitor features a 0.3inch ultra-slim profile(1.7lb), it is easy to slides into your bag, allows you to carry it everywhere, ideal for a simple on-the-go dual-monitor setup or extend your phone screen for movies or games. No driver needed and equipped with 3.5mm audio inputs and 2 built-in stereo speakers to enhance entertainment experience
  • [ DURABLE SMART COVER ]: Comes with a scratch-proof smart cover made of durable PU leather exterior, doubles as a stand, provides comprehensive protection and frameless magnetic design for this portable computer monitor. There are two grooves in the cover base to give at least some choice of viewing angle for your comfort for less cumbersome installation
  • [ LIGHTWEIGHT BUT POWERFUL ]: KYY portable external monitor can work in both landscape and portrait mode, can be used as a gaming monitor, screen extender for laptop or phone. It has a unique designed Premium gray metal appearance, 2 built-in speakers to play audio, a friendly menu control wheel for setting, and 24/7 professional support team

Session-storage-based login

Playwright’s ordinary storage-state mechanism does not persist session storage. If the application stores authentication there, the saved state alone will not restore it. Follow Playwright’s documented pattern to capture session storage from an authenticated page and restore it with an initialization script scoped to the application’s domain: Session storage guidance.

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

API-based sign-in

If the application supports a suitable login API, an API request context can be more convenient than automating the login UI. Playwright documents saving the resulting request context state for use by browser tests in its authentication guide.

Multiple roles and parallel workers

For two roles in one test, create separate browser contexts using separate storage-state files. If parallel tests mutate shared server-side data, use separate accounts and authentication state per worker; otherwise tests can interfere with one another. A shared account is better suited to tests that do not change shared state.

Rank #4
Anyuse 15.6" FHD IPS USB-C HDMI Portable Monitor
  • 15.6" FHD Portable Monitor - Featuring a 1920*1080P resolution, 178°FULL viewing angle, HDR, and Low Blue Light Super Clear IPS A-grade screen, this Anyuse portable screen for laptop enhanced visual experience, reduces eye strain and fatigue.
  • Double Type-C Port -For Plug & Play - Anyuse portable monitor features 2 full-featured Type-C ports and 1 MINI HDMI port. You can easily access your favorite devices with just one USB Type-C or MINI HDMI cable. NOTE: Your device should support Thunderbolt 3.0/4.0 or USB 3.1 Type C DP ALT-MODE.
  • Portable & Light Weight - At just 1.37lbs and 0.04 inch thin, this portable laptop monitor is ultra-portable and perfect for on-the-go productivity or gaming. flexible to use anywhere you need a second screen for laptop. bringing you efficiency for meetings, work from home, and presentations.
  • Able to Balance Work and Play - With multiple display modes [copy mode/extension mode/second screen mode]. During meetings,it can copy your laptop's content as a second screen to share with others.At work, it can be used as a second extended screen to increase productivity. In life, adjusting to HDR mode can upgrade the image to a new level, providing you with brighter highlights, more realistic colors and images.Two built-in speakers provide an amazing viewing and gaming experience.
  • Wide Compatibility - Enjoy hassle-free plug-and-play functionality with the portable monitor. it is compatible with all devices equipped with HDMI and USB Type-C ports like laptops, PS, XBOX, SWITCH game consoles, No app or driver installation required.

Version-specific browser-context capabilities

BrowserContext options have been added in particular Playwright releases, including IndexedDB snapshot support and virtual WebAuthn credentials. Check the API documentation and your installed Playwright version before depending on those features; they are not substitutes for confirming that the application’s actual authentication mechanism is supported. See BrowserContext API and Virtual WebAuthn credentials.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use screenshots for visual regression tests

For a one-off image, page.screenshot() writes an artifact. For a regression check, Playwright Test’s toHaveScreenshot() assertion waits until consecutive screenshots match before comparing the result with its saved expectation. Screenshot assertions are part of the Playwright test runner: Visual comparisons.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Rendering can vary with the operating system, browser version, settings, hardware, power source, and headless mode. Keep the comparison environment consistent where practical, and update reference images deliberately when a visual change is intended. Playwright discusses these sources of screenshot variation in its snapshot guidance: Visual comparison guidance.

Best Value
VILVA 15.6" FHD IPS USB-C HDMI Portable Monitor
  • Experience Unrivaled Visuals: Get the ultimate viewing experience with the VILVA Professional Portable Monitor! With its incredibly sharp 15.6 inch FHD IPS Screen, you'll get a 1920 x 1080 resolution that viewing experience. Get it now and start working smarter, not harder and get yourself the professional portable monitor today.
  • Truly Wide Compatibility: Lets you connect your laptop, PC, MAC, tablet, phone, XBOX, PS3/PS4/PS5, switches, and more via USB-C or HDMI Port-- deliver a stable connection and steady data transmission. Enjoy great sound with the built-in dual stereo speakers, perfect for your business trip, travel, or home entertainment gaming setup.
  • Durable Smart Cover: VILVA portable monitor has a high quality and durable metal material, which makes it shows a fine metal texture and high strength. Has magnetic leather smart cover that provides protection for the entire screen and easy to stand the portable monitor.
  • Look no further!: Get this portable monitor right Now, complete with magnetic cover, USB-C to USB-C cable, Mini HDMI to HDMI cable.

Troubleshoot blank, signed-out, or incomplete screenshots

  • The page shows a login screen: the state may be expired, not saved after the login redirects, or not loaded into the context that created the page. Rerun setup, check the state path, and confirm the test project uses that file.
  • The URL is right but content is missing: add a site-specific readiness assertion for a stable account control or protected-page element. A navigation event by itself may finish before client rendering or data loading.
  • The screenshot is only the visible portion: add fullPage: true if the full scrollable page is required.
  • Login works manually but not in the test: check whether the application depends on session storage or a particular authentication flow; standard storage state does not preserve session storage.
  • Parallel tests produce inconsistent account data: avoid shared mutable accounts; use separate accounts and state per worker where the tests change server-side state.
  • Visual snapshots differ across runs or machines: standardize the browser and host environment as much as possible, and review intended changes before updating snapshots.
  • A state file appears in a repository change: remove it from version control and ensure its directory is ignored. Treat exposed state as compromised credentials and invalidate the session through the application’s available account controls.

Or skip the browser setup

If you need a screenshot of a public page rather than a page that requires your signed-in session, ScreenshotNeo can capture it with one GET request. It does not replace Playwright’s authenticated browser context for protected pages.

For example, with an API key and a public target URL:

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 documentation for API options. It accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

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

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

Frequently Asked Questions

Does Playwright’s saved authentication state include session storage?

No. Session storage needs to be captured and restored separately when the application relies on it.

Can I capture two signed-in roles in one test?

Yes. Use separate browser contexts and a different storage-state file for each role.

Why do visual screenshots differ across machines?

Rendering can vary with the operating system, browser version, settings, hardware, power source, and headless mode.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.