Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If your application embeds Microsoft Edge WebView2, capture its rendered preview with CoreWebView2.CapturePreviewAsync and save the resulting stream as an image. Wait until the page has begun loading before capturing; calling too early can fail or return the page from before a navigation. “WebBrowser Control” can also mean an older .NET control or an automation browser, however, so first identify which one your application uses. The WebView2 API below is not universal code for every control.

First identify which browser you are capturing

There are two distinct jobs commonly described as taking a screenshot from a browser control:

  • Capture an embedded browser: Your application hosts Microsoft Edge WebView2. Use WebView2’s preview capture API.
  • Capture an automated browser: A test or script drives a browser through Selenium. Use a WebDriver screenshot for the browser view, or a WebElement screenshot for a particular element.

Do not assume that an older .NET WebBrowser control has the WebView2 API. Confirm the control type, language, and platform in your project before copying code. Microsoft’s WebView2 overview describes the WebView2 APIs for .NET/C#, WinRT/C#, and Win32/C++.

Capture a WebView2 page as a PNG in .NET

For an embedded WebView2 control, call CoreWebView2.CapturePreviewAsync with the PNG format and a writable stream. Save the stream after the asynchronous capture completes. The following example is for a .NET application with a WebView2 control named webView; adapt the control name and initialization point to your project.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
  1. Initialize and navigate. Ensure the WebView2 control has initialized, then navigate to the target URL.
  2. Wait for page loading. Wait for the navigation to complete before capturing. This example waits for NavigationCompleted, which occurs after the page has started loading.
  3. Capture into a stream. Pass a writable MemoryStream and the PNG format.
  4. Write the bytes to disk. Rewind the stream before copying it to a file.

Example for a WinForms form with a WebView2 control named webView:

using Microsoft.Web.WebView2.Core;

private async Task CapturePageAsync(string url, string outputPath)
{
    await webView.EnsureCoreWebView2Async();

    var navigation = new TaskCompletionSource<bool>();
    void OnNavigationCompleted(object? sender,
        CoreWebView2NavigationCompletedEventArgs e)
    {
        webView.NavigationCompleted -= OnNavigationCompleted;
        navigation.TrySetResult(e.IsSuccess);
    }

    webView.NavigationCompleted += OnNavigationCompleted;
    webView.Source = new Uri(url);

    bool succeeded = await navigation.Task;
    if (!succeeded)
    {
        throw new InvalidOperationException("The WebView2 navigation did not succeed.");
    }

    using var image = new MemoryStream();
    await webView.CoreWebView2.CapturePreviewAsync(
        CoreWebView2CapturePreviewImageFormat.Png, image);

    image.Position = 0;
    using var file = File.Create(outputPath);
    await image.CopyToAsync(file);
}

Call the method from your UI code with an absolute URL and a writable output path, for example await CapturePageAsync("https://example.com", "page.png");. Ensure your project has the WebView2 package and the relevant System.IO and System.Threading.Tasks imports. The precise API availability and signature depend on the installed WebView2 SDK and target platform.

Why navigation timing matters

Microsoft’s Win32 ICoreWebView2::CapturePreview reference says the first capture call fails if it is made before the first ContentLoading event. On subsequent navigation, an early call may capture the page being navigated away from rather than the new page. Waiting for a suitable loading event avoids treating “navigation started” as “the new page is ready.” Navigation completion is a convenient basic synchronization point, but it does not guarantee that every delayed image, animation, or application-specific asynchronous update has finished.

The code waits for a successful navigation before capturing. If your application performs additional asynchronous work after navigation, wait for an application-specific condition before calling the capture API. The detailed Win32 reference reviewed is for SDK version 1.0.992.28; check the API reference and package version for your own platform.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Choose the output format deliberately

The WebView2 capture API accepts an image format. This example requests PNG and writes the resulting image bytes to a file with a .png extension. Use the format supported by the API version you target, and make the file extension match the selected format. The call captures the control’s rendered preview; it is not a PDF export or a request for the page’s HTML.

Use Selenium when the browser is being automated

If the browser exists to run automated tests rather than as an embedded control in your app, Selenium provides screenshot methods for a WebDriver and for a WebElement. In .NET, a page screenshot is represented by Selenium’s Screenshot class and can be saved as PNG with SaveAsFile. A typical capture after your test has navigated and waited for its own page condition looks like this:

// driver is an initialized Selenium WebDriver after navigation and any required waits.
Screenshot shot = ((ITakesScreenshot)driver).GetScreenshot();
shot.SaveAsFile("page.png");

