Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
FREEDOM251

Freedom251 › Blog › authentication

How to Capture Screenshots of Pages Behind a Login with n8n and Playwright

By Freedom251 Team · · 7 min read

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

Use n8n to trigger and coordinate the job, and use an authenticated browser session—such as a Playwright browser context—to render and capture the page. A plain n8n HTTP Request fetches an HTTP response; it does not render a complete interactive browser page. The pattern below covers creating a signed-in session, saving and securely reusing its state, and returning a screenshot to your workflow.

How the n8n and browser setup fits together

Think of the workflow as two parts: n8n passes the target URL and coordinates the task; browser automation opens the site as an authorized user, waits for the page to render, and captures it. Playwright provides browser contexts for session state and a page screenshot API. The n8n HTTP Request node can call an API or browser service, but it is not itself a browser renderer. See the n8n HTTP Request node documentation, Playwright’s BrowserContext API and Page API.

As an Amazon Associate I earn from qualifying purchases.

The exact way to run Playwright alongside n8n depends on your deployment and available nodes or services. The official n8n materials cited here do not establish a built-in browser screenshot node or a universal Playwright integration recipe. Treat the code below as the browser task to adapt to an execution environment you control, rather than a ready-made n8n node configuration.

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

Set up a logged-in browser session

Playwright documents both signing in through the website UI and authenticating through an application API where one is supported. Use the site’s supported API login when appropriate; otherwise use its normal browser login flow. In either case, wait for a reliable indication that sign-in succeeded before saving state.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Example: sign in through the UI and save storage state

This Node.js example uses Playwright to sign in through a UI, confirm the post-login state, and write browser storage state to a file. Replace the example URL, selectors, and credentials source with values for an account authorized to access the target. Store credentials outside the script, such as in your execution environment’s secret storage. The example assumes the site uses cookies or local storage; see the storage notes below if it uses other mechanisms.

import { chromium } from 'playwright';

const browser = await chromium.launch({ headless: true });
const context = await browser.newContext();
const page = await context.newPage();

try {
  await page.goto('https://example.com/login', { waitUntil: 'domcontentloaded' });
  await page.getByLabel('Email').fill(process.env.SITE_EMAIL);
  await page.getByLabel('Password').fill(process.env.SITE_PASSWORD);
  await page.getByRole('button', { name: 'Sign in' }).click();

  // Replace with a reliable URL or signed-in element for the target site.
  await page.waitForURL('https://example.com/account');
  await page.getByText('Account').waitFor({ state: 'visible' });

  await context.storageState({ path: 'playwright/.auth/state.json' });
} finally {
  await browser.close();
}

The selectors and final URL are site-specific, not universal Playwright values. Playwright’s authentication guide shows the documented login and storage-state patterns. If the application offers an appropriate authentication API, that can be another way to establish a session; the right choice depends on the application’s supported access methods and the complexity and maintainability of its login flow.

Reuse the session to capture a page

For a later capture, create a browser context using the saved state, navigate to the exact page you are authorized to access, verify that the session remains signed in, wait for the content you need, then save the screenshot. This second Node.js example produces a PNG and fails clearly if the expected signed-in element is absent.

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.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
import { chromium } from 'playwright';

const targetUrl = process.env.TARGET_URL;
if (!targetUrl) throw new Error('Set TARGET_URL');

const browser = await chromium.launch({ headless: true });
const context = await browser.newContext({
  storageState: 'playwright/.auth/state.json',
});
const page = await context.newPage();

try {
  await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });

  // Replace with a reliable signed-in marker for the target application.
  await page.getByText('Account').waitFor({ state: 'visible', timeout: 15000 });

  // Replace with a page-specific readiness signal if content loads asynchronously.
  await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
  await browser.close();
}

In an n8n workflow, pass a validated URL and any permitted inputs to the browser task, then return or store the resulting image where the next workflow step can use it. A workflow that calls a remote browser service can use an HTTP Request node for that service’s API; a workflow that runs browser automation directly needs an execution arrangement that supports it. Check the current n8n deployment and installed nodes rather than assuming a particular integration exists.

Choose and maintain the right authentication state

Cookies and local storage

