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 vs Puppeteer for Screenshots of Pages Behind Logins

By Freedom251 Team · · 7 min read

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

Both Playwright and Puppeteer can screenshot a page after the browser has reached an authenticated state. Playwright is the clearer choice when you need a documented, reusable login-state workflow: its authentication guide explains how to log in once, save browser state, and load that state into later contexts. Puppeteer documents page and element screenshots and exposes context cookies, but those facts alone do not establish a complete persistence recipe for every kind of login.

The decisive question is how your app stores and refreshes authentication—not which screenshot method you call. The examples below show a reusable Playwright workflow and the screenshot calls common to each library, with the limits of the documented Puppeteer path made explicit.

As an Amazon Associate I earn from qualifying purchases.

What differs when the page requires a login?

A screenshot API captures what the browser can currently render; the screenshot call does not sign a user in. Your automation must first reach a valid authenticated state, then capture the page. That state may depend on cookies, local storage, IndexedDB, session storage, passkeys, or an external identity-provider flow.

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.
Question Playwright Puppeteer
Page and element screenshots Documented, including full-page and buffer workflows. Playwright Screenshots Documented through Page.screenshot() and ElementHandle.screenshot(). Puppeteer Screenshots
Reusable login state Guide describes saving and loading storage state through setup projects and test projects. Playwright Authentication The reviewed cookie API retrieves cookies for a context; by itself, it does not describe persistence for all authentication mechanisms. Puppeteer BrowserContext.cookies()
Session storage storageState does not persist session storage through a built-in API; custom save/restore logic may be needed. Playwright Authentication Do not infer a session-storage workflow from the cookie API; verify the current guidance for your installed version.
Browser and runtime setup Check the installed Playwright version and supported browser setup for your project. Configuration docs describe its default downloaded Chrome version, custom executable configuration, and changing Firefox support status. Verify current requirements. Puppeteer Configuration

This is a difference in the documentation described above, not proof that Puppeteer cannot preserve login state. Choose based on your application’s auth mechanism, browser requirements, language, and whether you need an integrated test runner or only browser automation.

#1 Best Overall
HP OmniBook 3 17.3 inch Laptop PC, FHD Display, AMD Ryzen 3 30, 8 GB RAM, 512 GB SSD, AMD Radeon 610M Graphics, Windows 11 Home, Mica Silver, 17-dp0199nr
  • FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
  • AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
  • ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
  • AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
  • STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth

Use Playwright when reusable authentication state is the priority

Playwright’s documented approach is to authenticate in a setup project, save the browser context’s storage state, and configure later test projects to use it. A screenshot-only script can follow the same principle: establish the state in a trusted setup step, then load it into the context used for capture.

  1. Authenticate in a setup or worker fixture. Complete the app’s normal login flow and wait for a reliable signed-in signal, such as a final URL or an element that appears only after authentication.
  2. Save the context state. Write the state file to a local, access-controlled location rather than committing it to source control.
  3. Load state into the capture context. Create the browser context with that saved state, navigate to the target URL, and wait for the content you intend to capture.
  4. Refresh expired state. If the app expires or rotates credentials, repeat the setup login and save a new state before capture.

Here is a minimal JavaScript example for the capture step, assuming auth.json has already been created by an authenticated setup step. Install the Playwright package and its browser as directed by the current Playwright documentation for your project.

Rank #2
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext({
      storageState: 'auth.json',
    });
    const page = await context.newPage();
    await page.goto('https://example.com/account', {
      waitUntil: 'domcontentloaded',
    });
    await page.getByText('Account overview').waitFor();
    await page.screenshot({ path: 'account.png', fullPage: true });
    await context.close();
  } finally {
    await browser.close();
  }
})();

Replace the example URL and signed-in text with values from your application. The visible authenticated signal is important: a successful navigation alone does not prove that the page is signed in. For the setup-project configuration and supported storage details, see Playwright’s authentication guide.

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

When the app uses session storage

Playwright’s built-in storage-state reuse covers cookies, local storage, IndexedDB, and passkey/WebAuthn authentication, but does not expose a built-in session-storage persistence API. If the login token lives in sessionStorage, add custom save and restore logic using page evaluation and an init script, following the approach in the authentication guide. Do not assume that saving auth.json alone will reproduce this type of session.

