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 DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk9 min

How to Screenshot Multiple URLs and Store the Images in Amazon S3

A practical Node.js workflow for capturing a list of URLs with Playwright and storing each screenshot as a private, organized Amazon S3 object.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright to capture each URL, then upload each screenshot as a separate Amazon S3 object. The pattern below runs locally with Node.js, keeps successful captures if another URL fails, and gives objects predictable, non-colliding keys.

What you need to decide first

Before running a batch, choose the capture shape and the way the archive will be accessed. These choices affect image size, repeatability, and whether the screenshots can be viewed by anyone outside your application.

As an Amazon Associate I earn from qualifying purchases.

  • Capture: A viewport screenshot gives a consistent screen-sized image. A full-page screenshot includes the scrollable page. An element screenshot focuses on a selected locator.
  • Transfer: Save files locally when you want easy inspection and retry handling, or upload screenshot bytes directly from memory to avoid intermediate files.
  • Batch behavior: Sequential processing is simple and limits load on target sites. Bounded concurrency can shorten a large run but uses more browser resources and sends more simultaneous requests.
  • Storage: Use a run identifier in object keys to distinguish repeated batches. Reusing the same key replaces the current object unless bucket versioning is enabled; conditional writes can prevent replacing an existing object.
  • Access: Keep an archive private unless public delivery is a deliberate requirement. For private review, use your application or an authenticated access path rather than making the bucket public.

Set up Playwright and AWS access

  1. Install Node.js and create a project directory, then run npm init -y.
  2. Install the browser automation and AWS SDK packages with npm install playwright @aws-sdk/client-s3, then install a browser with npx playwright install chromium.
  3. Configure AWS credentials using an IAM role or the AWS SDK credential chain. Give the identity permission to upload to the intended bucket and prefix; avoid broader access than the workflow needs.
  4. Set the environment variables AWS_REGION, S3_BUCKET, and RUN_ID. For example, use a date-and-time identifier for RUN_ID so a later run does not reuse the same keys.
  5. Put one URL per line in urls.txt. Review the list before capture; the script below accepts only HTTP and HTTPS URLs and rejects credentials embedded in URLs.

Capture a URL list and upload each image

Save this as capture-to-s3.mjs. It captures each page sequentially, records per-URL outcomes, and continues after an individual navigation, screenshot, or upload failure. Set FULL_PAGE=true to capture the full scrollable page; the default is a viewport capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { readFile } from 'node:fs/promises';
import { chromium } from 'playwright';
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { createHash } from 'node:crypto';

const bucket = process.env.S3_BUCKET;
const region = process.env.AWS_REGION;
const runId = process.env.RUN_ID;
const fullPage = process.env.FULL_PAGE === 'true';
const timeoutMs = Number(process.env.NAVIGATION_TIMEOUT_MS ?? 30000);

if (!bucket || !region || !runId) {
  throw new Error('Set S3_BUCKET, AWS_REGION, and RUN_ID before running.');
}
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
  throw new Error('NAVIGATION_TIMEOUT_MS must be a positive number.');
}

function parseUrl(line) {
  const url = new URL(line);
  if (!['http:', 'https:'].includes(url.protocol)) {
    throw new Error('Only HTTP and HTTPS URLs are accepted.');
  }
  if (url.username || url.password) {
    throw new Error('URLs containing embedded credentials are not accepted.');
  }
  return url;
}

function objectKey(url) {
  const host = url.hostname.toLowerCase().replace(/[^a-z0-9.-]/g, '_');
  const path = url.pathname.split('/').filter(Boolean)
    .map(part => part.replace(/[^a-zA-Z0-9._-]/g, '_')).join('/') || 'root';
  const digest = createHash('sha256').update(url.href).digest('hex').slice(0, 12);
  return `runs/${runId}/${host}/${path}-${digest}.png`;
}

const lines = (await readFile('urls.txt', 'utf8'))
  .split(/r?n/).map(line => line.trim()).filter(line => line && !line.startsWith('#'));
if (lines.length === 0) throw new Error('urls.txt contains no URLs.');

