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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To download a page whose content appears after JavaScript runs, use a real browser rather than a basic HTTP client. Launch Playwright or Puppeteer, navigate to the URL, wait for a page-specific readiness signal, and then save the artifact you need: the file produced by a click, the current rendered HTML, or a PDF.

Why ordinary downloads miss JavaScript content

An HTTP client receives the server’s initial response. It does not execute the scripts that fetch products, render a dashboard, open a modal, or create a download after a button click. Saving that response can therefore produce an incomplete shell of the application.

Browser automation runs the same client-side code as a visitor. The important distinction is not merely “wait longer”; it is waiting for a condition that proves the content you need is ready. A selector for the results, a navigation milestone, or a documented network-idle state is more reliable than an arbitrary sleep.

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

Choose the artifact before writing code

What you need Best approach Important limitation
The exact attachment generated by a button Playwright download event, then saveAs() The temporary browser download must be copied before the context closes.
Post-JavaScript markup Puppeteer page.content() (or Playwright’s equivalent) The HTML is not a self-contained archive of external CSS, images, fonts, or API responses.
A shareable visual document Puppeteer or Playwright PDF generation Print CSS is the default; choose screen media when the on-screen design is required.

Prerequisites and browser installation

Use a current Node.js project and install one browser automation library. Playwright’s installation workflow includes browser binaries and, on Linux, may require operating-system dependencies. Puppeteer normally downloads a compatible Chrome during installation; package managers that block install scripts can prevent that download, in which case install the required browser explicitly.

#1 Best Overall
Lexar D40E 128GB Dual USB 3.2 Gen 1 Type-C Jump Drive, Champagne Silver
  • USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
  • Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
  • Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
  • Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
  • Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty
npm install playwright
npx playwright install
# or
npm install puppeteer

Keep browser binaries and your automation package aligned. In a restricted CI image, verify that the executable exists before debugging page logic.

Download a file created by a JavaScript click with Playwright

Start waiting for the download before clicking. Playwright emits the download event once the download starts; registering the wait afterward can miss it.

import { chromium } from 'playwright';

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

await page.goto('https://example.com/app', { waitUntil: 'domcontentloaded' });
await page.getByRole('button', { name: 'Download file' }).waitFor();

const downloadPromise = page.waitForEvent('download');
await page.getByRole('button', { name: 'Download file' }).click();
const download = await downloadPromise;

const failure = await download.failure();
if (failure) throw new Error(`Download failed: ${failure}`);
await download.saveAs(`/tmp/${download.suggestedFilename()}`);

await context.close();
await browser.close();

Use a role, label, or stable test identifier rather than a brittle positional selector. If the click opens a new page instead of an attachment, wait for that page and handle it as navigation. If the site requires a consent dialog, dismiss it before locating the download control. Authentication must be performed through an account and permissions you are authorized to use; browser automation does not promise to bypass paywalls, bot checks, CAPTCHAs, or access controls.

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
SANDISK 128GB Ultra Flair, USB-A Flash Drive, Up to 150MB/s Read Speeds
  • High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
  • Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
  • Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
  • Sleek, durable metal casing
  • Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]

Preserve downloads before teardown

Browser-context downloads are temporary and are deleted when the context closes. Always call saveAs(), copy the file, or otherwise persist it before closing the context. For repeatable jobs, create a dedicated output directory and record the suggested filename plus the final path.

Save the rendered HTML with Puppeteer

Puppeteer’s page.content() returns the full current HTML, including the document type declaration. Navigate, wait for the data-bearing element, write the string, and close the browser in a finally block in production code.

import puppeteer from 'puppeteer';
import { writeFile } from 'node:fs/promises';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com/app', { waitUntil: 'networkidle2' });
  await page.waitForSelector('main');
  await writeFile('rendered.html', await page.content(), 'utf8');
} finally {
  await browser.close();
}

networkidle2 is a useful baseline, not a guarantee that your application’s data is complete. A page can keep analytics connections open, or fetch a second batch after the network quiets. Combine a navigation state with a selector, a known result count, or an application-specific readiness flag. The saved markup contains the DOM at capture time; linked resources remain linked, so opening the file offline may not reproduce the page.

Rank #3
2 Pack 64GB USB Flash Drive USB 2.0 Thumb Drives Jump Drive Fold Storage Memory Stick Swivel Design - Black
  • What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
  • Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
  • Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
  • Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
  • Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers

Generate a PDF from the rendered page

Puppeteer’s PDF API generates a PDF using print CSS media by default. If the screen layout is the intended result, emulate screen media first and include backgrounds.

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

