Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
Edge IE mode

How to Screenshot a Specific Element on an Internet Explorer Website with VBA and Selenium

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

Short answer: with SeleniumBasic, find the target WebElement and call its TakeScreenshot method. The method returns an image object, so the exact code used to save that object depends on the SeleniumBasic build you installed. Internet Explorer itself is retired and unsupported; treat this as legacy automation, use Edge IE mode when the site requires IE compatibility, or migrate to a supported browser and driver.

What still works—and what does not

Microsoft retired Internet Explorer and ended support on June 15, 2022. Selenium’s current IE documentation no longer supports standalone Internet Explorer, although the IE driver can run Microsoft Edge in IE Compatibility Mode. That distinction matters: an old machine may still launch iexplore.exe, but a new automation project should not assume that Selenium, the driver, and the browser will work together.

  • Legacy standalone IE: possible only in an old, controlled environment with matching software. It is unsupported and unsuitable for a new deployment.
  • Edge IE mode: the Microsoft compatibility route for sites that still require IE behavior. Validate the target site’s enterprise configuration and the exact driver version.
  • Migration: move the workflow to a current browser and driver whenever the site works without IE-specific rendering or controls.

The element screenshot operation is a WebDriver capability. Selenium’s documentation demonstrates element screenshots in supported language bindings, while SeleniumBasic exposes the VBA-facing COM method. A method declaration is not a promise that every SeleniumBasic release, browser, and driver will execute it successfully.

Prerequisites for the VBA/SeleniumBasic method

  • Microsoft Excel or another VBA host with permission to run macros.
  • SeleniumBasic installed and registered for the account running the macro.
  • A browser and driver pair that your SeleniumBasic installation can control. Do not mix an old SeleniumBasic binary with an arbitrary modern driver without testing.
  • A stable selector for the element, preferably an ID or a site-owned data attribute rather than a position-dependent XPath.
  • For a framed page, the frame name, ID, or selector containing the element.

In the VBA editor, add the Selenium type library reference if your installation provides one. If the reference is unavailable, late binding can avoid a compile-time reference, but you still need the SeleniumBasic COM classes registered correctly.

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

Locate the element and call TakeScreenshot

SeleniumBasic’s WebElement interface declares TakeScreenshot(delayms), with an optional delay in milliseconds, and returns an Image. The delay is useful when the element appears before its contents finish rendering; it is not a substitute for waiting on the correct page state.

Early-bound VBA example

Option Explicit

Sub CaptureElement()
    Dim driver As New Selenium.WebDriver
    Dim target As Selenium.WebElement
    Dim shot As Selenium.Image

    driver.Start "ie"
    driver.Get "https://example.com/page"

    'Use a selector that is stable on the target site.
    Set target = driver.FindElementByCss("#invoice-summary")

    'Optional delay is in milliseconds.
    Set shot = target.TakeScreenshot(500)

    'The returned SeleniumBasic Image object is now in shot.
    'Use the save/export member exposed by your installed build
    'after confirming it in the object browser or project source.

    driver.Quit
End Sub

Replace the URL and selector with values from the real site. The code deliberately stops at the returned image object: the available SeleniumBasic interface evidence establishes the return type and method declaration, but not one universal file-save member for every released build. Inspect the installed Selenium.Image class in the VBA Object Browser (or the SeleniumBasic source shipped with your installation) before writing the image to disk or inserting it into Excel.

Late-bound variant

Option Explicit

Sub CaptureElementLateBound()
    Dim driver As Object
    Dim target As Object
    Dim shot As Object

    Set driver = CreateObject("Selenium.WebDriver")
    driver.Start "ie"
    driver.Get "https://example.com/page"

    Set target = driver.FindElementByCss("#invoice-summary")
    Set shot = target.TakeScreenshot(500)

    'Confirm the Image object's save/export API in your installed build.
    driver.Quit
End Sub

Late binding moves some failures from compile time to run time. That can help when a type-library reference is missing, but it makes misspelled members and registration problems harder to diagnose.

Rank #2
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
  • 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
  • 4GB DDR4 System Memory; 128GB Solid State Drive
  • 11.6" HD (1366 x 768) Multi-Touch Display
  • Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
  • Windows 11 Pro

Choose a selector that identifies one element

Preferred selectors

  • #order-total when the page assigns a unique ID.
  • [data-testid='order-total'] or another stable, site-owned attribute.
  • A short CSS path tied to a semantic container, such as section.receipt .total.

Selectors to avoid when possible

  • Long absolute XPaths beginning at /html/body.
  • Generated class names that change on each build.
  • “The third row” or another positional description that changes when content is inserted.

Verify that the selector matches exactly one visible element. If it matches several nodes, choose the intended node explicitly; if it matches none, inspect the page after redirects and authentication have completed.

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

Capture an element inside a frame

Selenium searches the top-level document until you switch into the frame that owns the target. Switch first, locate the element second, and return to the default content before operating on the outer page again.

'After driver.Get and after the frame is present:
driver.SwitchToFrame driver.FindElementByCss("iframe#legacy-app")
Set target = driver.FindElementByCss("#invoice-summary")
Set shot = target.TakeScreenshot(500)
driver.SwitchToDefaultContent