const s3 = new S3Client({ region });
const browser = await chromium.launch({ headless: true });
const outcomes = [];

try {
  const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
  for (const line of lines) {
    let url;
    try {
      url = parseUrl(line);
      const response = await page.goto(url.href, { waitUntil: 'load', timeout: timeoutMs });
      if (!response) throw new Error('Navigation returned no main-document response.');
      if (!response.ok()) throw new Error(`Main document returned HTTP ${response.status()}.`);

      const image = await page.screenshot({ type: 'png', fullPage });
      const key = objectKey(url);
      await s3.send(new PutObjectCommand({
        Bucket: bucket,
        Key: key,
        Body: image,
        ContentType: 'image/png',
        ServerSideEncryption: 'AES256',
        Metadata: { source: url.href, run: runId }
      }));
      outcomes.push({ url: url.href, ok: true, key });
      console.log(`OK ${url.href} -> s3://${bucket}/${key}`);
    } catch (error) {
      outcomes.push({ url: line, ok: false, error: error.message });
      console.error(`FAILED ${line}: ${error.message}`);
    }
  }
} finally {
  await browser.close();
}

const failed = outcomes.filter(item => !item.ok);
console.log(JSON.stringify({ total: outcomes.length, succeeded: outcomes.length - failed.length, failed }, null, 2));
if (failed.length) process.exitCode = 1;

Run it with the required configuration in your shell:

#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
export AWS_REGION=us-east-1
export S3_BUCKET=my-screenshot-archive
export RUN_ID=2026-10-03T120000Z
node capture-to-s3.mjs

The image bytes go straight from Playwright to the S3 SDK; no local image file is required. Each object is tagged as image/png, and the key includes the run identifier, hostname, sanitized path, and a short hash of the complete URL. The hash helps distinguish query strings and reduces collisions between URLs that otherwise map to the same path.

Adjust capture behavior for your pages

Viewport, full page, or one element

The script uses a 1440 by 900 viewport. Change the viewport dimensions to match the comparison you need. To capture the full scrollable document, set FULL_PAGE=true; Playwright supports page.screenshot({ path: 'screenshot.png', fullPage: true }) for file output and returns screenshot bytes when no path is supplied.

For a single component, wait for and capture a locator instead of the entire page:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const card = page.locator('.product-card').first();
await card.waitFor({ state: 'visible', timeout: timeoutMs });
const image = await card.screenshot({ type: 'png' });

Use a selector that identifies the intended element on every target page; a selector that matches nothing will fail that URL. Locator screenshots are useful when the surrounding page is irrelevant, but do not provide a full-page record.

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

Wait conditions and dynamic content

The example waits for the main document’s load event. That does not guarantee that every image, animation, or client-rendered component has finished. When the target has a reliable marker, wait for it explicitly with page.waitForSelector('selector') before taking the screenshot. A fixed delay can help with known delayed content, but makes every capture slower and may still be too short on a busy page. Avoid treating network idle as a universal signal: pages with long-lived requests may never become idle.

File-first capture when debugging

To inspect screenshots locally before uploading, write one to disk with await page.screenshot({ path: 'screenshot.png' }), then pass the file stream or bytes to the S3 SDK. This adds disk handling but makes it easier to check whether an unexpected image came from navigation, page rendering, or storage.

Organize, protect, and serve the S3 objects

An S3 object key is a filename with optional prefixes, for example runs/<run-id>/example.com/page-abc123.png. Prefixes make runs easier to browse and manage. The sample explicitly requests SSE-S3 encryption using ServerSideEncryption: 'AES256'; S3 also applies SSE-S3 by default to new uploads. Use SSE-KMS instead when your key-management and access-control requirements call for it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Prevent unintended replacement: Keep a unique run ID, enable bucket versioning, or use a conditional write when a same-key object must not be replaced.
  • Keep access narrow: Upload requires write permission. Do not enable public read merely to make review convenient; deliver private images through an authenticated application or another controlled access mechanism.
  • Use metadata deliberately: The sample stores the source URL and run identifier as object metadata. URLs can contain sensitive query parameters, so remove or redact them if recording the full URL is not appropriate for your archive.
  • Choose retention deliberately: Configure lifecycle or deletion behavior according to how long the archive should remain available; no retention duration is assumed by the example.