Rank #3
Sale
AKCHART 15.6'' AI Laptop with Office 365 12GB RAM 256GB SSD Win 11 Laptops | 7000mAh Battery, IPS FHD, 180°Viewing, Quad-Core Processor, Type-C, WiFi5, Portable Thin Business Student Laptops, Light Gray
  • Stunning 15.6" FHD IPS Display: Experience crisp 1920x1080 resolution on this 15.6 inch laptop with an IPS panel that delivers wide viewing angles and vivid colors. The narrow-bezel design maximizes screen real estate for comfortable viewing on this Win 11 laptop, whether you're studying or working.
  • Celeron J4105 Processor & 256GB SSD: Powered by a reliable Celeron J4105 processor paired with 12GB DDR4 memory and a fast 256GB M.2 SSD. This laptop computer supports SSD expansion up to 2TB and TF card expansion up to 1TB, so your storage grows with your needs. Delivers smooth multitasking for daily productivity.
  • AI-Powered Win 11 Laptop: Built-in AI features enhance your productivity with smart assistance for writing, summarizing, and task management. Pre-installed with Win 11 and includes Office 365 subscription. This student laptop is backed by 1-year warranty and 24/7 customer support.
  • All-Day 7000mAh Battery & 180° Hinge: The high-capacity 7000mAh battery keeps this laptop powered through long classes or meetings. The 180-degree lay-flat hinge lets you share your screen effortlessly during presentations. This durable laptop computer adapts to your dynamic workflow.
  • Versatile Connectivity Hub: Equipped with USB 3.2, Type-C, Mini HDMI, and 3.5mm audio jack to connect all your peripherals. Stay online anywhere with high-speed 5G WiFi and Bluetooth 4.2. This college laptop keeps you connected at home, in the library, or on the go.

When tests run in parallel

If screenshot runs only read pages and do not interfere with shared data, a shared account may be sufficient. If tests mutate server-side data, Playwright recommends a separate account per worker or another isolation strategy so simultaneous runs do not overwrite one another. Match account isolation to what the workflow actually changes.

Use Puppeteer when it fits your existing browser workflow

Puppeteer’s screenshot guide documents page capture with page.screenshot() and element capture with ElementHandle.screenshot(). Its BrowserContext API exposes cookies through BrowserContext.cookies(). Cookie retrieval is not, on its own, a complete recipe for saving and restoring every kind of authenticated state.

Rank #4
HP Essential Laptop 2026, Intel CPU, 128GB Storage, Office 365, Windows 11 | Copilot AI, WiFi 6, Long Battery Life, Lightweight & Portable, Online Learning, Browsing, Streaming, Willow Green
  • Efficient Performance for Everyday Computing: Powered by Intel N150 processor with up to 3.6 GHz Intel Turbo Boost Technology, 6 MB L3 cache, 4 cores, and 4 threads, this HP laptop delivers responsive performance for web browsing, streaming, document editing, and multitasking. Paired with 4GB LPDDR5 RAM and 128GB UFS storage, it handles daily tasks smoothly. Includes 1-year Microsoft 365 Personal subscription for Word, Excel, PowerPoint, and cloud storage to maximize your productivity.
  • 14-Inch HD Micro-Edge Display:Enjoy clear visuals on the 14-inch HD (1366 x 768) anti-glare screen with 250-nit brightness and 62.5% sRGB coverage. The micro-edge bezel delivers a 79% screen-to-body ratio in a compact design. An HP True Vision 720p HD camera with noise reduction and dual-array microphones supports clear video calls, remote work, and online learning.
  • Modern Connectivity and Wireless Technology: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.4 for seamless pairing with accessories. Versatile port selection includes 1 USB Type-C 10Gbps with DisplayPort 1.2 for external displays, 2 USB Type-A 5Gbps ports for peripherals, 1 HDMI 1.4b port, 1 headphone/microphone combo jack, and 1 multi-format SD media card reader. Connect monitors, transfer files quickly, and expand your workspace with ease.
  • All-Day Battery Life and Portable Design: Enjoy up to 11 hours of video playback, 7.5 hours of mixed usage, or 7.5 hours of wireless streaming on a single charge, perfect for students and professionals on the go. Weighing just 3.24 lb and measuring 12.76" x 8.86" x 0.71", this lightweight laptop fits easily in backpacks and bags. The stylish willow green top cover with matte finish and natural silver keyboard deck with vertical brushing pattern offer a modern, professional look.
  • AI-Enhanced Productivity: Access Microsoft Copilot instantly with the dedicated Copilot key for faster assistance. AI Noise Reduction filters background sounds and improves voice clarity during calls. Dual speakers provide clear audio, while the full-size natural silver keyboard and HP Imagepad support comfortable typing and navigation.