const url = 'https://example.com/app';
const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto(url, { waitUntil: 'networkidle2' });
  await page.waitForSelector('main');
  await page.emulateMediaType('screen');
  await page.pdf({
    path: 'page.pdf',
    printBackground: true,
    format: 'A4',
    margin: { top: '16mm', right: '16mm', bottom: '16mm', left: '16mm' }
  });
} finally {
  await browser.close();
}

Playwright exposes the same operation with await page.pdf({ path: 'page.pdf' }). PDF options can specify paper size, margins, landscape orientation, page ranges, and background printing. Decide whether print or screen styling is correct before diagnosing visual differences.

Make readiness, authentication, and lazy content explicit

Wait for the content you will save

  • Prefer waitForSelector() for the result container or a “loaded” marker.
  • Use a documented navigation state such as domcontentloaded when that is sufficient.
  • Use networkidle2 as a signal, then verify the actual content.
  • Avoid fixed sleeps except as a last-resort supplement; timing varies across runs.

Handle dialogs and lazy sections

Consent banners, newsletter popups, and chat widgets can cover controls or alter the captured document. Close them deliberately. Scroll or interact to trigger lazy-loaded sections, then wait for their selectors. If the site uses infinite scrolling, define a stopping rule such as a target item count or an end-of-results marker.

Reuse an authorized session

Log in through an approved flow, save a storage state when appropriate, and load it into later contexts. Treat cookies, tokens, downloaded files, and rendered HTML as sensitive data. Never put credentials in source code or logs.

Rank #4
SIMMAX 32GB Memory Stick USB 2.0 Flash Drives Swivel Thumb Drive Pen Drive (32GB Purple)
  • GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
  • BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
  • EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
  • TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
  • WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.

Common failures and fixes

Symptom Likely cause Fix
Saved HTML has an empty app shell Capture happened before data rendering Wait for the result selector or application-ready marker, not only navigation.
Download promise times out Wrong locator, disabled control, or click opens a page Confirm the visible button, inspect whether a new page opens, and register the event before clicking.
File disappears after the script exits It remained in the temporary browser directory Call saveAs() before closing the context.
PDF misses colors or layout Print media rules are being applied Call emulateMediaType('screen') and set printBackground: true.
Browser fails to launch in CI Missing binary or OS libraries Run the library’s browser install command and install required Linux dependencies; check executable permissions.
Content is still incomplete after network idle Late API calls, lazy loading, or persistent analytics sockets Wait for a page-specific marker and trigger the lazy section explicitly.
Navigation is blocked Authentication, a paywall, CAPTCHA, or bot defense Use an authorized session or request access; automation is not a bypass.

Performance, reliability, and operational safeguards

  • Launch one browser and create isolated contexts for batches instead of launching a process per URL.
  • Set navigation and selector timeouts, catch errors, and save a diagnostic screenshot or console log on failure.
  • Close pages, contexts, and browsers in guaranteed cleanup code.
  • Limit concurrency to what your CPU, memory, and target site can handle; respect the site’s terms and rate limits.
  • Use deterministic viewport, timezone, locale, and user-agent settings when comparing captures.
  • Record the URL, timestamp, readiness condition, browser version, and output checksum so artifacts can be audited.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. It accepts a URL in one request and returns PNG, JPEG, WebP, or PDF. Before capture it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and whether it was billed. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—work with Claude, Cursor, and other MCP clients.

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

For a screenshot, see the ScreenshotNeo documentation for all options, then run:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also supports full-page captures with lazy images loaded, CSS-selector element shots, dark mode, device presets and custom viewports, retina scale, PDF paper and page controls, HTML/CSS-to-image, custom JavaScript and CSS, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, easing migration.

Every feature is included on every plan: 1,000 shots per month free with no card; Starter costs $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing provides two months free. Sign up free for 1,000 screenshots a month with no card.

Best Value
Sale
IMEASON Swivel Design 16GB USB Flash Drive with Keychain, USB 2.0 Portable Thumb Drive Memory Stick, FAT32 Format Flashdrive for Data Storage, Photos, Music, Files (Black, 16 GB)
  • 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
  • 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
  • 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
  • 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
  • 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.

FAQ

Can I use a basic fetch request instead?

Only when the required content is already in the server response. If JavaScript must execute, use a browser runtime.

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

Is rendered HTML the same as an offline copy?

No. It captures the current DOM, while external stylesheets, images, fonts, and API responses remain separate resources.

Which tool should I choose?

Choose Playwright for browser coverage and event-driven downloads; choose Puppeteer for a straightforward Chromium workflow and its HTML and PDF APIs.

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.