To capture screenshots with Selenium on an AWS Lightsail server in India, launch an Ubuntu instance in Mumbai (ap-south-1), install Chrome and Selenium, run Chrome with --headless=new, then save the page screenshot from your script. Selenium Manager can obtain a compatible ChromeDriver for common setups; if you manage the driver yourself, match its major version to Chrome. You do not need Xvfb just to run Chrome headlessly.
1. Create an Ubuntu Lightsail instance in Mumbai
- In the Lightsail console, create a Linux/Unix instance and select the Asia Pacific (Mumbai) Region,
ap-south-1. Choose an Ubuntu image and an instance size that suits the workload. - Connect to the instance using Lightsail’s browser-based SSH or your SSH client. AWS’s Lightsail instance guide covers instance creation, Region selection, and SSH access. AWS also documents launch scripts; on Ubuntu and Debian images, the package manager is
apt-get. - Update the package lists and install basic tools:
sudo apt-get update
sudo apt-get install -y curl gnupg ca-certificates
A Mumbai instance is an available India deployment option, not a guarantee of low latency to every target website. The target site’s location and network behavior also affect navigation and capture time. Lightsail instances launch in one Availability Zone within the selected Region. See the AWS Regions and Availability Zones page for the available Regions.
As an Amazon Associate I earn from qualifying purchases.
2. Install Chrome and Selenium
Install Google Chrome
Chrome’s Linux package source and installation instructions can change. Use Google’s current official Linux installation guidance for the Ubuntu release you selected, then confirm that the browser is available:
google-chrome --version
Do not copy old instructions that assume Chrome’s legacy Headless implementation. Chrome documents that its unified Headless mode uses the regular Chrome browser code; since Chrome 132, the older Headless implementation is distributed separately as chrome-headless-shell. Review Chrome’s Headless documentation if your packaging or command-line behavior differs.
#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
Install Python and Selenium
This example uses Python 3 and a virtual environment so its Selenium dependency is isolated from system packages:
sudo apt-get install -y python3 python3-venv
mkdir -p ~/selenium-shot && cd ~/selenium-shot
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip selenium
Modern Selenium includes Selenium Manager, which can obtain a suitable driver in common supported setups. Selenium’s troubleshooting guidance says Selenium Manager can download the correct driver starting with Selenium 4.6. The first run may need outbound network access to resolve or download the driver. Check the installed package version with python -c 'import selenium; print(selenium.__version__)'. See Selenium Manager documentation.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errors3. Save a screenshot with headless Chrome
Create capture.py with the following runnable example. It accepts a URL and output path, sets a predictable viewport, waits for the document to finish loading, captures the viewport, and closes Chrome even if navigation or capture fails.
cat > capture.py <<'PY'
import sys
from pathlib import Path
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
if len(sys.argv) < 2:
raise SystemExit("Usage: python capture.py URL [output.png]")
url = sys.argv[1]
output = Path(sys.argv[2] if len(sys.argv) > 2 else "screenshot.png")
options = Options()
options.add_argument("--headless=new")
options.add_argument("--window-size=1440,1000")
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Rank #2
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
driver = webdriver.Chrome(options=options)
try:
driver.set_page_load_timeout(60)
driver.get(url)
output.parent.mkdir(parents=True, exist_ok=True)
driver.save_screenshot(str(output))
print(f"Saved {output}")
finally:
driver.quit()
PY
. .venv/bin/activate
python capture.py https://example.com screenshot.png
The Selenium Chrome documentation lists --headless=new as a commonly used option. Headless mode runs without a visible UI; no desktop session or Xvfb is inherently required. Consult Selenium’s Chrome WebDriver guide for browser options and driver setup.
Choose the right readiness condition
The example waits for the browser’s normal page-load event, which is a useful baseline but not a universal guarantee that a modern page’s late-loading content is ready. If the target page renders the needed element asynchronously, wait for that element explicitly before saving the screenshot. If a site never reaches a full load because it keeps connections open, a page-load timeout may fire even though the visible content is usable; for that case, use an explicit wait for the specific element or state you need rather than assuming one wait strategy fits every site.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 20).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "main"))
)
Use a selector that actually identifies the content whose appearance matters. Selenium’s documentation does not establish one universal wait duration or screenshot dimension: tune those for the page and your use case.
4. Manage ChromeDriver compatibility
With Selenium Manager, start without a manually installed driver and let Selenium resolve it for a supported setup. If you pin or install ChromeDriver yourself, check the actual Chrome and ChromeDriver versions and keep their major versions aligned. Selenium describes its Chrome support broadly as Chrome v75 and greater, but that is not a guarantee that every current Chrome release works with every Selenium package. Record the versions used when you need reproducible captures.
Rank #3
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Check Chrome’s version with google-chrome --version. If ChromeDriver is installed, check it with chromedriver --version. Selenium’s guidance is at driver location and troubleshooting. For explicit driver management, put the binary on PATH or configure its location through Selenium’s supported driver service options.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
5. Run captures reliably and safely
- Allow outbound access. The worker must reach the target pages; Selenium Manager may also need outbound connectivity when resolving a driver.
- Keep inbound access narrow. In Lightsail’s networking/firewall settings, restrict SSH to trusted source IP addresses when possible. IPv4 and IPv6 rules are configured independently, and the public-IP firewall controls inbound internet traffic. A base Ubuntu instance’s default inbound rules include SSH, HTTP, and all-address sources, so review them rather than leaving administrative access open. Do not expose a public WebDriver port unless remote WebDriver access is an explicit requirement and separately protected. See Lightsail firewall and port mapping documentation.
- Plan for address changes. Without a static IP, an instance’s public IP can change after stop and restart. Attach a static IP if you need a stable address.
- Use snapshots with care. Lightsail snapshots are point-in-time copies useful for recovery or creating another instance, and snapshot storage incurs charges. A restored snapshot also restores its older software state, so apply security and software updates after recovery. See static IP documentation and instance snapshot documentation.
- Watch resource use and page behavior. Browser startup, JavaScript-heavy pages, and slow target servers affect capture time and memory use. Start with one browser session at a time on a small instance; increase concurrency only after observing actual resource use. This is an operational recommendation, not a benchmark.
6. Troubleshoot common failures
| Symptom | Likely cause | What to check or change |
|---|---|---|
Unable to locate driver or driver startup failure |
Driver is missing, not on PATH, or incompatible with Chrome; Selenium Manager may also be unable to reach its download source. |
Check Chrome’s version, allow the required outbound access, use a current Selenium package with Selenium Manager, or install a compatible ChromeDriver and make its path explicit. |
| Chrome exits immediately or reports it cannot start | Browser installation, runtime dependencies, or launch configuration is incomplete. | Verify google-chrome --version, run the script as the intended user, inspect Selenium’s exception output, and confirm the selected Chrome package supports the Ubuntu image. |
| Navigation times out | The destination is slow, unreachable from the instance, or keeps the page-load event open. | Check outbound connectivity and the URL, set a suitable page-load timeout, and wait for a specific content element when full page load is not the right readiness condition. |
| Screenshot is blank or misses content | The page has not rendered the relevant content yet, or it appears below the initial viewport. | Wait for a meaningful selector or page state before capture. The example captures the viewport; ensure the desired content is in that viewport, or use Selenium’s supported full-page strategy only if your requirements and browser behavior call for it. |
| SSH stops working after a restart | The public IP changed, or firewall rules do not allow the current source address. | Check the instance’s current IP and independent IPv4/IPv6 firewall rules; use a static IP when a stable public address is required. |
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request can return a PNG, JPEG, WebP, or PDF; see the API documentation.
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 or consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up free for 1,000 screenshots a month with no card.
Frequently Asked Questions
Can I use another Lightsail Region instead of Mumbai?
Yes. Choose another available Region if it better fits the target site’s network path or your operational needs; the Mumbai option specifically establishes an India-based deployment location, not universal low latency.
Does Selenium’s screenshot method save a full webpage automatically?
The example saves the current viewport. A full-page capture needs an approach that handles the page’s dimensions and browser behavior; viewport capture and full-page capture are different requirements.
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.