Frame APIs and driver behavior vary by SeleniumBasic and browser version. If the frame is nested, switch through each level in order. A selector that works in the browser’s top-level inspector can still fail if the element is inside a frame or shadow boundary.

Rank #3
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.

Wait for the page state you actually need

A screenshot taken immediately after navigation may contain a loading shell, stale data, or an element whose fonts and images have not loaded. Use a site-specific readiness condition rather than increasing a fixed sleep indefinitely.

  • Wait until the target selector exists and is visible.
  • Wait for a loading indicator to disappear.
  • After an AJAX update, wait for the text or attribute that proves the update finished.
  • Use TakeScreenshot(delayms) for a short final rendering delay when your build supports it.

SeleniumBasic installations differ in the explicit-wait helpers they expose. Confirm the wait methods available in your version instead of copying an API from a different language binding. A fixed delay alone is fragile on a slow network and wasteful on a fast one.

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

Why the capture can fail

Symptom Likely cause Action
“ActiveX component cannot create object” SeleniumBasic is not registered for the VBA host, or the installation is incomplete. Repair or reinstall SeleniumBasic, check the bitness and registration context, then test a minimal driver startup macro.
Driver starts and immediately closes Browser/driver incompatibility, unsupported standalone IE, or a policy blocking automation. Check the exact browser and driver pair. For legacy behavior, test Edge IE mode; otherwise migrate to a supported browser.
“Element not found” Wrong selector, wrong document context, redirect not finished, or element inside a frame. Confirm the final URL, inspect the selector, switch into the correct frame, and wait for the element.
Screenshot is blank or incomplete Element is hidden, outside the rendered state, still loading, or the driver lacks reliable element-capture support. Ensure visibility, scroll or otherwise render the target, add a readiness wait, and test the same operation with the installed driver.
Method exists but raises a run-time error The SeleniumBasic declaration is present, but the current driver/browser does not implement the operation correctly. Treat the declaration as an API surface, not a compatibility guarantee. Reproduce with a small test and check versions.
Image cannot be saved The returned object is a SeleniumBasic Image, not necessarily a standard VBA StdPicture or byte array. Inspect that installed Image class for its save/export member before adding file or Excel code.

Validate the result before automating at scale

  1. Run one URL and one selector manually.
  2. Confirm the returned image contains the intended element, not the full page or a loading placeholder.
  3. Repeat after a cold browser start and after a login or redirect.
  4. Test the slowest realistic network and the target machine’s screen and policy settings.
  5. Only then add loops, retries, or scheduled execution.

Element screenshots are sensitive to rendering differences. Record the browser mode, driver version, SeleniumBasic release, viewport, zoom, and page state used for a successful baseline. When a site changes its markup, a stable selector and a clear readiness condition make the failure easier to diagnose.

Rank #4
15.6 Inch Laptop Computer, N4020, 4GB DDR4 RAM, 128GB eMMC,with Windows 11
  • EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
  • 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
  • RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
  • ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
  • LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.

Or skip the browser setup

If you only need a clean image or PDF of a URL, ScreenshotNeo provides a website screenshot API and MCP server. It accepts the cookie or consent banner as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.

One GET request is enough:

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 PNG, JPEG, WebP, PDF, and the 63 capture options, including full-page lazy-image loading, CSS-selector element capture, device presets, retina scale, custom CSS and JavaScript, waits, request blocking, cookies and headers, timezone and geolocation, caching, signed links, asynchronous webhooks, bulk capture, and the usage API.

Python:

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)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

An MCP server lets Claude, Cursor, or another MCP client call take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 shots each month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Which route should you use?

Requirement Best fit
The site truly requires IE-only behavior and you already operate a controlled legacy stack. SeleniumBasic with the tested legacy environment, documenting its unsupported status.
The site requires IE compatibility but must run on a maintained Windows browser. Edge IE mode, validated with the appropriate driver and enterprise policy.
The site works in a current browser and you control the automation code. Migrate to a supported Selenium language binding and driver.
You need URL captures without maintaining browser automation. ScreenshotNeo, which removes common consent UI and bills only clean captures.

Frequently Asked Questions

Does TakeScreenshot capture the whole browser window?

No. The call is made on a SeleniumBasic WebElement, so it is intended to capture that element. Full-page or window capture is a different operation and depends on the driver and binding.

Best Value
Sale
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.

Can I rely on standalone Internet Explorer for a new project?

No. Internet Explorer has been retired and Selenium no longer supports standalone IE. Use Edge IE mode only when legacy compatibility is necessary, or migrate.

Why is there no universal VBA line that saves the image?

SeleniumBasic returns its own Image object, and the available interface declaration does not establish one save/export member that is identical across every build. Inspect the version installed on your machine.

Quick Recap

Bestseller No. 1
HP 14' HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
HP 14" HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
$249.99
Bestseller No. 2
Dell Latitude 3190 11.6' HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core; 4GB DDR4 System Memory; 128GB Solid State Drive
Bestseller No. 3
Dell Latitude 5420 14' FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
256 GB SSD of storage.; Multitasking is easy with 16GB of RAM; Equipped with a blazing fast Core i5 2.00 GHz processor.
$304.99

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.