Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Save Selenium Screenshots to Amazon S3 in an Indian AWS Region

A practical Python workflow for saving Selenium screenshots locally and uploading them to an S3 bucket in Mumbai or Hyderabad with Boto3.

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.

Use Selenium’s save_screenshot() to write the current browser window to a local PNG, confirm the save succeeded, then upload that file with Boto3 to your S3 bucket. Set the S3 client to the bucket’s actual region—not simply the runner’s location. AWS lists Mumbai as ap-south-1 and Hyderabad as ap-south-2.

Capture a screenshot and upload it with Boto3

The example below assumes you already have a configured Selenium WebDriver session in driver, an existing S3 bucket, and runtime credentials permitted to write the chosen object key. Set region to the bucket’s region.

As an Amazon Associate I earn from qualifying purchases.

from pathlib import Path
import boto3

# `driver` is an existing Selenium WebDriver session.
# Prefer a unique run_id so parallel or repeated tests do not overwrite each other.
run_id = "replace-with-test-run-id"
bucket = "your-existing-bucket"
region = "ap-south-1"  # Mumbai; use ap-south-2 for Hyderabad if that is the bucket region.
object_key = f"selenium-screenshots/{run_id}/checkout.png"
local_path = Path("artifacts") / run_id / "checkout.png"
local_path.parent.mkdir(parents=True, exist_ok=True)

if not driver.save_screenshot(str(local_path)):
    raise OSError(f"Selenium could not save screenshot to {local_path}")

s3 = boto3.client("s3", region_name=region)
s3.upload_file(
    str(local_path),
    bucket,
    object_key,
    ExtraArgs={"ContentType": "image/png"},
)

Selenium documents save_screenshot(filename) as saving the current window to a PNG file. It returns False on an I/O error and otherwise True; use a full path with a .png extension and make sure its parent directory exists. See the Selenium Python API reference.

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

Boto3’s upload_file accepts the local filename, bucket name, and S3 object key. The explicit key gives your test artifacts a predictable location; the ContentType extra argument identifies the object as PNG. See AWS’s Boto3 file-upload guide.

#1 Best Overall
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Choose the bucket’s Indian region

Set region_name to the region in which the destination bucket was created. The Selenium runner may be elsewhere; its location does not determine the bucket region. AWS lists Mumbai (ap-south-1) and Hyderabad (ap-south-2) among the S3 regions and endpoints. Check the bucket’s actual location in AWS before configuring the client. The official endpoint list is at Amazon S3 endpoints and quotas.

For a new bucket, create and configure it in the intended region, then use the same region for the client. The regional S3 REST endpoint is for authenticated object operations; this screenshot-upload workflow does not require an S3 static website endpoint or public website hosting. See What is Amazon S3?

Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Choose between Mumbai and Hyderabad based on where the bucket already resides, organizational data-location requirements, and the network path from the Selenium runner. The region names alone do not establish which will be faster for a particular deployment. If latency matters, measure it from the actual runner and workload.

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

Configure credentials and access safely

Boto3 supports several credential providers. Avoid embedding long-lived access keys in source code; use the runtime’s configured provider, such as an attached IAM role on EC2. Boto3 can retrieve role credentials through instance metadata. Consult Boto3 credentials for provider configuration.

Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Grant the runtime only the permissions it needs for the selected bucket and key prefix. The exact policy depends on the bucket policy, encryption configuration, prefix, and execution environment, so verify the policy for your setup rather than copying a universal policy. Keep diagnostic logs useful but never include credentials or screenshot contents.

S3 buckets and objects are private unless access is granted. AWS recommends using Block Public Access controls; new object uploads are encrypted at rest with SSE-S3 by default. Encryption does not replace access controls or a retention policy. See AWS guidance on blocking public access and SSE-S3 encryption.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Organize screenshot object keys

An S3 object key is the object’s location within the bucket. A prefix such as selenium-screenshots/<run-id>/<test-name>.png keeps artifacts grouped by run and test. Reusing the same key writes to the same object location, so a unique run identifier helps prevent repeated or parallel test runs from replacing one another’s screenshots.

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

Use a file-like object instead of a local file

If your code already has screenshot bytes in a readable binary file-like object, Boto3 provides upload_fileobj. Open the file in binary mode; AWS specifies that the file object must be opened in binary rather than text mode. For the Selenium workflow above, upload_file is the straightforward fit because Selenium saves a local file.

Best Value
Sale
UnionSine 500GB Ultra Slim Portable External Hard Drive HDD-USB 3.0 | for PC, Mac, Laptop, PS4, Xbox one, Xbox 360-(Black)
  • [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
  • 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
  • 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
  • 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
  • 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot failed captures and uploads

  • Selenium returns False or cannot write the file: This is a local filesystem problem, not an S3 error. Create the parent directory, check the path and filesystem permissions, and retain the .png extension before attempting upload.
  • Boto3 reports missing or invalid credentials: Check the credential provider available to the process and the role or profile attached to its runtime. Do not fix this by hard-coding long-lived credentials.
  • The bucket is not found or the request fails with a region mismatch: Verify the bucket’s actual region, then configure region_name to match it. The runner’s Indian location is not a substitute for checking the bucket.
  • The upload is denied: Review the identity permissions and bucket policy for the specific bucket and key prefix. Also check any encryption requirements; the correct policy depends on those settings.
  • The upload fails intermittently or times out: Distinguish network or service errors from local capture failures. Catch and report AWS exceptions with the bucket, key, and run identifier as context, while excluding secrets and image contents. Retry behavior should be designed for your runner and test pipeline rather than assumed from a successful local screenshot.
  • A later test cannot find an earlier artifact: Check the exact bucket, region, and key. If runs reuse a key, a later upload may replace the object at that location.

Or skip the browser setup

If you need a screenshot without configuring Selenium and an AWS upload path, ScreenshotNeo is a website screenshot API and MCP server. A single GET request can return an image or PDF; its API documentation is at ScreenshotNeo docs.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers indicate 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.

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

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

Frequently Asked Questions

Does this upload make the S3 screenshot publicly accessible?

No. The workflow uploads an object to S3; it does not configure public access or website hosting.

Can I use Hyderabad instead of Mumbai?

Yes, if the destination bucket is in Hyderabad, configure the client with ap-south-2. Use the bucket’s actual region.

Quick Recap

Bestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$213.60
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$189.99

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. 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
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.