To capture a page with EdgeDriver in headless mode, start a Selenium 4 Edge session with the documented --headless=new browser argument, navigate to the page, wait for the content you need, and save a screenshot through Selenium’s screenshot API. Edge, Edge WebDriver, and Selenium are separate components; installing one does not install the others.
What you need before capturing a screenshot
EdgeDriver is the WebDriver implementation that controls Microsoft Edge. Selenium is the language framework used to send commands to the driver, and Edge is the browser being automated. Install all three components: Microsoft Edge, a compatible Microsoft Edge WebDriver, and Selenium for your chosen language. For Selenium automation of Edge, use Selenium 4; Microsoft marks Selenium 3 as unsupported for this purpose.
- Browser: Microsoft Edge installed on the machine where the script runs.
- Driver: Microsoft Edge WebDriver available to Selenium. Keep its version compatible with the installed Edge browser.
- Framework: Selenium 4 and its language binding.
Headless mode does not mean Edge is absent. A browser session still runs and responds to WebDriver commands; the difference is that it does not display a normal browser window. The documented Edge argument is --headless=new, added to an Edge options object before creating the driver session.
Capture a headless screenshot with Selenium and Python
This example creates a headless Edge session, opens a page, waits for the document’s load event, and saves a viewport screenshot to edge-shot.png. Install Selenium 4 in the same Python environment that runs the script with python -m pip install -U selenium.
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.
from pathlib import Path
from selenium import webdriver
from selenium.webdriver.edge.options import Options
from selenium.webdriver.support.ui import WebDriverWait
url = "https://example.com"
output = Path("edge-shot.png")
options = Options()
options.add_argument("--headless=new")
driver = webdriver.Edge(options=options)
try:
driver.set_window_size(1440, 1000)
driver.get(url)
# Wait for the document load event, up to 30 seconds.
WebDriverWait(driver, 30).until(
lambda d: d.execute_script("return document.readyState") == "complete"
)
saved = driver.save_screenshot(str(output))
if not saved:
raise RuntimeError(f"Selenium did not save the screenshot to {output}")
print(f"Saved screenshot to {output.resolve()}")
finally:
driver.quit()
The Selenium Python binding’s save_screenshot method writes the screenshot to the path you pass and returns whether the save succeeded. The example uses it for the viewport visible at the chosen window size, not as a guarantee of a full-page image. The Microsoft Edge setup documentation establishes the session configuration; screenshot method names and file handling are specific to the Selenium binding you install, so check that binding’s API documentation if you use a different language or version.
Why set the window size?
A screenshot reflects the browser viewport, and responsive sites can render different layouts at different widths. Set the window size before navigation or before the final wait so the page has a chance to lay itself out at the intended dimensions. Choose a width and height that match the use case; the example’s 1440 by 1000 pixels is only a sample, not a required Edge setting.
Why wait after navigation?
driver.get() navigates to the page, but a completed document load does not necessarily mean every image, asynchronous request, animation, or client-rendered component is ready. The example waits for document.readyState to equal complete, which is a useful baseline for ordinary pages. If the screenshot must include a particular component, wait for that element explicitly with Selenium’s wait conditions rather than relying only on the document state.
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.
Wait for the page state your capture actually needs
Pick a readiness condition that matches what should appear in the image. A fixed sleep is easy to add but can waste time on fast pages and still be too short on slow ones. A condition-based wait ends once the relevant state is reached or the timeout expires.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Wait for a specific element
For a page with a known target, wait for its selector to become visible. Replace #report with a selector from the page.
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 30).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "#report"))
)
Wait for a changing page
For a dashboard or client-rendered page, the initial document can be complete while its data is still loading. Wait for a stable, meaningful signal: a results container, a “loaded” state, or the disappearance of a loading indicator. If you control the page, exposing a clear ready marker is more reliable than guessing a delay.
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.
Lazy-loaded images and long pages
Scrolling can trigger lazy-loaded content, but a single viewport screenshot will still show only the current viewport. If you need content below the fold, scroll through the page and wait for the relevant content to load, then determine whether your binding and browser support the full-page capture behavior you need. Do not assume that a viewport screenshot automatically includes the entire document.
Other Selenium language bindings
The Edge startup pattern is the same across Selenium bindings: create Edge options, add --headless=new, and pass those options when constructing the driver. The exact screenshot method and output handling depend on the binding.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteC# setup
var options = new EdgeOptions();
options.AddArgument("--headless=new");
var driver = new EdgeDriver(options);
try
{
driver.Navigate().GoToUrl("https://example.com");
// Wait for the page state your capture requires, then use
// the Selenium .NET screenshot API for your installed version.
}
finally
{
driver.Quit();
}
Java and JavaScript setup
In Java and JavaScript, likewise configure the binding’s Edge options with --headless=new and pass them to the Edge driver constructor. The Microsoft setup guidance covers the options pattern across these languages. Use the screenshot API documented for your current Selenium binding rather than copying a method signature from a different language: return types and file-writing conventions vary.
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
If you need an image or PDF and do not want to install and manage Edge, EdgeDriver, and Selenium, ScreenshotNeo provides a screenshot API. One GET request accepts a URL and returns a PNG, JPEG, WebP, or PDF. The API has many capture options, including viewport and full-page captures, selector-based capture, waits, and custom headers. See the ScreenshotNeo API documentation for request parameters and response details.
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-o shot.webp
ScreenshotNeo can accept cookie or consent banners and remove more than 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 response headers indicate the page verdict and billing status. An MCP server provides screenshot tools for AI agents, including 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 shots. Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting EdgeDriver screenshots
EdgeDriver cannot start a session
- Check the components: Confirm Edge is installed and Selenium 4 is installed in the environment running the script.
- Check browser and driver compatibility: A mismatch between Edge and Edge WebDriver can prevent session creation. Install a driver compatible with the installed browser.
- Check managed-device policy: Microsoft documents that an administrator’s
DeveloperToolsAvailabilitypolicy value of2blocks Edge WebDriver because the driver uses Microsoft Edge DevTools. If a corporate machine rejects session startup, ask the administrator whether this policy applies. - Check the headless argument: Make sure
--headless=newis added to the Edge options object that is actually passed to the driver constructor.
The image is blank, incomplete, or has the wrong layout
- Confirm that navigation reached the intended URL rather than an error, sign-in, or bot-check page.
- Wait for the element or data that must appear; document readiness alone does not establish that every asynchronous component is ready.
- Set the viewport dimensions before the final readiness wait and capture.
- For lazy-loaded sections, scroll or otherwise trigger loading before attempting to capture them.
The screenshot file is missing or unusable
- Use an explicit output path and ensure the process has permission to write to its directory.
- Check the return value of the binding’s screenshot-save method, and confirm the process reaches that line without a timeout or exception.
- Use
driver.quit()in afinallyblock so the session is closed on both success and failure.
Edge policy names cause confusion
Microsoft’s DisableScreenshots policy concerns screenshots through keyboard shortcuts or extension APIs; the available documentation does not establish that it blocks or permits a WebDriver screenshot command. WebCaptureEnabled governs Edge’s user-facing Screenshot/Web Capture feature, not this automation workflow. Do not treat either policy as a definitive explanation for a WebDriver capture failure without evidence specific to that command.
Reliability, performance, and cost considerations
A local headless session avoids displaying a browser window, but it still needs to start a browser process, load the page, execute its scripts, and wait for the required content. Capture time will therefore depend on the target site, network, machine, and wait condition; there is no single reliable duration or speed figure for all pages. Reuse a session for multiple captures when appropriate, but create a fresh session when isolation between pages or user states matters.
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.
For repeatable output, control the viewport, page state, authentication, and other conditions that affect rendering. A page that varies by location, time, cookies, or account may not produce identical output across runs. WebDriver automation also requires maintaining the browser, driver, and framework dependencies. A hosted API can remove local browser setup, but shifts the work to managing API credentials, request options, and response handling.
Frequently Asked Questions
Does Edge need to be installed to use EdgeDriver headlessly?
Yes. Headless mode suppresses the visible browser window; it does not replace the Edge browser, Edge WebDriver, or Selenium framework.
Does the example capture a full web page?
No. It saves a viewport screenshot. Full-page capture support and its behavior depend on the binding and browser API in use.
Can I use Edge’s built-in Web Capture shortcut in an automated headless session?
That is a different feature from issuing a screenshot command through WebDriver. The WebCaptureEnabled policy governs the user-facing feature, not this Selenium workflow.
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.