Object storage and public website hosting are separate choices. For static website content stored on S3, AWS recommends Amplify Hosting. If the website content uses SSE-KMS and must be anonymously viewable, AWS specifies CloudFront with origin access control. See AWS guidance on hosting a static website on Amazon S3 before designing a public gallery.

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.

Batch reliability, speed, and cost limits

Sequential capture is intentionally conservative: a slow or problematic page delays later URLs, but a single failed URL does not erase earlier uploads. For larger batches, use a small concurrency limit rather than launching every URL at once. Each worker needs its own browser page, and raising concurrency increases browser memory use and simultaneous traffic to destination sites. Log the source URL, run ID, outcome, and S3 key so failed items can be retried independently.

Navigation and upload failures have different recovery paths. Retry transient timeouts or service errors with a bounded retry count and delay; do not retry a deterministic invalid URL or persistent HTTP error indefinitely. A retry that reuses the same run key replaces an earlier object unless versioning or conditional writes prevent it.

AWS documents these object-size limits in its current S3 User Guide, accessed October 3, 2026: a single PUT supports one object up to 5 GB; multipart upload supports objects from 5 MB to 50 TB; and the S3 console supports uploading a single object up to 160 GB. These are S3 limits, not recommended screenshot sizes. Screenshot images are generally far smaller, but multipart upload becomes relevant if this workflow is adapted to larger assets.

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

Playwright and S3 usage both consume resources, but the supplied implementation evidence does not establish a benchmark or per-run price. Keep the browser and concurrency limit sized to your machine, monitor AWS charges for your account, and follow destination sites’ terms and applicable access requirements when automating visits.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

Missing configuration or AWS credentials

If the script stops before capture because a required value is absent, set S3_BUCKET, AWS_REGION, and RUN_ID. If upload fails with an AWS authorization error, check that the active role or user has permission to put objects at the target bucket and prefix, and that the bucket policy and encryption configuration permit that operation.

Browser installation or launch errors

If Playwright cannot find Chromium, run npx playwright install chromium in the project environment. If a browser fails to launch in a restricted container, verify that the environment supports the required browser dependencies and permitted launch settings rather than disabling browser safeguards without review.

Navigation timeout or unexpected status

A timeout can indicate a slow page, blocked automation, or a page that never reaches the selected load condition. Increase NAVIGATION_TIMEOUT_MS for genuinely slow pages, or wait for a specific selector when the main document loads before the content you need. The example marks non-2xx main-document responses as failures; decide explicitly if your use case should capture error pages instead.

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

Blank, partial, or inconsistent image

Check whether the page needs a selector wait, a longer timeout, a different viewport, or full-page capture. Lazy-loaded images may not appear until scrolled into view; if they matter, scroll through the page and wait for content before capturing. A viewport screenshot and full-page screenshot are different outputs, so use the same mode for comparisons.

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.

Objects overwrite or keys are awkward

Confirm that RUN_ID changes for each batch. The host and path are sanitized for key use, while the URL hash distinguishes variants. If key reuse must be impossible, use bucket versioning or a conditional upload strategy and handle the resulting precondition failure as a distinct outcome.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its API can capture a page and return an image response; your application can upload those bytes to S3 using the same object-key and access-control decisions described above. For example, make the API request with cURL, then upload the resulting file with the AWS CLI:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
aws s3 cp shot.webp s3://my-screenshot-archive/runs/2026-10-03T120000Z/example.com/home.webp --content-type image/webp

See the ScreenshotNeo API documentation for request options. Cookie and consent banners, newsletter popups, and chat widgets are removed before the shot; each removal step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status. Its MCP server provides 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 screenshots.

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.

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

Frequently Asked Questions

Does the script make the S3 screenshots public?

No. Uploading an object does not require making it publicly readable; keep access private unless public delivery is an intentional part of the design.

Can I use JPG or WebP instead of PNG?

Yes. Select a supported screenshot type in Playwright and set the matching S3 ContentType, such as image/jpeg or image/webp.

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