For a particular element, use the screenshot method exposed by the WebElement in your Selenium binding:

// element is a located Selenium IWebElement.
Screenshot shot = element.GetScreenshot();
shot.SaveAsFile("element.png");

Exact method availability can vary by Selenium language binding and version. Selenium’s documentation and .NET API reference describe the relevant methods; check the reference for the binding installed in your project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Know what Selenium captured

Do not assume every driver returns the same screenshot boundaries. Selenium documents that behavior may depend on whether a driver conforms to the WebDriver standard. A non-conformant driver may best-effort capture the full page, current window, visible portion of the current frame, or the full display. Element screenshots may include all element content or only the visible part. If exact dimensions, clipping, or full-page coverage matter, verify the behavior for your actual driver and binding rather than inferring it from the method name.

Choose the route that matches the job

Route Use it when What it captures and returns
WebView2 CapturePreviewAsync / CapturePreview Your application embeds Microsoft Edge WebView2. The control’s rendered preview in the image format you request; the Win32 API writes to a caller-provided stream and signals completion through a handler.
Selenium WebDriver screenshot A test or automation script drives a browser. A browser or driver view; the captured scope can vary by driver and conformance.
Selenium WebElement screenshot You need an element rather than the browser view. An element image; whether it includes all or only visible content can depend on the driver.

These routes solve different problems. Pick by control identity and capture target, not by the generic phrase “browser screenshot.”

Troubleshooting WebView2 and Selenium captures

The first WebView2 capture fails

Likely cause: Capture was called before the first content-loading event or before WebView2 initialization finished. Fix: await control initialization, start navigation, and wait for a loading or navigation event before capture.

The screenshot shows the old page

Likely cause: Capture ran too soon after starting a later navigation. Microsoft documents that an early capture can show the page being navigated away from. Fix: wait for the new navigation to reach the appropriate loading point, then capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

The saved file is empty or cannot be opened

Likely cause: The stream was not writable, was saved before the asynchronous operation completed, or was read from its end position. Fix: await the capture call, use a writable stream, reset its position to zero, and then copy it to the output file. Keep the file extension consistent with the requested format.

The navigation wait never completes

Likely cause: The navigation event handler was not attached before navigation, or the control is navigating through a different path than the code expects. Fix: attach the handler before setting the source, check navigation failure explicitly, and ensure the UI event loop remains active. Remove the handler when the wait completes so it does not accumulate across captures.

The Selenium screenshot is clipped or has unexpected dimensions

Likely cause: Screenshot scope differs across the driver, target, and binding. Fix: distinguish browser-view capture from element capture, consult the specific driver’s behavior, and validate the returned image dimensions in the test environment.

The capture lacks content loaded after navigation

Likely cause: Navigation completion does not necessarily mean a site’s delayed images or asynchronous interface updates are finished. Fix: wait for the specific selector or application state your task requires, then capture. A fixed delay may work in a simple case but is less reliable than waiting for the condition that indicates readiness.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and cost considerations

Both capture routes are local API operations in the application or automation flow described here; the cited documentation provides no general timing benchmark. Avoid capturing before the page is ready, since that can produce a wrong or failed result and require a retry. If you capture many pages, serialize or schedule work according to your application’s browser and memory constraints, and dispose of streams and output files promptly. Selenium adds a separately driven browser and driver to the test setup; WebView2 uses the control already hosted by the application. Neither route should be treated as a guarantee that every delayed or off-screen page element has rendered.

Or skip the browser setup

If you need a screenshot from a URL rather than from a browser instance hosted in your own application, ScreenshotNeo offers a one-request website screenshot API. Its API accepts a URL and can return PNG, JPEG, WebP, or PDF. For example, this cURL request saves a WebP capture of the Stripe homepage:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for API details. Cookie banners and consent overlays, newsletter popups, and chat widgets are removed before capture; each step can be turned off. Bot checks, blank pages, and failed loads are not billed, and response headers say the page verdict and whether the request was billed. An MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently asked questions

Can I capture a screenshot from an older .NET WebBrowser control with this WebView2 code?

No. The code uses WebView2 types and methods. Identify the exact control and consult documentation for that control before selecting an implementation.

Can WebView2 capture a PDF with CapturePreviewAsync?

The API discussed here captures an image preview. This example produces a PNG; it does not demonstrate PDF generation.

Does Selenium always capture the entire page?

No. Screenshot scope can vary by driver and target. Check the behavior documented for the driver and binding you actually use.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.