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

A Selenium SessionNotFoundException usually means the WebDriver session was deleted or changed before the failing command ran. Start by tracing who called quit() or close(), whether the last browser tab closed, and whether a test fixture or another thread shut down the driver. Browser settings are a later suspect unless the failure happens during session startup or the IE Driver loses its connection to the browser.

There is a separate support issue to account for: Selenium no longer officially supports standalone Internet Explorer. The documented legacy route is using IE Driver with Microsoft Edge in IE Compatibility Mode, if that meets your application’s needs. Selenium’s IE documentation was last modified July 29, 2025; confirm version-specific options for the binding you use.

First determine whether the session vanished or was never created

The point in the run where the exception first occurs changes the diagnosis. Selenium documents SessionNotFoundException as a session that has been deleted or changed; its examples include calling driver.quit() and closing the last browser tab or window. A different exception, SessionNotCreatedException, means Selenium could not create a browser session in the first place. Selenium associates creation failures with matters such as browser/driver compatibility, system restrictions, or configuration.

Where the failure occurs What to investigate first
While constructing the driver, before any successful browser command Whether session creation failed; preserve the full exception and IEDriverServer log, then check compatibility and configuration.
After commands have succeeded in the same run Whether the session was closed, replaced, or lost: teardown, quit(), close(), browser restarts, last-tab closure, and shared-driver use.
Only when using IE Driver or Edge IE Compatibility Mode IE-specific setup, driver logs, and whether the browser connection was lost.

Do not treat every Selenium startup error as a missing session. Capture the complete exception type and stack trace, the first failing command, and the server log before changing configuration.

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

Trace the WebDriver lifecycle around the first failing command

  1. Find the first failure. Use the earliest failing WebDriver command, not later errors caused by the same lost session. Record whether the test successfully navigated or queried the page earlier in that run.
  2. Search cleanup and restart paths. Inspect every call to quit() and close(), test teardown hooks, fixture cleanup, retry logic, and code that restarts a browser. A quit() ends the session; closing the final tab or window can also make the session unavailable.
  3. Check who owns the driver. If a driver is stored in shared state, verify that one test, fixture, or thread cannot close it while another still sends commands. Give each test a clear ownership and cleanup boundary, or serialize access if sharing is unavoidable.
  4. Check browser-window changes. Look for code that closes tabs, switches windows, or assumes a window remains open after application behavior. A command sent after the final window has closed cannot be fixed by adding a wait for an unrelated page element.
  5. Make cleanup happen once. Keep teardown in one predictable place. Avoid calling quit() in both a test and a fixture unless the second call is deliberately guarded and cannot race with active commands.

A useful diagnostic is to add temporary log messages immediately before and after driver creation, every teardown hook, every browser restart, and the first failing command. Log the test identifier and thread where relevant. This can reveal an early cleanup path that is otherwise difficult to distinguish from a browser or driver crash.

Use a supported browser route for IE-dependent applications

Selenium’s IE functionality page states: “As of June 2022, Selenium officially no longer supports standalone Internet Explorer.” It also documents IE Driver support for running Microsoft Edge in “IE Compatibility Mode.” That is the route to evaluate if the application genuinely requires IE-specific rendering or behavior and Edge IE mode meets its requirements. It is not the same as running the retired standalone IE browser.

For IE Driver v4.5.0 and later, Selenium documents automatic Edge discovery when IE is absent. If both IE and Edge are present, the page says setting the Edge attachment option is sufficient for automatic Edge discovery. Exact option names and requirements vary by language binding and version; check the documentation for the Selenium binding installed in your project rather than copying an option from another language.

Here is a minimal Java example for an installation where the IE Driver can discover Edge and the application is configured to use IE Compatibility Mode. It opens a page and then closes the session. It demonstrates driver setup and orderly teardown; it does not configure an enterprise IE-mode site list or guarantee that a particular application is compatible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;

public class IeModeSmokeTest {
    public static void main(String[] args) {
        InternetExplorerOptions options = new InternetExplorerOptions();
        options.attachToEdgeChrome();

        WebDriver driver = new InternetExplorerDriver(options);
        try {
            driver.get("https://example.com");
            System.out.println("Title: " + driver.getTitle());
        } finally {
            driver.quit();
        }
    }
}

Use the Selenium Java dependency already managed by your project, and ensure the matching IEDriverServer executable is discoverable as described below. The example targets Edge attachment through IE Driver; for a real application, verify that Edge’s IE mode is enabled and that the application is configured to open in that mode. If an option does not compile, check the installed Selenium Java version and its IE options API.

Verify the IE Driver binary and capture its logs

The IEDriverServer executable must be available on PATH. Java projects can instead set the webdriver.ie.driver system property to the executable’s full path. Confirm that the test is launching the binary you expect, especially on machines with multiple driver copies.

