Use a Selenium explicit wait for the state your screenshot needs, then capture the element returned by that wait. For a visible, cropped element in Python, call WebDriverWait(...).until(EC.visibility_of_element_located(...)) and then element.screenshot("target.png"). If you want the whole browser viewport, use a driver-level screenshot instead.
Wait for the state the screenshot needs
A page reaching its load-complete state does not guarantee that JavaScript has inserted or updated the content you want. Selenium navigation waits for a readyState determined by the page-load strategy; the default is complete, but client-side updates may still be pending. An explicit wait checks a condition tied to the target instead of assuming a fixed delay is enough. See Selenium’s Waiting Strategies.
Choose a condition based on what the screenshot must contain:
- Presence: the element can be found in the DOM. Use this when its existence is sufficient, even if it is not displayed yet.
- Visibility: the element is present and displayed. This is usually the better choice for an image intended to show the element.
- Application-specific readiness: wait for expected text or a state marker when the page exposes a more meaningful signal that rendering or loading has finished.
Selenium’s expected conditions include checks for existence, staleness, visibility, visible text, and title matching. The right condition depends on the application and desired image; visibility alone does not prove that every animation or asynchronous change inside the element has finished. See Expected Conditions.
#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.
Capture just the target element in Python
This example waits up to 10 seconds for a visible element identified by CSS selector, then saves a PNG of that element:
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
locator = (By.CSS_SELECTOR, "#target")
element = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located(locator)
)
element.screenshot("target.png")
The example assumes that driver is an already configured Selenium WebDriver session and that the page has been opened. The locator and 10-second timeout are examples: use a selector that uniquely identifies the intended element and a timeout suited to the application and test environment. The wait returns the matched element, so it can be used directly for the screenshot. See the Python WebDriverWait API and Python WebElement API.
Wait for presence instead
If you only need to know that the node exists in the DOM, use presence_of_element_located. It can return an element that is not yet displayed, so it is not a substitute for visibility when the screenshot needs to show the target.
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.
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located(locator)
)
For content whose readiness is expressed by text, wait for that expected text rather than taking a screenshot immediately after locating the container:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchelement = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located(locator)
)
WebDriverWait(driver, 10).until(
EC.text_to_be_present_in_element(locator, "Ready")
)
element.screenshot("target.png")
Choose an element screenshot or a viewport screenshot
| Desired image | Method | What it captures |
|---|---|---|
| Target only | element.screenshot("target.png") |
The current element, saved as PNG. |
| Whole browser viewport | driver.save_screenshot("viewport.png") |
The current browser viewport, rather than a crop of the element. |
For a viewport image after waiting for the target, keep the wait and change the capture call:
element = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located(locator)
)
driver.save_screenshot("viewport.png")
The element screenshot API also provides PNG bytes and a base64 representation when you need the image in memory instead of saved directly to a file; consult the Python WebElement API.
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.
Use explicit waits instead of fixed sleeps
A fixed sleep pauses for a preset duration whether the target is ready or not. An explicit wait polls for the selected condition and proceeds as soon as it becomes truthy; if it never does before the timeout, Selenium raises TimeoutException. Python WebDriverWait uses a 0.5-second polling interval by default and ignores NoSuchElementException by default while checking. Its until method returns the condition’s truthy result. These are API defaults, not a recommendation that every application should use the same timeout; see the Python WebDriverWait API.
Do not mix implicit and explicit waits. Selenium warns that combining them can produce unpredictable wait durations. Configure the test to use the explicit wait for the target state rather than layering an implicit wait on top; Selenium states, “Do not mix implicit and explicit waits.” See Waiting Strategies.
Troubleshoot screenshot waits
The wait times out
- Check that the selector matches the element on the current page and in the active browsing context.
- Confirm that the page has navigated to the expected URL and that the element is not inside a frame you have not switched into.
- If the element exists but remains hidden, presence may succeed while visibility does not. Decide whether the screenshot should wait for display or whether a different ready condition is appropriate.
- Set a timeout that fits the application and test environment. A timeout indicates that the condition did not become true within the allotted time; increasing it will not fix an incorrect selector or a state that never occurs.
The screenshot is blank or shows stale content
- Waiting for page navigation or
readyStatealone does not ensure JavaScript-driven content is ready. Wait for the target or an application-specific text or state marker. - If the target is replaced during rendering, wait for the replacement element or its final state before capturing rather than retaining an earlier reference.
- If the element is visible but its contents are still loading, visibility is too weak a condition. Wait for a meaningful completion signal exposed by the page.
The image contains more or less than expected
Use element.screenshot(...) for the element crop and driver.save_screenshot(...) for the viewport. They produce different outputs; changing the wait condition will not change the capture area.
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
Or skip the browser setup
For a screenshot without setting up a Selenium browser session, ScreenshotNeo offers a screenshot API and MCP server. Its request captures a URL; it is not a Selenium wait for an arbitrary element or a replacement for application-specific readiness logic.
For API parameters and response details, see the ScreenshotNeo 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 removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, and failed loads are not billed, and responses identify the page verdict and billing status. Its MCP server provides screenshot tools 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 1,000 free screenshots a month, with no card required.
Best 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.
Frequently Asked Questions
Does `element.screenshot()` save the image as a PNG?
Yes. Python’s Selenium `WebElement.screenshot(filename)` saves a PNG screenshot of the current element.
Does `WebDriverWait` return the element or just confirm the condition?
It returns the truthy value from the condition, so an element-location condition returns the matched `WebElement`.
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.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.

