Use Selenium’s Python WebDriver to open a page, wait for the content you need, and save the current browser window as a PNG with driver.save_screenshot("screenshot.png"). For a report focused on one component, capture that element instead. The key to a repeatable result is to record the browser and viewport and wait for a meaningful page condition—not an arbitrary pause.
Capture a website screenshot with Selenium in Python
This example saves a PNG of the current browser window after a visible page heading appears. Replace the example URL and readiness condition with the page and content relevant to your project.
from pathlib import Path
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
output_dir = Path("screenshots")
output_dir.mkdir(exist_ok=True)
driver = webdriver.Chrome()
try:
driver.set_window_size(1280, 900)
driver.get("https://example.com")
WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.TAG_NAME, "h1"))
)
saved = driver.save_screenshot(str(output_dir / "example-page.png"))
if not saved:
raise OSError("Selenium could not save the screenshot")
finally:
driver.quit()
The example follows Selenium’s Python setup and expected-condition patterns. Selenium’s first-script guide demonstrates starting a browser, navigating with get, and quitting; its expected conditions documentation describes visibility checks.
What the code does
- Creates a
screenshotsfolder if it does not already exist. - Starts Chrome and sets the browser window to 1280 by 900 pixels.
- Opens the target URL and waits up to 10 seconds for a visible
h1. - Saves the current window view to
screenshots/example-page.png. - Quits the browser in
finally, including when navigation or capture raises an error.
save_screenshot(path) saves a PNG and returns a boolean indicating whether saving succeeded. Use a filename ending in .png. See the Selenium Python WebDriver API.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Choose between a window screenshot and an element screenshot
| Method | What it captures | Useful when |
|---|---|---|
driver.save_screenshot("page.png") |
The current browser window view | The report needs the page in context, including surrounding content. |
element.screenshot("element.png") |
The selected element | The report needs a particular chart, panel, button, or other component without surrounding page content. |
For element capture, locate the element using an appropriate locator and call its screenshot method:
element = driver.find_element(By.CSS_SELECTOR, "main .result-panel")
element.screenshot("screenshots/result-panel.png")
Change the CSS selector to match the page. Selenium documents both window and element screenshot examples.
Wait for the page state that belongs in the report
A page can open before its content has finished rendering. Pick a condition tied to what the screenshot must show—for example, a heading becoming visible, a result panel appearing, or a loading indicator disappearing. Selenium’s documentation calls synchronization with browser state a major challenge and provides explicit waits and expected conditions to handle it.
Rank #2
- CanaKit Raspberry Pi 5 Essentials Starter Kit
- Use an explicit wait such as
WebDriverWaitwith a condition that reflects the required content. - Avoid relying on a fixed sleep when a page condition can be checked directly.
- Do not mix implicit and explicit waits; Selenium’s waiting-strategies guide warns that combining them can lead to unpredictable wait durations.
The sample waits for an h1, but that is only suitable if the heading indicates the state you need. A heading appearing does not necessarily mean every image, animation, or asynchronous section is finished.
Make the capture reproducible for a college project
For a meaningful comparison or appendix, keep the capture conditions consistent and document them. WebDriver provides window sizing controls because screen resolution can affect how a site renders. See Selenium’s window management documentation.
- Record the target URL and capture date.
- Record Python and Selenium versions, browser and browser version, and operating system when relevant.
- State the browser window dimensions and use the same dimensions for comparable runs.
- Describe the page-ready condition, such as “waited until the result panel was visible.”
- Use descriptive filenames such as
home-desktop-1280x900.png. - Keep original files. If you crop or annotate an image, label the edit and retain the unmodified capture.
- Use a caption that identifies what the image shows, the target page, and the viewport.
Consistent settings improve repeatability, but they do not guarantee pixel-identical images across different browsers, operating systems, fonts, or page states.
Rank #3
- Pi5 8GB Pack: RasTech Pi 5 8GB kit includes 1 x Pi5 8GB board ,1 x 64GB Card, 2 x Card Readers,1 x Active Cooler,1 x Case for Pi5, 2 x 4K Micro HD Out Cable,1 x GaN 27W 5A USB-C Power supply,1 x Screwdriver and 1 x instructions.
- Pi5 8GB Board: The Pi5 board is equipped with a 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz and an 800MHz VideoCore VII GPU with support for OpenGL ES 3.1 and Vulkan 1.2, which delivers a significant increase in graphics performance. Dual HD Out 4Kp60 display outputs and a built-in dual 4-channel MIPI camera/display transceiver provide state-of-the-art camera support. The Pi 5 offers a 2-3 times increase in CPU performance compare to Pi4.
- Important Graphics Features: Equipped with an 800MHz VideoCore VII GPU and providing better graphics performance, suitable for multimedia applications,gaming,and graphics intensive tasks.Provides 1 UART interface,1 card slot that supports high-speed operation, 2 USB. 3 0.5 ports that support synchronous 0Gbps operation,2 USB 2.0 port ports,2 4Kp60 display outputs that support HDR.Built-in dedicated dual 4-channel 1Gbps MIPI DSI/CSI connectors,triple the total bandwidth.
- Cooling Kit for Pi 5: Compatible with Active Cooler for Raspberry Pi5, It can provide Pi 5 board with better cooling effect in using. The Case can accurately access usb-c power jack,Micro HD Out ports, usb ports, Ethernet jack, card slot, power button, 4-lane MIPI DSI/CSI connectors and so on, and it also supports installation of cooling fan.
- 64GB Card Kit and GaN 27W USB-C Power Supply: With extra 64GB card to store more files and card readers for multiple medium, keep better performance for Raspberry Pi 5, 27W USB C Power Supply is Compatible with Pi5 8GB, offers a variety of output voltage options, including 5.1V at 5A, 9.0V at 3.0A, 12.0V at 2.25A, and 15.0V at 1.8A, providing for different device requirements.
Know what the screenshot includes
The basic WebDriver screenshot methods capture the current window or the selected element. Do not describe driver.save_screenshot as a full-page capture of the entire scrollable document. If the assignment calls for a full-page image, use a separate browser-specific or image-stitching approach and verify its output before presenting it as full-page evidence.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server for developers. A GET request can return an image or PDF; for a basic capture, use this cURL request. See the ScreenshotNeo documentation for API parameters and other formats.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo removes known cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.
Rank #4
- A RASPBERRY PI 5 KIT FROM AN APPROVED RESELLER: This Vilros Complete Starter Kit for Pi 5 Includes Raspberry Pi 5 Board with all the accessories you need to get started.
- 9 PART KIT INCLUDES MOST ACCESSORIES NEEDED YOU TO GET UP AND RUNNING: 1. Raspberry Pi 5 Board–2.Metal/Aluminum Alloy Passive & Active Cooling Case–3.Raspberry Pi 5 Compatible Power Supply–4. PWM fan With 10k Max RPM Capacity (pre-installed in the case)--5. 32GB Micro SD Card With 64bit Raspberry Pi OS Preinstalled–6. Standard HDMI to Micro HDMI Adapter Cable--7.Neoprene Storage bag–8.Vilros Quickstart Guide for Raspberry Pi–9. Mini To Standard Camera Module Adapter Cable to use a camera module with a PI 5
- RASPBERRY PI 5 SPECS AND FEATURES:--Processor: Broadcom BCM2712 2.4GHz quad-core 64-bit Arm Cortex-A76 CPU, with cryptography extensions, 512KB per-core L2 caches, and a 2MB shared L3 cache----Features: 2.4GHz quad-core, 64-bit Arm Cortex-A76 CPU–VideoCore VII GPU supporting Vulkan 1.2 and OpenGL ES–LPDDR4X-4267 SDRAM (4GB and 8GB options)--PCIe 2.0 x1 interface for fast peripherals ( Requires adapter)--Dual-band 802.11ac Wi-Fi 2.4 GHz and 5.0 GHz –Bluetooth 5.0 / Bluetooth Low Energy (BLE)
- MULTIFUNCTION PASSIVE & ACTIVE COOLED CASE: The case features a built-in pole/column that contacts the main chip on the Raspberry Pi 5 board via an included thermal pad to passively cool the board and also includes a preinstalled PWM Fan that plugs directly into the fan port on the board. The fan will only turn on if needed and will also increase RPMs as needed. Other features include a built-in power button that shows the onboard light status, camera module compatibility, and can be used in the single-layer configuration for hat compatibility
- HIGH-QUALITY COMPONENTS: All components are manufactured with Raspberry Pi in mind and are backed by the Vilros 1-Year warranty.
Troubleshoot common problems
Chrome does not start
The failure may happen before Selenium reaches the screenshot call. Check that Selenium is installed and follow the current browser and driver setup instructions for your operating system and environment. The example cannot establish which browser, driver, or package versions are installed on your machine.
The screenshot is blank or misses content
Check whether the target URL loaded and whether the selected wait condition matches the content that should appear. If the page is dynamic, wait for the relevant element or state rather than capturing immediately after navigation.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
The output file is missing
Confirm that the output directory exists, the process can write to it, and the path ends with .png. Check the boolean returned by save_screenshot; the example raises an error if Selenium reports that saving failed.
Best Value
- Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
The image shows only part of the page
The standard window screenshot is not a promise of a full scrollable-page image. Use element capture for a component, or a separate verified full-page method if the assignment requires the whole document.
Waits take unexpectedly long
Review your explicit wait condition and timeout. If you configured implicit waits elsewhere, avoid combining them with explicit waits because Selenium warns that mixed waits can produce unpredictable durations.
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.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →




