Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon 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 NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › authentication

Playwright Screenshot Shows the Sign-In Form After Login: How to Diagnose It

By Freedom251 Team · · 6 min read

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

If a Playwright test clicks “Sign in” and then captures the sign-in form, the click alone does not prove authentication finished. Wait for a known post-login URL or signed-in UI state, save browser state only after that check succeeds, and verify the state contains the storage mechanism your app actually uses. The symptom can have several causes; without the test and redirect sequence, none can be assumed to be the root cause.

First verify whether login actually completed

Login may involve multiple redirects while the application sets cookies. Playwright’s authentication guide recommends checking a final URL or a visible authenticated control rather than treating a button click or arbitrary delay as success. Replace the example URL and selector below with stable values for your application.

As an Amazon Associate I earn from qualifying purchases.

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

test('sign in and confirm the authenticated page', async ({ page }) => {
  await page.goto('https://app.example.com/sign-in');
  await page.getByLabel('Email').fill(process.env.TEST_EMAIL!);
  await page.getByLabel('Password').fill(process.env.TEST_PASSWORD!);

  await Promise.all([
    page.waitForURL('**/dashboard'),
    page.getByRole('button', { name: 'Sign in' }).click(),
  ]);

  await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
  await page.screenshot({ path: 'authenticated-page.png', fullPage: true });
});

Use the URL pattern and UI assertion that represent a genuine signed-in state in your app. If the application stays on the same URL after login, make the stable authenticated UI assertion the success condition instead. A timeout waiting for either check is useful evidence: it means the test did not establish its expected success condition.

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

Save authentication state only after success

A common reusable setup is to sign in once in a setup project, verify the authenticated state, and then save the browser context’s storage state. The state file can contain cookies and headers that allow someone to impersonate the account, so keep it out of source control and regenerate it when it expires.

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black | 1080p with auto-light correction, built-in mic, privacy shutter, USB-A, compatible with Teams, Google Meet, Zoom and more
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
import { test as setup, expect } from '@playwright/test';

setup('authenticate', async ({ page }) => {
  await page.goto('https://app.example.com/sign-in');
  await page.getByLabel('Email').fill(process.env.TEST_EMAIL!);
  await page.getByLabel('Password').fill(process.env.TEST_PASSWORD!);
  await Promise.all([
    page.waitForURL('**/dashboard'),
    page.getByRole('button', { name: 'Sign in' }).click(),
  ]);
  await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
  await page.context().storageState({ path: 'playwright/.auth/user.json' });
});

Configure the setup project to run before projects that use the saved state, and set those projects’ use.storageState to playwright/.auth/user.json. Add playwright/.auth to .gitignore. See Playwright’s documented authentication setup for the project configuration and its account-sharing alternatives.

Choose state sharing based on test behavior

  • Shared state: Reuse one setup account when tests do not make conflicting changes to shared server-side data.
  • Per-worker state: Use separate accounts and state per worker when parallel tests modify server-side state and could interfere with one another.
  • API authentication: Consider authenticating through an API when the application supports it and doing so provides the required browser state; verify the same post-login UI before saving.
  • Multiple roles: Save separate states when a test needs to operate as different user roles.

Check which browser storage your app relies on

Playwright’s standard storage state covers cookies and local storage. Its API can also include IndexedDB when requested. Current BrowserContext documentation describes additional optional state support, including origin private file system and virtual WebAuthn credentials; availability depends on the installed Playwright version, so check the API documentation that matches your version.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black | Auto-Light Correct, Noise-Reducing Mic, Zoom, Microsoft, Teams, Skype, Nintendo Switch 2 New GameChat Mode, PC Mac compatible
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
  • The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
  • C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
  • The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.

Session storage is different: Playwright’s authentication guide says it is not directly persisted by the standard storage-state workflow. If your app depends on session storage, use a custom save-and-restore approach, such as the initialization-script pattern in the guide. Confirm what the application uses instead of assuming that a state file represents every part of a signed-in session.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Capture evidence and assert what the page shows

When diagnosing the failure, record the URL after the login attempt and capture the rendered page. A full-page capture can include content below the fold; a targeted screenshot of the sign-in form can help establish whether that form remains visible.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
await page.screenshot({ path: 'after-login.png', fullPage: true });
await page.getByRole('form', { name: 'Sign in' }).screenshot({ path: 'sign-in-form.png' });

Adapt the form locator to the accessible name or selector used by your page. Playwright’s screenshot documentation describes page and element screenshots as tools for examining rendered layout and documenting issues.

In a test, assert both the expected destination and a stable authenticated element so the failure identifies what did not happen:

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera | USB Type-A & A-to-C Adapter, Fixed Focus, Plug&Play for Zoom/Teams/Facetime/YouTube/Google Meet/Switch 2 Camera, 2025 Version
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
await expect(page).toHaveURL(//dashboard$/);
await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();

Playwright Test’s screenshot assertions can compare screenshots after consecutive captures stabilize. The toHaveScreenshot assertion requires the Playwright test runner.

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

Troubleshoot by observed symptom

What you observe What to check Next action
The final URL wait times out The app may not have reached the expected route, or the URL pattern may not match its real success route. Inspect the URL after the submit attempt and use the application’s actual post-login URL or authenticated UI condition.
The URL looks correct, but the signed-in assertion fails A route alone may not prove the account is authenticated; the app may still be rendering a sign-in state. Use a stable element that only appears for an authenticated user, and inspect the captured page.
The setup test succeeds, but a test using saved state shows sign-in Check whether the state was saved after the success condition and whether the state file is still valid. Regenerate it after verified login, then confirm the project uses the intended file.
Cookies and local storage are present, but the app remains signed out The app may depend on session storage or another state mechanism not represented in the saved state. Identify the app’s authentication storage and implement the appropriate custom restore method where necessary.
Parallel tests intermittently lose or change authentication state Tests sharing an account may be changing the same server-side state. Use separate accounts and per-worker state if tests need isolation.
The screenshot assertion differs from its baseline The rendered page may differ, including because it is still the sign-in form; visual comparison alone does not establish the authentication cause. Check URL and authenticated UI assertions first, then review the screenshot for the rendered difference.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture a public page rather than test an authenticated browser session, ScreenshotNeo provides a screenshot API and MCP server. Its API can return an image or PDF from one GET request. See the ScreenshotNeo API documentation for parameters and response details.

Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black | 30fps Video, Clear Audio, Light Correction, Works with Teams, Meet, Zoom, Nintendo Switch 2, Mac, Tablet
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; these steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server includes 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.

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

Frequently Asked Questions

Does a screenshot prove that Playwright logged in successfully?

No. A screenshot shows rendered content. Confirm authentication with the expected URL and a stable signed-in UI assertion.

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

Can Playwright reuse authentication between tests?

Yes. Save verified browser storage state and configure tests to reuse it, while keeping the sensitive state file out of source control.

Will ScreenshotNeo capture a page that requires my test’s authenticated browser session?

The API example above is for a URL-based capture. This article does not establish that it can reuse Playwright’s authenticated browser context; use Playwright for diagnosing that session-specific flow.

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.

authenticationBrowser TestingEnd-to-End TestingPlaywrightscreenshots

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.

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
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.