Playwright storage state covers cookies and local storage. Reuse it by configuring a new browser context with the saved state. Before capture, check a signed-in page element or other dependable application signal: a file can exist even after the server-side session has expired.

IndexedDB, session storage, and other login methods

Some applications store authentication tokens in IndexedDB. Playwright’s storage-state API can include IndexedDB; enable the corresponding option when saving state if the application requires it. Session storage is not captured by the normal storage-state method. Playwright’s authentication guide demonstrates custom save-and-restore handling for that case. WebAuthn passkeys and other device-bound or specialized authentication can also require additional, target-specific handling.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

SSO, MFA, CAPTCHA, short-lived tokens, device-bound authentication, and site restrictions can make unattended login difficult or unavailable. There is no universal workaround established for these cases. Use only the site’s supported access methods and obtain authorization; when automation is not supported, use an approved alternative rather than trying to bypass a control.

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

Reuse state or log in for every run?

Saving state avoids repeating the login flow on every screenshot run, but the state expires and must be protected like a credential. Logging in for each run avoids relying on an older saved file, but it still depends on an automatable, supported login flow and introduces that flow into every run. Choose based on the application’s authentication support, how often its UI changes, and whether you can securely store and refresh session state.

Protect the browser state and n8n credentials

A saved browser state can contain cookies and headers that let someone impersonate the account. Playwright explicitly warns: “The browser state file may contain sensitive cookies and headers that could be used to impersonate you or your test account.” Keep authentication files in a restricted location such as playwright/.auth, add that directory to .gitignore, limit retention, and do not place state in routine workflow output or logs. Use appropriately restricted secret storage for state needed by an n8n execution.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Review workflow access as carefully as credential access. According to n8n’s workflow sharing documentation, workflow editors can use credentials used in the workflow, including credentials not explicitly shared with them. Limit editor access accordingly. For self-hosted n8n, its security audit can identify issues including credential use, file-system access, risky nodes, community or custom nodes, unprotected webhooks, and instance security.

Troubleshoot common failures

  • The capture shows a login page: The state may be expired, the login may not have completed before it was saved, or the app may rely on storage not included in the state file. Confirm the signed-in marker during setup and again before capture; repeat the supported login flow if the session expired. Check whether the app requires IndexedDB or custom session-storage handling.
  • The login step times out: A selector or expected post-login URL may not match the site, the UI may have changed, or an MFA or other site-specific step may require interaction. Inspect the authorized flow and update the readiness signal; do not treat a timeout as proof that authentication succeeded.
  • The screenshot is blank or missing page content: Navigation completion does not necessarily mean the particular content you need is ready. Wait for a reliable page-specific element before capturing, and verify the resulting page is the intended authenticated page.
  • The workflow cannot launch or call the browser task: Confirm that the chosen execution arrangement supports the browser runtime or that the remote browser service is reachable and configured. The n8n HTTP Request node makes HTTP calls; it does not supply browser rendering by itself.
  • Other workflow editors can access the connected account: Recheck workflow sharing permissions and who can edit the workflow, because editors may be able to use credentials used by that workflow.
  • A login works locally but not unattended: The site may require SSO, MFA, a device-bound factor, CAPTCHA, or another interaction unsuitable for unattended automation. Use a supported, authorized access method or an approved manual process.
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 you do not need a target site’s private, logged-in content, ScreenshotNeo offers a screenshot API and MCP server. A single request can capture a public page as PNG, JPEG, WebP, or PDF. For example, save a screenshot of a public page with cURL:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo documentation for request options and setup. ScreenshotNeo removes known cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. This API call is for public pages: do not send private pages or login credentials unless the service explicitly supports the access method you need.

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

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Frequently Asked Questions

Can n8n’s HTTP Request node take a screenshot of a logged-in page by itself?

No. It can call an API or browser service, but browser automation must render and capture the interactive page.

Does Playwright save every kind of browser authentication state automatically?

No. Its normal storage state covers cookies and local storage; IndexedDB can be included when needed, while session storage requires custom handling.

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.

Can I use ScreenshotNeo for a page that requires my login?

The one-call example here is for public pages. For private pages, use an authorized browser session and a supported access method.

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 automationn8nPlaywrightscreenshots

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
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver 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.