Use an explicit wait for the exact page state your screenshot needs, then capture the current window. Selenium’s default navigation waits for the document’s readyState to reach complete, but JavaScript applications can continue fetching and replacing content afterward. A reliable screenshot therefore waits for a page-specific signal—such as a visible result panel, a loading indicator disappearing, or an image reporting that it has decoded—rather than relying on driver.get() or an arbitrary sleep.
The reliable sequence
A screenshot workflow should have four distinct stages:
- Navigate to the URL or perform the interaction that changes the page.
- Wait for the condition that proves the required content is ready.
- Optionally verify images, fonts, or other visual dependencies.
- Capture the current browser window.
In Python, an explicit wait polls a condition until it becomes true or the timeout expires. The timeout is an upper bound, not a promise that the page will be ready at that exact moment.
Basic Python example
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
url = "https://example.com/dashboard"
driver = webdriver.Chrome()
try:
driver.get(url)
# Replace this selector with a stable marker on your page.
WebDriverWait(driver, 15).until(
EC.visibility_of_element_located(
(By.CSS_SELECTOR, "main .page-ready-marker")
)
)
driver.save_screenshot("page.png")
finally:
driver.quit()
The selector and 15-second value are illustrative. Choose a marker that represents the state you actually want to preserve in the image.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#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.
Why driver.get() is not enough
With Selenium’s normal page-load strategy, navigation generally waits for the browser’s complete readiness state and the resources covered by that navigation. That state means the document reached a browser lifecycle milestone; it does not mean a single-page application has finished rendering its data, animations, charts, or user-specific widgets.
A client-side application can reach complete, issue an API request, and replace a loading skeleton several seconds later. A screenshot taken immediately after get() can therefore contain an empty panel or placeholder even though navigation succeeded.
Navigation caused by clicking a link or submitting a form also needs its own synchronization. Treat the action and the resulting state as separate steps: perform the click, then wait for the new page marker, changed title, or result element.
Choose the right Selenium wait
Explicit waits (the usual choice)
An explicit wait is local to one operation and expresses the condition required by that screenshot. Selenium repeatedly evaluates the condition until it succeeds or the timeout is reached. Useful built-in conditions include:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsvisibility_of_element_locatedwhen the target must be present and visible.presence_of_element_locatedwhen existence is enough, even if the element is not visible yet.element_to_be_clickablebefore an interaction that triggers the state you will capture.invisibility_of_element_locatedwhen a spinner or loading overlay must disappear.title_containsortitle_iswhen navigation changes the document title.
Prefer the narrowest condition that corresponds to the visual result. Waiting for a header that appears on every page does not prove that a report table or chart has loaded.
Custom conditions
For application-specific states, pass a callable that receives the driver and returns a truthy value. This example waits for a result panel whose text is non-empty:
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.
from selenium.webdriver.support.ui import WebDriverWait
class ResultHasText:
def __init__(self, locator):
self.locator = locator
def __call__(self, driver):
element = driver.find_element(*self.locator)
text = element.text.strip()
return element if element.is_displayed() and text else False
wait = WebDriverWait(driver, 20)
wait.until(ResultHasText((By.CSS_SELECTOR, "#results")))
driver.save_screenshot("results.png")
A JavaScript condition can inspect application state exposed on the page, but keep it tied to a meaningful state transition rather than merely returning that a script executed.
Implicit waits
An implicit wait changes how every element lookup behaves for the lifetime of the driver. It can help with consistently delayed DOM insertion, but it does not express that a page is visually ready. Selenium warns that combining implicit and explicit waits can make total wait times unpredictable. For screenshot synchronization, use a short or zero implicit wait and explicit waits for the important states.
Fixed sleeps
time.sleep() is a timing workaround, not a readiness test. A delay that works on a fast run may be too short on a slow network, while a conservative delay wastes time on fast runs. Use one only when the application exposes no observable signal, document why it is necessary, and expect occasional flakiness.
Waiting for images and other visual assets
Element visibility alone may not mean an image is decoded. A visible img can still have zero intrinsic dimensions while its request is pending or failed. Use a custom condition for the specific image:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
def image_is_loaded(locator):
def check(driver):
image = driver.find_element(*locator)
return driver.execute_script(
"return arguments[0].complete && arguments[0].naturalWidth > 0;",
image,
)
return check
WebDriverWait(driver, 20).until(
image_is_loaded((By.CSS_SELECTOR, "img.hero"))
)
driver.save_screenshot("hero.png")
This checks the target image’s browser state. It does not guarantee that every image on a long page has loaded, so repeat the check for required assets or wait on a page-level “loaded” marker implemented by the application.
Page-load strategies and when to use them
Selenium’s page-load strategy is configured for the session. It controls when URL navigation returns; it does not replace an application-specific wait.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #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.
| Strategy | Navigation waits until | Screenshot implication |
|---|---|---|
normal (default) |
complete and the resources covered by the page-load behavior |
Most conservative navigation, but dynamic content can still change afterward. |
eager |
interactive |
Returns sooner; images and other resources may still be loading, so explicit waits are essential. |
none |
No document-readiness blocking | Useful only when your code supplies all synchronization; an immediate screenshot is likely incomplete. |
For a screenshot job, keep normal unless you have a reason to optimize navigation and a robust explicit wait after every navigation. The strategy does not apply identically to content changes caused by clicks or form submissions.
Configuring a strategy in Python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.page_load_strategy = "eager" # "normal", "eager", or "none"
driver = webdriver.Chrome(options=options)
With eager or none, treat driver.get() as the start of synchronization, not the end.
Navigation timeouts versus readiness waits
set_page_load_timeout limits how long WebDriver will block while navigating. It protects the job from a server or resource that never finishes, but it does not describe when your report, chart, or application state is ready.
driver.set_page_load_timeout(45)
try:
driver.get("https://example.com/report")
except Exception as exc:
# Log the URL and exception; decide whether to retry or mark the job failed.
print(f"Navigation failed: {exc}")
WebDriverWait(driver, 20).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "#report-table"))
)
driver.save_screenshot("report.png")
Use separate budgets: one for navigation and another for the application condition. A navigation timeout should not be “fixed” by adding a longer sleep afterward.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Waiting after clicks, forms, and route changes
After an interaction, wait for evidence of the new state. A robust pattern waits for the old marker to disappear and the new marker to appear, or waits for a known value to change.
submit = driver.find_element(By.CSS_SELECTOR, "button[type='submit']")
old_marker = driver.find_element(By.CSS_SELECTOR, ".loading")
submit.click()
wait = WebDriverWait(driver, 20)
wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, ".loading")))
wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, ".results-grid")))
driver.save_screenshot("search-results.png")
If the click opens a new window or tab, switch to it before waiting. If it changes an iframe, switch into the frame before locating its content. A correct condition in the wrong browsing context will time out.
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
Full example with cleanup and diagnostics
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
URL = "https://example.com/app"
READY = (By.CSS_SELECTOR, "[data-testid='dashboard-ready']")
driver = webdriver.Chrome()
driver.set_page_load_timeout(45)
try:
driver.get(URL)
wait = WebDriverWait(driver, 20)
wait.until(EC.visibility_of_element_located(READY))
wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, ".spinner")))
driver.save_screenshot("dashboard.png")
except TimeoutException:
# Preserve evidence of the failed state for debugging.
driver.save_screenshot("dashboard-timeout.png")
raise
finally:
driver.quit()
Saving a diagnostic image on timeout helps distinguish a bad selector from a server error, authentication redirect, consent overlay, or genuinely slow application.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common failures and fixes
The screenshot shows a spinner or skeleton
Cause: the wait targets a shell element that appears before data arrives. Fix: wait for the result container to be visible and populated, or wait for the spinner to become invisible.
Recommended Free Tools
TimeoutException despite seeing the content manually
Causes: a selector changed, the content is inside an iframe, a login redirect occurred, or the test viewport triggers a different layout. Fix: save the timeout screenshot and current URL, inspect the DOM, switch to the correct frame or window, and use a stable attribute such as data-testid.
Images are blank or partially rendered
Cause: the containing element is visible before image decoding, lazy loading has not been triggered, or the image request failed. Fix: wait for complete and nonzero naturalWidth, scroll the lazy-loaded region into view, and treat a failed request as an application error rather than extending a sleep.
The page times out during navigation
Cause: a server, third-party resource, or redirect never completes. Fix: set a suitable page-load timeout, capture logs and the final URL, and decide whether a retry is safe. Do not assume a longer readiness wait can repair a failed navigation.
Waits take far longer than the configured value
Cause: implicit and explicit waits are interacting, or each poll performs multiple lookups. Fix: avoid mixing wait types, keep the condition small, and use one explicit timeout for the state.
Crashes, 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 minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Best 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.
Performance and reliability practices
- Use stable, page-specific selectors instead of brittle XPath tied to layout.
- Wait for the smallest state that proves the screenshot is correct; waiting for every network request can delay indefinitely because of analytics or streaming connections.
- Use a consistent viewport, browser version, timezone, and locale when pixel-level comparisons matter.
- Capture after animations settle when motion changes the target. If the application offers a reduced-motion mode, enable it rather than guessing with a delay.
- Keep navigation and readiness timeouts separate and log both durations.
- Retry only transient navigation failures. Retrying a selector that no longer exists will hide a real application change.
- Always call
quit()in afinallyblock so failed screenshot jobs do not leak browser processes.
Or skip the browser setup
If your requirement is simply a clean website image or PDF, ScreenshotNeo provides a one-call alternative. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers.
See the complete parameter reference in the ScreenshotNeo documentation. A GET request returns PNG, JPEG, WebP, or PDF:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
It also supports waits for a selector, delay, or network idle; full-page and CSS-element capture; lazy-image loading; custom JavaScript and CSS; clicks; hidden selectors; headers, cookies, user agents and authorization; device presets, viewport and retina scale; dark mode; blocking rules; timezone and geolocation; transparent backgrounds; resizing; cache TTLs; signed image links; asynchronous webhooks; bulk capture of up to 100 URLs per call; PDF options; usage reporting; and an OpenAPI specification. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
The Free plan includes 1,000 shots each month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to try it without a card.
FAQ
Should I wait for document.readyState == "complete"?
Only when the screenshot requirement is specifically the browser’s complete readiness state. It is not a universal signal that a dynamic application has finished rendering.
Can Selenium’s screenshot method wait for rendering?
No. save_screenshot() captures the current window. Synchronization must happen before the method call.
What timeout should I choose?
There is no universal value. Set it from the slowest acceptable response for the page, then use a condition that fails clearly when the application never reaches the required state.
Frequently Asked Questions
Can I use a screenshot wait for an SPA route change?
Yes. After the route-changing action, wait for a route-specific marker, changed title, or populated result element rather than waiting only for navigation.
Is a visible element always ready for a screenshot?
No. Images may still be decoding and animations may still be running; add conditions for those visual dependencies when they affect the target.
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.

