October DealsAmazon USOctober deal check: compare before you payAmazon 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Capture an HTML File as a Screenshot with LambdaTest

Render a local HTML document in Playwright before capturing it. Use SmartUI for a named visual-comparison snapshot, or save a PNG directly with Playwright.

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.

To capture a local HTML file with LambdaTest SmartUI, open the file in a Playwright browser page, then pass that page to SmartUI’s smartuiSnapshot function. This captures the browser-rendered page, not the raw HTML source. The documented SmartUI example uses a local browser but navigates to a public website; applying it to a file:// page is a workflow adaptation, so verify that your installed Playwright and SmartUI setup supports your local file and assets.

Choose the workflow that matches your goal

Goal Use What you get
A screenshot image saved on your machine Playwright directly A PNG file, full-page capture, or screenshot bytes. Playwright documents these screenshot options.
A named snapshot in a SmartUI visual-comparison workflow Playwright with SmartUI’s smartuiSnapshot A snapshot submitted through the SmartUI integration. The SmartUI Playwright guide shows a local Chromium browser and a page snapshot.
Compare an image you already captured locally SmartUI image upload Upload the image and comparison metadata. The SmartUI upload API reference states a maximum upload size of 100 MB.
Capture a remote site across browser, device, resolution, or location options LambdaTest screenshot API A remote screenshot test and result retrieval. The available API reference is version 1.0.1 and may not reflect current endpoint details; check the live documentation before building against it.

Capture a local HTML file as a SmartUI snapshot

The sequence is: launch a local browser, open the rendered HTML page, and submit its Playwright page to SmartUI. The integration guide demonstrates the snapshot call but does not show a standalone local-file URL, so treat the file-loading step below as an adaptation rather than a verbatim documented example.

As an Amazon Associate I earn from qualifying purchases.

1. Open the HTML document in Playwright

Use a local file URL for the HTML document. Resolve the path to an absolute path to avoid ambiguity about the process working directory. For pages that load CSS, images, fonts, or scripts by relative path, keep those assets in the expected locations and confirm they load in the browser before capturing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const fileUrl = new URL('./page.html', import.meta.url).href;
await page.goto(fileUrl);

If the page depends on JavaScript-rendered content, wait for a meaningful selector or another explicit readiness condition before taking the snapshot. A navigation completing does not necessarily mean every asynchronous component or remote asset is ready.

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • 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

2. Submit the page to SmartUI

Follow the installation and authentication steps in the LambdaTest SmartUI Playwright guide, then use its documented snapshot integration point:

await smartuiSnapshot(page, 'Local HTML page');

Here, page is the Playwright page opened to the HTML document. Give the snapshot a stable, descriptive name so it is identifiable in your comparison workflow. The guide’s example navigates to a public site; test the local-file variation in your environment rather than assuming the example explicitly covers it.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • 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.

Save an image locally with Playwright instead

If the requirement is simply a PNG on disk and you do not need SmartUI comparison, Playwright can capture the rendered page directly. This is also a useful way to confirm that the local HTML renders as expected before using a cloud comparison workflow.

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

Runnable Node.js example

Install Playwright and its Chromium browser as described in its installation documentation. Save this script beside page.html and run it with Node.js:

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.
import { chromium } from 'playwright';
import { pathToFileURL } from 'node:url';
import { resolve } from 'node:path';

const browser = await chromium.launch();
try {
  const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
  await page.goto(pathToFileURL(resolve('./page.html')).href);
  await page.screenshot({ path: 'screenshot.png', fullPage: true });
} finally {
  await browser.close();
}

The script saves screenshot.png in the current working directory. Set fullPage: false for only the visible viewport. For an individual component, locate it and use the locator screenshot method; Playwright documents viewport, full-page, element, and buffer capture in its screenshot guide.

For a page that needs time to render

Prefer waiting for the content your screenshot depends on instead of adding an arbitrary long delay. For example, after navigating, wait for a known element:

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)
await page.goto(pathToFileURL(resolve('./page.html')).href);
await page.locator('#report-ready').waitFor();
await page.screenshot({ path: 'screenshot.png', fullPage: true });

Replace #report-ready with a selector present only when the relevant content is ready. If the page has no such marker, use an appropriate readiness condition for the page; a fixed timeout can be a fallback, but it can make captures slower and may still be too short on a slow run.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Upload a locally captured image for SmartUI comparison

If you already have a PNG or another supported local image, SmartUI’s upload API is an alternative to capturing through its Playwright integration. Its reference describes multipart image upload and metadata used to map screenshots for comparison. Consult the upload API documentation for the current request fields and authentication details. That reference lists a 100 MB maximum upload size for this API; do not treat it as a general limit for every LambdaTest product or account.

Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • 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

Use LambdaTest’s remote screenshot API for remote captures

LambdaTest’s screenshot API reference describes starting screenshot tests, retrieving screenshot information, and selecting browser, device, resolution, and location combinations. The referenced documentation is version 1.0.1 and its indexed copy is old, so verify the current endpoint, request parameters, and response format in LambdaTest’s live API documentation before implementing it. This route is for remote captures; it is not necessary just to render a local HTML file in a local Playwright browser.

Or skip the browser setup

ScreenshotNeo can return a screenshot or PDF from one GET request, without setting up a browser locally. For a URL the service can reach, the cURL form is:

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 request options. This API takes a URL; for a local HTML file, first make the page reachable at a URL rather than passing a local filesystem path. Cookie banners, newsletter popups, and chat widgets are removed before capture, and each of those cleanup steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; responses identify the page verdict and billing status in headers. Its MCP server includes screenshot, page-info, and PDF tools for AI agents. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000 shots. Sign up free for 1,000 screenshots a month, with no card required.

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

Troubleshoot common capture problems

The file opens, but images or styles are missing

  • Check whether asset URLs are relative to the HTML file and whether the files remain at those paths.
  • Open the browser page and inspect failed requests or console errors before capturing.
  • If resources are blocked by browser security or depend on a server origin, serve the HTML and assets locally over HTTP and navigate to that local address instead of a file URL.

The screenshot is blank or incomplete

  • Confirm the page has rendered before taking the screenshot; wait for a content-specific selector where possible.
  • Check for JavaScript errors, failed network requests, or content that appears only after interaction.
  • For a long page, use full-page capture; for a specific component, capture its locator rather than assuming it is inside the viewport.

The SmartUI snapshot is missing or cannot be compared

  • Check the SmartUI setup, credentials, and integration instructions against the current official guide.
  • Use a consistent snapshot name and comparison metadata appropriate to your workflow.
  • If the page is local, verify that your SmartUI and Playwright setup accepts the local-file navigation; the cited guide does not explicitly document a file:// example.

An upload is rejected

Check that the request follows the upload API’s multipart format, includes the required metadata, and is within the documented 100 MB maximum for that endpoint. Confirm the current API reference for accepted formats and fields.

FAQ

Does a screenshot contain the HTML source?

No. It is an image of the page as rendered by a browser. The HTML source itself is not embedded as editable markup in the screenshot.

Can I capture a single element instead of the whole page?

Yes. Playwright supports screenshots of a selected locator, which is useful for a chart, card, or other component rather than the full document.

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$35.80
SaleBestseller No. 2
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Compatible with Nintendo Switch 2’s new GameChat mode
$16.89
Bestseller No. 5
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$67.90

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.