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 DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
FREEDOM251

Freedom251 › Blog › Loki

How to Capture Screenshots of Multiple URLs with Loki—and When to Use Playwright

By Freedom251 Team · · 6 min read

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

Loki is built to capture and compare Storybook stories, not to take screenshots from an arbitrary list of unrelated URLs. For a Storybook project, run its visual-regression workflow with loki update to create baselines and loki test to capture and compare them. If you need screenshots of ordinary web pages, use browser automation such as Playwright or a screenshot API instead.

What Loki captures

The Loki project documented at loki.js.org is a visual-regression testing tool for Storybook. It captures the stories exposed by your Storybook setup, then compares the resulting images with reference screenshots. Its documented workflow does not take an arbitrary list of web URLs as input.

As an Amazon Associate I earn from qualifying purchases.

That distinction matters: a Storybook story is a component or UI state rendered inside Storybook, not necessarily a separate deployed page. If your goal is to catch unintended visual changes in those stories, Loki is appropriate. If you have a list such as product pages, articles, or landing pages, use a tool that navigates to each URL.

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.

Set up Loki for Storybook screenshots

  1. From your project directory, add Loki as a development dependency and initialize its configuration:

    #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
    yarn add loki --dev
    yarn loki init

    The initialization command detects the project and adds defaults to package.json.

  2. Start the Storybook server so Loki can access the stories. Use the startup command appropriate to your project; the Loki guide requires Storybook to be running but does not prescribe one universal command.

  3. Create initial reference images:

    yarn loki update

    The default reference location is a loki folder. Commit these images with your project so later runs can compare against the same accepted baseline. The guide notes that Git LFS is an option if image files make the repository cumbersome.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Capture and compare the current stories:

    yarn loki test

    Inspect the current and difference images when tests fail. A difference can indicate an unintended regression or an intentional design change; review it before changing the baseline.

    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.
  5. When a visual change is intended, update the accepted references with yarn loki approve, or use the command suggested by Loki to approve only failed tests. Avoid approving changes before inspecting the diff.

Filter and tune a Loki run

Loki’s command-line reference lists filters for stories, configurations, and targets, along with settings for output, reference, and difference folders. It also documents Chrome capture controls. The reference page was last updated August 27, 2024, so check the options supported by the Loki version installed in your project before relying on a particular flag.

Need Documented setting
Limit which stories run --storiesFilter
Limit configurations --configurationFilter
Limit targets --targetFilter
Choose where images are written or compared Output, reference, and difference folder settings
Control parallel story captures Chrome concurrency; documented default is 4 stories
Set the page-load timeout Chrome load timeout; documented default is 60,000 ms
Change capture details Chrome selector, animations, and retries controls

When invoking Loki through Yarn or npm, put -- before arguments so the package runner forwards them to Loki. For example, adapt the filter name and value to the installed version’s CLI reference:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
yarn loki test -- --storiesFilter="Button"

Use the exact accepted syntax shown by the CLI reference for your version. Filters narrow the Storybook test run; they do not turn Loki into an arbitrary URL-list screenshotter.

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.

Capture screenshots of unrelated URLs with Playwright

For ordinary web pages, Playwright’s page screenshot API can navigate to a URL and capture a viewport or a full page. Its visual-comparison documentation also explains snapshot comparison. The reviewed Playwright documentation does not provide a ready-made batch URL command, so the following small Node.js script supplies the loop: save one full-page PNG per URL, using a sanitized hostname and path for the filename.

Install Playwright and its Chromium browser in a Node.js project:

npm install --save-dev playwright
npx playwright install chromium

Save as screenshots.mjs:

import { chromium } from 'playwright';
import { mkdir } from 'node:fs/promises';

const urls = [
  'https://example.com/',
  'https://example.org/about'
];

const outputDir = 'screenshots';
await mkdir(outputDir, { recursive: true });

