Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon 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×
Skip to content
World desk5 min

How to Upload Selenium Screenshots to Amazon S3 with Python

A practical Python workflow for saving Selenium screenshots as PNG files and uploading them to S3 with Boto3, including presigned uploads for credential-limited test runners.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save the Selenium browser window to a PNG file, then upload that file to an S3 bucket with Boto3. If your test runner should not hold AWS credentials, have a trusted service create a presigned upload request and send the screenshot with that temporary authorization instead.

Upload a Selenium screenshot with Boto3

Selenium’s Python WebDriver API can save the current browser window as a PNG with save_screenshot(filename). Boto3’s S3 transfer helper can then upload that local file to a bucket and object key.

  1. Choose a bucket and key. Replace the example bucket and key with the destination for your test artifacts.
  2. Save the screenshot. Create the local artifact directory and check Selenium’s return value.
  3. Upload the file. Configure an AWS identity for the process with permission to write to the intended bucket and key.

Install the dependencies in the Python environment used by the test runner with pip install selenium boto3. The following example assumes driver is an already-created Selenium WebDriver; it does not create or close the browser session.

from pathlib import Path
import boto3

bucket = "your-bucket"
key = "selenium/run-123/test-checkout.png"
local_path = Path("artifacts/test-checkout.png")
local_path.parent.mkdir(parents=True, exist_ok=True)

if not driver.save_screenshot(str(local_path)):
    raise RuntimeError("Selenium did not save the screenshot")

boto3.client("s3").upload_file(str(local_path), bucket, key)

This example combines the documented Selenium save method and Boto3 upload method; the documentation does not establish that this particular combined example has been tested as an integration.

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.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.

Use a readable file object instead

If your code already has the screenshot open in binary mode, Boto3 also provides upload_fileobj. Pass a readable binary file object, the bucket, and the key:

with open(local_path, "rb") as image_file:
    boto3.client("s3").upload_fileobj(image_file, bucket, key)

Choose where AWS credentials live

Upload directly from the test runner

Use upload_file or upload_fileobj when the runner has an approved AWS identity that can write to the intended destination. Configure credentials through the runtime’s AWS credential mechanism, such as the environment or role assigned to the runner; do not put long-lived secrets in source code. Grant only the permissions the workflow needs.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

Use a presigned upload when the runner should not have AWS credentials

A trusted component with the necessary S3 permissions can create a presigned request for a specific object. The runner uses the returned authorization for the permitted upload, without receiving general AWS credentials. AWS describes a presigned URL as temporary access for someone who does not have credentials or permission to access an S3 object: AWS presigned URL upload guidance.

Boto3 documents presigned POST, which returns a URL and form fields that the client must submit. AWS also documents presigned PUT. Use the method that generated the request, along with its required fields, headers, and object key; do not treat a POST form request and a PUT request as interchangeable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

Presigned URLs are bearer tokens: anyone who obtains one may use it within its scope and validity. Keep them out of source control, public logs, and user-visible output. Their usable lifetime is limited by both the configured expiry and the signing credentials; temporary credentials can expire before the requested URL expiry, and revoked credentials can invalidate access. AWS documents SDK and CLI presigned URL lifetimes up to seven days for eligible credentials, but that maximum should not be assumed for temporary role credentials. See AWS presigned URL guidance.

Choose an object key that preserves the right screenshots

An upload to an existing key replaces the object at that key. A key such as selenium/run-123/test-checkout.png is more useful than a constant filename if repeated CI runs should retain separate artifacts. Include an appropriate run identifier, test name, or capture time to reduce accidental overwrites.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

Do not assume that an overwritten object remains available as an older version. That depends on the bucket’s versioning configuration, which should be checked separately if version history is required.

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

Integrity and request details for presigned uploads

For SigV4 uploads, S3 supports checksum algorithms. When using a checksum, the upload request must include the corresponding checksum header. Make sure the client’s request matches the method and headers expected by the generated authorization.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.

Troubleshoot failed uploads

  • Selenium returns false or the file is missing: Check that the destination directory exists and that the process can write there. The example creates the parent directory, but the runner still needs filesystem permission.
  • AWS reports access denied: Confirm the identity used by Boto3 is the one you intended and that it has permission to upload to the specific bucket and key. For delegated uploads, verify that the presigned request was created for the intended operation and object.
  • SignatureDoesNotMatch on a presigned upload: AWS recommends checking whether the URL was altered or expired, whether the system clock is synchronized, whether the request’s content type matches the value used when signing, and whether the request targets the bucket’s correct Region. Also send the exact method, fields, and signed headers expected by the generated request.
  • The uploaded screenshot replaces an earlier artifact: The runs used the same key. Add a run-specific or otherwise unique component to the key, or verify bucket versioning if preserving prior versions is part of the design.
  • The request fails after working earlier: Check the presigned URL expiry and the status of the credentials that signed it. A configured expiry does not extend the life of temporary signing credentials.

Performance, reliability, and CI considerations

Boto3’s upload_file transfer helper can split large files into chunks and upload them in parallel. That is a capability of the helper, not a performance guarantee for a particular runner or screenshot. Ordinary screenshots may be small, but network conditions, browser capture time, and artifact size still affect the full job.

Keeping a local screenshot before upload can help CI workflows that retain workspace artifacts or need to distinguish a browser-capture failure from a storage failure. Decide how the job should behave if S3 is unavailable: fail the test, retry under a bounded policy, or preserve the local file for later handling. Those are workflow choices; the Selenium and Boto3 interfaces alone do not define them.

Or skip the browser setup

If you need a screenshot of a web page rather than a browser state captured inside your Selenium test, ScreenshotNeo is a website screenshot API. Its API can return an image or PDF from one GET request, and you can save the returned bytes as an artifact for your own S3 upload. See the ScreenshotNeo API documentation.

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)

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. An MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

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

Sign up for ScreenshotNeo free.

Frequently Asked Questions

Does this save a full-page screenshot?

Selenium’s `save_screenshot` saves the current browser window. This workflow does not establish a full-page capture method.

Can I upload the screenshot without writing a local file?

Boto3 supports `upload_fileobj` for a readable binary file object, but Selenium’s documented `save_screenshot(filename)` workflow writes a PNG file. A memory-only Selenium capture is not shown here.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.