If your application already provides an authenticated Puppeteer context, capture from that context after checking a signed-in signal:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    // Supply an authenticated context using the mechanism supported
    // by your app and the Puppeteer version installed in your project.
    const page = await browser.newPage();
    await page.goto('https://example.com/account', {
      waitUntil: 'domcontentloaded',
    });
    await page.waitForSelector('[data-testid="account-overview"]');
    await page.screenshot({ path: 'account.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

The comment is intentional: this snippet illustrates capture once a page is authenticated, not a universal method for creating persistent authenticated state. Consult the current Puppeteer documentation for authentication and cookies that applies to your installed version, then select an approach compatible with the app’s state mechanism and identity-provider requirements. The official guide pages reviewed displayed version 25.12.0 at the time they were consulted; versions and browser support can change.

Best Value
HP Essential Laptop, Intel N150 CPU, 4GB DDR5 RAM, 128GB SSD, Long Battery Life, 1TB Cloud Storage, Win 11 with Microsoft 365
  • 【Powerful Performance】Equipped with Intel N150 CPU, featuring up to 4.4 GHz, ensuring efficient and powerful multitasking capabilities.
  • Designed for mobility with a slim 0.71-inch profile and lightweight, making it easy to carry between home, office
  • 【Versatile Connectivity】 connected with multiple ports including USB 3.0 Type-C, and a headphone/mic combo jack, with Wi-Fi and Bluetooth for seamless wireless networking.
  • One Year Microsoft 365
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Make the choice against your app and team

  • Choose Playwright for a documented reusable-state path. Its setup-project and storage-state workflow is explicit, with a documented exception for session storage.
  • Choose either library for the screenshot operation. Both document page and element capture; Playwright additionally calls out full-page and buffer workflows in its screenshot guide.
  • Check the full authentication mechanism. Identify whether sign-in relies on cookies, local storage, IndexedDB, session storage, passkeys, or an external identity flow before designing state reuse.
  • Check browser and language constraints. Confirm the exact installed library version, browser target, and supported runtime rather than relying on a general comparison.
  • Isolate mutable accounts. Parallel runs that change shared server-side data can conflict; use distinct accounts or another tested isolation plan.
  • Do not pick on an assumed speed advantage. The cited official guides are API documentation, not controlled head-to-head performance studies. Measure on your own site if speed matters.

Protect saved authentication state

A stored browser state file is a credential, not harmless test output. Playwright warns that it may contain sensitive cookies and headers that could impersonate the account. Keep the file out of Git, limit who and what can read it, and avoid placing it in broadly shared build artifacts. Expired state must be regenerated through the login setup rather than treated as a permanent credential.

Troubleshoot failed or misleading captures

  • The screenshot shows a login page. The state may be missing, expired, or rejected. Check the final URL and a signed-in-only UI signal before capture; refresh the saved state if necessary.
  • The app signs in but the next context is anonymous. Check which storage mechanism holds the login state. Playwright’s built-in state file does not persist session storage; use custom save/restore logic where required.
  • Authentication works interactively but fails in automation. The provider may require MFA, rotate sessions, or bind a session to a browser or device. Treat these as app-specific constraints and verify the supported flow with the provider and current library documentation.
  • Parallel screenshots affect each other. Determine whether runs mutate shared account data. Give each worker an isolated account or isolate the data another way.
  • The page loads but the screenshot is incomplete. Wait for a page-specific authenticated element or content selector instead of relying only on navigation completion; use the library’s documented wait mechanisms appropriate to the page.
  • The browser executable is missing or differs from expectations. Check the installed package version and browser installation/configuration. Puppeteer’s default browser and custom executable options are described in its configuration guide.
  • A cookie-only approach does not restore the login. Cookies may not represent all of the app’s authentication state. Inspect the app’s other storage or identity flow rather than assuming cookie access equals complete session persistence.

Or skip the browser setup

If you need a screenshot without building and maintaining a browser-authentication workflow, ScreenshotNeo is an alternative to try first. It is a website screenshot API and MCP server; one GET request can return a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API documentation for request 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 accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks/CAPTCHAs, 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 for Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

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

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Frequently Asked Questions

Can I use the same saved login state in every browser?

Not necessarily. Browser support and app authentication behavior depend on the library version, target browser, and identity provider; verify the current documentation and test the exact combination you deploy.

Is there a documented benchmark showing which library is faster for screenshots?

The official guides cited here do not provide a controlled comparative benchmark, so they do not establish a speed winner.

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.

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

authenticationbrowser automationPlaywrightPuppeteerScreenshotNeoscreenshots

Leave a Reply

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

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.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.