Turn on IEDriverServer logging when the failure occurs during startup or the server appears to lose its browser connection. The server reference lists FATAL, ERROR, WARN, INFO, DEBUG, and TRACE levels. For a focused reproduction, choose a diagnostic level and logfile, then inspect whether the server exits, reports a startup error, or stops communicating with the browser. Keep verbose logs limited to the reproduction because they can be large and may contain environment details.

IEDriverServer.exe --log-level=DEBUG --log-file=C:tempiedriver.log

Use the logging options supported by the IEDriverServer version you run. If Selenium launches the service for you, configure the corresponding service arguments or logging settings in your binding; do not assume that manually starting a second server will diagnose the same session.

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.

Check legacy IE configuration only when the IE path needs it

IE Driver is sensitive to machine-level browser settings. Selenium’s IE documentation calls out the following checks for supported legacy configurations:

  • IE 11 FEATURE_BFCACHE: Create the FEATURE_BFCACHE registry key if it is absent and set the iexplore.exe DWORD value to 0.
  • Protected Mode: In Internet Options > Security, set Protected Mode consistently across every security zone: either enabled for all zones or disabled for all zones.
  • Enhanced Protected Mode: Disable it for the documented IE Driver configuration.
  • Browser zoom: Set IE zoom to 100%.
  • Windows display scaling: On Windows 10, set display scaling to 100% for the documented legacy setup.

Change only settings permitted by your organization. Registry and security changes can affect the whole machine or weaken protections; do not apply them to a general-use workstation just to silence an error. If the run uses Edge in IE Compatibility Mode rather than standalone IE, first confirm which configuration the installed IE Driver and Selenium version actually require.

Selenium documents ignoreProtectedModeSettings as a bypass, but warns it can lead to flaky tests, unresponsive behavior, or browser hangs. Matching the security-zone settings manually is the first choice; treating the bypass as a general fix can make a failing run less predictable.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Isolate concurrency, timing, and browser-specific behavior

Concurrent IE Driver sessions

Selenium notes that multiple simultaneous IE Driver instances are possible but largely untested, with possible cookie or focus problems. If the issue appears only under parallel execution, reproduce it with one driver and one test first. If multiple instances are required, Selenium suggests RemoteWebDriver and virtual machines as approaches to consider. Selenium expressly says IE Driver is unsupported under a Windows Service because service processes have different requirements.

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

Waits and application timing

Compare the command sequence in another browser to help separate a driver-specific problem from test or application behavior. Review synchronization around navigation and page updates. A temporarily longer wait can help establish whether timing is involved, but replace that experiment in the final test with a condition tied to the application state you actually need. Waiting longer will not revive a session that has already been quit.

A small reproduction

Reduce the failing case to one driver, one navigation, and the first command that triggers the exception. Keep the same browser mode, machine settings, driver binary, and test framework lifecycle. If that minimal case succeeds, add the original teardown, parallelism, or application behavior back one piece at a time. If it fails at construction, investigate session creation and logs instead of session cleanup.

Common symptoms and fixes

Symptom Likely direction Next action
Commands work, then fail immediately after teardown The test or fixture ended the session. Move cleanup after the last command and ensure teardown runs once.
Failure follows closing a tab or window The final browser window may have closed or the session/window state changed. Check close commands and application behavior; do not send commands through a stale driver.
Failure occurs at driver construction Possibly a creation failure, not SessionNotFoundException in the ordinary lifecycle sense. Capture the exact exception and IEDriverServer log; check binary availability, compatibility, and configuration.
It happens only in parallel tests Shared-driver races or IE Driver multi-instance behavior. Run serially to isolate it; establish driver ownership and consider remote sessions or separate VMs.
Browser starts but hangs or disconnects IE-specific settings, server/browser connection, or unsupported service hosting may be involved. Enable IEDriverServer logs and verify the documented IE settings and hosting model.

Or skip the browser setup

If your task is to save a screenshot of a public web page rather than exercise an IE-only workflow, ScreenshotNeo can return an image or PDF from one request. It is not a Selenium replacement for testing IE Compatibility Mode, interacting with a site, or reproducing a browser-session failure. For a screenshot capture, the cURL example is:

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 API documentation for request options. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. Its MCP server exposes screenshot, page-info, and PDF tools for AI agents. The free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 shots.

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

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

Frequently Asked Questions

Does the exception mean Selenium needs a longer wait?

Not by itself. A wait can help with a timing problem, but first establish whether the driver session still exists; no wait can restore a session that has been closed.

Can I use the Java example unchanged for standalone Internet Explorer?

No. It sets the Edge attachment option and is intended for an Edge IE Compatibility Mode setup. Standalone IE is no longer officially supported by Selenium.

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.