Use Selenium’s Chromium WebDriver to open the page and capture a PNG, then return the image or save it to durable storage before the Lambda invocation ends. The difficult part is not the screenshot call: you must package a browser, matching driver, and native libraries for your chosen Lambda runtime and architecture. AWS supports ZIP packages with layers and container images, but no single Chromium bundle or launch configuration is established as universally compatible.
What the Lambda screenshot flow does
The handler starts a headless browser, navigates to a URL, waits for the page state your application needs, and captures the browser’s current view. Selenium provides three output forms: save a PNG to a file, return PNG bytes, or return base64 text. A local file is only temporary unless you explicitly deliver or persist it.
The example below shows the Selenium control flow, not a drop-in deployment bundle: browser and driver paths, launch flags, and shared libraries depend on the bundle you build. AWS and Selenium document the packaging constraints and screenshot APIs, but do not prescribe one current Chromium build for every Lambda runtime and architecture.
Build and package a compatible browser
- Choose a Lambda runtime and architecture. Keep the Python runtime, instruction-set architecture, Chromium executable, WebDriver executable, and native shared libraries compatible with one another.
- Choose ZIP with layers or a container image. Put the handler and Python dependencies in the expected package layout. Include browser files and dependencies in the ZIP/layers or image. AWS warns that native-code packages must be built for a compatible environment; a build that works on a developer workstation is not proof that it will load in Lambda. See AWS Python deployment package guidance.
- Pin and verify the browser bundle. Validate the selected Chromium, driver, system libraries, and headless launch options together for the target runtime and architecture. Do not assume a community layer or a set of flags works across Lambda environments.
ZIP with layers or container image?
| Choice | AWS limit (live documentation checked 2026-10-03) | When it may fit |
|---|---|---|
| ZIP deployment package, including layers | 250 MB unzipped | Use when the compatible browser bundle and dependencies fit and the ZIP/layer build is manageable. |
| Container image, including layers | 10 GB maximum uncompressed image size | Use when maintaining the browser and its system dependencies in an image is more practical or the bundle exceeds ZIP headroom. |
These are packaging limits, not performance results: AWS documentation does not establish that one route makes Selenium screenshots faster. Image size alone also does not guarantee runtime compatibility. Check the current AWS Lambda quotas before deployment because limits can change.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Write the Selenium handler
This Python example expects a compatible Chromium and ChromeDriver to already be included in the deployment, at the paths set in environment variables. Set CHROME_BINARY and CHROMEDRIVER to the actual paths in your bundle, and supply the target URL in the event. The launch arguments shown are placeholders for the verified options required by your chosen browser build; they are not a universal Lambda configuration.
import os
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
def lambda_handler(event, context):
url = event["url"]
chrome_binary = os.environ["CHROME_BINARY"]
chromedriver = os.environ["CHROMEDRIVER"]
output_path = "/tmp/page.png"
options = webdriver.ChromeOptions()
options.binary_location = chrome_binary
options.add_argument("--headless")
# Add only launch flags verified for your Chromium build and Lambda runtime.
driver = None
try:
driver = webdriver.Chrome(
service=Service(executable_path=chromedriver),
options=options,
)
driver.set_page_load_timeout(60)
driver.get(url)
# If the page renders content after its load event, wait for an
# application-specific condition here before capturing.
success = driver.save_screenshot(output_path)
if not success:
raise RuntimeError("Selenium could not write the screenshot")
with open(output_path, "rb") as image_file:
image_bytes = image_file.read()
# Replace this return with a durable upload or an appropriate
# response mechanism for your invocation and image size.
return {
"statusCode": 200,
"headers": {"Content-Type": "image/png"},
"body": __import__("base64").b64encode(image_bytes).decode("ascii"),
"isBase64Encoded": True,
}
finally:
if driver is not None:
driver.quit()
The API Gateway or function-invocation integration must support a binary response configured as base64; otherwise upload the bytes to durable storage and return a reference. Selenium documents save_screenshot and get_screenshot_as_file as PNG file methods that return True on success and False for an I/O error. For in-memory handling, use driver.get_screenshot_as_png() for bytes or driver.get_screenshot_as_base64() for base64 text. See Selenium’s Chromium WebDriver API.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Wait for the right page state
driver.get(url) waits for the page-load event, but client-side applications can render or fetch important content afterward. If the screenshot must include a particular element, wait for that element or another application-specific readiness condition with Selenium’s explicit waits rather than relying on a fixed sleep. Use set_page_load_timeout to bound navigation; the example uses 60 seconds as an application choice, not an AWS-mandated value. A navigation timeout should be handled as a failed capture, not silently treated as a complete image.
Return or persist the screenshot
AWS provides temporary storage in /tmp, unique to each execution environment. The files may remain available if that environment is reused, but they are not durable and must not be treated as persistent output. AWS describes this as: “Lambda provides ephemeral storage for functions in the /tmp directory.” See AWS Lambda ephemeral storage.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
- Return it directly: Read the PNG bytes and encode them as base64 only when your invocation path supports a binary response and the payload is suitable.
- Persist it: Upload the bytes to a durable destination before the handler exits, then return a reference. This is the appropriate pattern when another process or user must retrieve the screenshot later.
- Allocate enough scratch space: Include the extracted browser, downloads, temporary files, and output image in your storage estimate. AWS’s configurable range is 512 MB to 10,240 MB; the right amount depends on your bundle and workload.
Set realistic timeout and storage limits
AWS’s current standard Lambda maximum execution timeout is 900 seconds (15 minutes). The function can still time out earlier if configured that way, so choose a limit that accounts for browser startup, page navigation, readiness waits, screenshot capture, and any upload. The browser navigation timeout should also be bounded so a stalled page does not consume the whole invocation. AWS limit figures above were checked against live documentation on 2026-10-03; confirm current quotas before deploying.
Common failures and fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| WebDriver cannot start or reports a session-creation error | Chromium, ChromeDriver, runtime, architecture, or native libraries do not match. | Verify executable paths and permissions, architecture, browser/driver compatibility, and required shared libraries in the deployed environment. |
| Browser exits immediately or reports an unsupported option | The configured launch flags do not match the selected browser build. | Use only options validated for that exact build and runtime; do not copy an unverified universal flag set. |
| Screenshot is blank or misses page content | The page has not rendered the needed content when capture occurs, or navigation did not finish as expected. | Check navigation errors and wait for the target element or application-specific readiness condition after the load event. |
save_screenshot returns False or writing fails |
The target path is unwritable, storage is insufficient, or a file operation failed. | Write to /tmp, check available ephemeral storage, and verify the return value before reading the file. |
| Invocation times out | Browser startup, page load, readiness wait, or upload exceeds the configured function timeout. | Bound navigation and waits, tune the function timeout within AWS’s limit, and avoid treating unbounded page work as reliable. |
| Screenshot disappears after the invocation | The image was left only in /tmp. |
Return the image in the supported response path or upload it to durable storage before exit. |
Or skip the browser setup
If your goal is a screenshot rather than managing Chromium in Lambda, ScreenshotNeo provides a one-request screenshot API. It can return PNG, JPEG, WebP, or PDF; its API and MCP server are described at ScreenshotNeo.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
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)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the ScreenshotNeo API documentation for request options. Cookie banners are accepted and removed before the shot, along with known newsletter popups and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. An MCP server lets AI agents use screenshot tools. The Free plan includes 1,000 screenshots a month without a card, and paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Frequently asked questions
Can Selenium return a screenshot without writing a file?
Yes. Use get_screenshot_as_png() for PNG bytes or get_screenshot_as_base64() for base64 text.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Does a screenshot of a page include content loaded after navigation?
Only if that content has appeared by capture time. Add a readiness condition for the content your application requires.
Quick Recap
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.

