DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween 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 Now×
Skip to content
World desk6 min

How to Capture a Page Behind a Login: What Loki Can—and Can’t—Do

The Loki package documented for Storybook does not establish support for arbitrary logged-in websites. Use an authorized browser session for a one-off capture, or reuse Playwright storage state for repeatable screenshots.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The answer depends on which “Loki” you mean. The documented JavaScript loki package is for capturing Storybook stories and comparing screenshots; its documentation does not establish that it can sign in to an arbitrary website. For a one-off capture, use an authorized browser session. For repeatable captures, Playwright can reuse saved browser storage state. If you meant a different Loki product, its documentation is needed for exact Loki-specific steps.

First identify the Loki product

The Loki package documentation describes a workflow for capturing screenshots and comparing them against reference files. That is a Storybook visual-testing use case, not documented general-purpose automation for logging in to websites. Do not assume its commands can authenticate to a regular site or capture any protected URL. If you have another Loki in mind, check that product’s documentation for support for browser login, stored sessions, and screenshots before following tool-specific instructions.

As an Amazon Associate I earn from qualifying purchases.

Capture a page once using an authorized browser session

  1. Sign in to the website through its normal login flow in a browser you are authorized to use. Complete any multifactor authentication or consent prompts yourself.
  2. Open the exact protected URL you need, rather than relying on a redirect or a link from a previous page.
  3. Wait until the private content is visibly loaded. If the page loads sections as you scroll, inspect the lower sections too.
  4. Use the browser or operating-system screenshot function to capture the visible area, or use a browser’s full-page capture option if you need content below the fold.
  5. Open the saved image and confirm it shows the intended signed-in page—not a login screen, redirect, loading state, or blank area.

This is the simplest route for an occasional capture. It requires a person to complete sign-in and does not create a reusable automation workflow.

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.

Automate repeat captures with Playwright

Playwright documents a pattern for signing in once, saving browser storage state, and loading that state in a later browser context. The example below assumes the site permits this kind of session reuse and that you can identify a reliable element that appears only after sign-in. Some authentication systems—such as those tied to a particular device, certificate, or interactive challenge—may need a different approach. See Playwright authentication and Playwright screenshots.

Install Playwright

In a new Node.js project, install Playwright and its browser:

npm install playwright
npx playwright install chromium

Sign in and save storage state

Create save-auth.mjs. Replace the example URL, selectors, and credentials handling with the site’s actual login flow. Avoid putting a real password directly in a script or committing it to source control; use environment variables or an approved secret store.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { chromium } from 'playwright';

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

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

// Replace this with a dependable marker shown only after successful sign-in.
await page.getByText('Account').waitFor({ state: 'visible' });
await context.storageState({ path: 'playwright/.auth/state.json' });
await browser.close();

If the site requires MFA or another interactive step, complete it in the opened browser before saving state. This approach stores browser storage state; it should not be treated as a universal export of every credential or authentication mechanism.

Load the saved state and capture the page

Create capture.mjs. The example writes a full-page PNG; change fullPage to false for a viewport-only image.

import { chromium } from 'playwright';

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

await page.goto('https://example.com/account/reports', {
  waitUntil: 'domcontentloaded',
});
// Use a signed-in page marker, not a generic page-load event, as the check.
await page.getByText('Account').waitFor({ state: 'visible' });
await page.screenshot({ path: 'page.png', fullPage: true });

await browser.close();

Run node save-auth.mjs to save the session, then node capture.mjs to create page.png. A successful navigation alone does not prove authentication succeeded: sites can redirect to a login page while still returning a valid page response.

Protect the saved state

The state file may contain cookies or other data that grants access to the account. Keep it out of public repositories, restrict who and what can read it, and delete or rotate it when it is no longer needed. The same care applies to screenshots: private pages can expose names, account details, or other sensitive information.

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

Choose the method that fits the job

Method Best for Sign-in and reuse Output
Manual browser capture A one-off screenshot A person signs in each time; no automation state is required. Capture the visible area or use a browser full-page option.
Playwright with saved storage state Repeatable browser automation Sign in and save state first; later runs load it. MFA or site-specific authentication may still require interaction. Viewport or full-page screenshot, as configured.
An API offering HTTP Basic Authentication Only a target site that actually uses HTTP Basic Authentication The API’s Basic Auth option applies to that authentication mechanism, not automatically to a normal login form. Depends on the API’s documented capture options.

Why Basic Authentication is not a general login solution

Some capture APIs document HTTP Basic Authentication, in which credentials are sent through that protocol. That option is relevant only when the protected site uses Basic Authentication. It does not establish that the service can operate a regular login form, complete MFA, or reuse an arbitrary browser session. Match the documented authentication method to the site instead of treating all login screens as equivalent. See Capture API documentation.

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

Check the capture and troubleshoot failures

  • The image shows a login screen: The session may not have been saved, may have expired, or may not be accepted in the new context. Sign in again, save fresh state, and wait for a signed-in-only marker before capturing.
  • The page is blank or incomplete: Wait for a reliable content marker rather than relying only on navigation completion. If content appears on scroll, inspect or load the relevant sections before using full-page capture.
  • MFA or a challenge blocks automation: Complete the step interactively where permitted, or use the site’s approved authentication method. Do not try to bypass access controls.
  • The image includes the wrong page: Verify the final URL and inspect the saved file. A redirect can lead to a valid login page without producing a browser error.
  • A capture API rejects credentials: Confirm that the site uses HTTP Basic Authentication and that the API’s documented option matches it. A regular username-and-password form is a different flow.
  • The screenshot exposes private details: Limit capture and sharing to information you are authorized to access; review the image before sending or publishing it.

Or skip the browser setup

ScreenshotNeo is a screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. Its cleanup accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients.

For a page that ScreenshotNeo can access, make a one-call capture with cURL (replace the target URL and use your API key):

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 authentication and capture parameters. ScreenshotNeo’s stated API details do not establish that it can complete a site’s regular login form or reuse Playwright storage state; confirm the target site’s supported authentication before relying on an authenticated capture.

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

The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does the Loki Storybook package capture arbitrary logged-in websites?

Its documentation describes Storybook screenshot capture and comparison, not general authenticated website capture.

Can I reuse Playwright storage state for every kind of login?

No. It is a documented browser-state reuse pattern, but it does not guarantee support for every credential or authentication mechanism.

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.

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
PC Slower Than It Used to Be?Free scan - under a minute

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.