const browser = await chromium.launch({ headless: true });
try {
  const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
  for (const rawUrl of urls) {
    const url = new URL(rawUrl);
    const slug = `${url.hostname}${url.pathname}`
      .replace(/[^a-z0-9.-]+/gi, '_')
      .replace(/^_+|_+$/g, '') || 'page';
    const filename = `${outputDir}/${slug}.png`;

    try {
      const response = await page.goto(rawUrl, {
        waitUntil: 'networkidle',
        timeout: 60000
      });
      if (!response || !response.ok()) {
        console.warn(`HTTP response issue for ${rawUrl}: ${response?.status() ?? 'no response'}`);
      }
      await page.screenshot({ path: filename, fullPage: true });
      console.log(`Saved ${filename}`);
    } catch (error) {
      console.error(`Failed ${rawUrl}: ${error.message}`);
    }
  }
} finally {
  await browser.close();
}

Run it with:

node screenshots.mjs

This example uses one browser page sequentially, which keeps resource use modest and avoids concurrent navigation on the same page. For production batches, consider a bounded pool of pages or browser contexts rather than launching one browser per URL. Preserve the URL in a manifest if filenames could collide, such as when query parameters distinguish pages. Do not put secrets in filenames or logs.

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

Readiness and screenshot choices

  • Waiting: networkidle is a useful starting point, but pages with analytics, polling, or persistent requests may never become idle. In that case, wait for a page-specific selector or use a deliberate delay after navigation.
  • Full-page versus viewport: fullPage: true captures the full scrollable document. Remove it for a viewport-only image. Very long pages can produce large images and take longer to render and store.
  • Consistency: Playwright recommends creating and comparing visual snapshots in the same environment. Operating system, browser version, settings, hardware, power source, and headless mode can affect rendering. Pin the browser/runtime and run comparisons consistently in CI.
  • Concurrency: Sequential capture is slower but easier on the machine and target sites. If you parallelize, limit concurrent pages, use retries only for transient failures, and respect site access rules.
  • Failures: A navigation timeout does not prove the page is broken; a site may be slow or keep connections open. Log the URL and error, then adjust readiness conditions rather than blindly increasing every timeout.

Or skip the browser setup

For URL screenshots without installing and maintaining a browser, ScreenshotNeo accepts one GET request per URL and returns PNG, JPEG, WebP, or PDF. Its API accepts URL, viewport, full-page and other capture options; see the API documentation.

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)
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Cookie banners and consent overlays, newsletter popups, and chat widgets are handled before capture, with each cleanup step configurable. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

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

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

Troubleshooting

Loki cannot connect to Storybook

Make sure the Storybook server is running and reachable from Loki’s browser target. Check the configured address and port in the project setup, and confirm the server has finished starting before running loki update or loki test.

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

Every Loki comparison fails

Check that the reference images are present and that captures use a consistent runtime. Browser, operating system, rendering settings, and headless mode can alter pixels. Review the difference images before deciding whether to refresh the baseline.

A Yarn or npm flag appears to be ignored

Package runners may consume arguments rather than forwarding them. Loki’s CLI documentation says to separate forwarded arguments with --; verify the syntax against the installed version.

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

A Playwright navigation times out

Some pages do not reach network idle because of ongoing requests. Replace waitUntil: 'networkidle' with a wait for a meaningful selector, or use a controlled delay after a less strict navigation condition. Distinguish a failed navigation from a page that loaded but did not satisfy the selected readiness condition.

Different URLs overwrite the same image

Hostname-and-path slugs can collide after sanitization or when URLs differ only by query string. Add a stable index or hash derived from the full URL, and keep a manifest mapping filenames back to source URLs.

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

Frequently Asked Questions

Can Loki capture several Storybook stories in one run?

Yes. Loki’s test workflow captures stories exposed by Storybook, and its CLI includes filters for stories, configurations, and targets.

Does Loki provide a command that reads a text file of unrelated URLs?

The reviewed Loki CLI documentation does not describe an arbitrary URL-list input. Use a browser automation script or screenshot API for that job.

Should I update Loki reference images whenever a test fails?

No. Inspect the current and difference images first; approve a new baseline only when the visual change is intended.

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.

LokiPlaywrightScreenshotNeoscreenshotsStorybookvisual regression

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
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.