Search code examples
c#selenium-webdrivermicrosoft-edgeselenium-iedriver

Selenium IE Driver launches browser window and times out. Suspected Edge 'Tracking Prevention' interference


I have an application that uses Selenium to automate some data collection. As of last week, my IE Driver code has stopped working. I use IE Driver because the devices I interact with all use IE8, IE11, so they do not load correctly within regular MS Edge. Recently, our Edge version was updated, which has had a negative effect on the Selenium code within my application. The IE Driver instance launches the browser, but times out. However, if I manually turn off Edge Tracking Prevention before the 60 second timeout, the IE Driver code continues on as normal.

I have tried testing this code to comply with MS Edge. I cannot access the web page due to incompatible SSL certificates (ERR_SSL_KEY_USAGE_INCOMPATIBLE), as expected. I can bypass this by manually turning on IE Mode and refreshing the page (tracking prevention on or off, does not matter), but this is not a solution to my issue.

Is there a way to overcome the effects of MS Edge Tracking Prevention within IE Driver?

Selenium Specs:

Selenium.WebDriver Version 4.24.0

Selenium.WebDriver.IEDriver Version 4.14.0

Selenium.Support Version 4.24.0

MS Edge Specs:

Microsoft Edge128.0.2739.42 (Official build) (64-bit)

Revisione015505d79c9432c75e2a9131c445776c61af592

Chromium version128.0.6613.85

Operating system Windows 10 Version 22H2 (Build 19045.4780)

JavaScriptV8 12.8.36.6

Here is the relevant code. I have tried running it with and without ieOptions.BrowserCommandLineArguments. I have also tried launching without an initial URL. Launching a basic IE Driver instance results in the same:

var ieOptions = new InternetExplorerOptions
{
    AttachToEdgeChrome = true,
    EdgeExecutablePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
    //ieOptions.PageLoadStrategy = PageLoadStrategy.Eager;
    IntroduceInstabilityByIgnoringProtectedModeSettings = true,
    InitialBrowserUrl = Url,
    IgnoreZoomLevel = true,
    RequireWindowFocus = false,
    //AcceptInsecureCertificates = true,
    //ForceCreateProcessApi = true,
};
ieOptions.BrowserCommandLineArguments = "--disable-features=msEnhancedTrackingPreventionEnabled --ignore-certificate-errors --allow-running-insecure-content --allow-insecure-localhost";
ieOptions.SetLoggingPreference(LogType.Browser, LogLevel.Off);
ieOptions.SetLoggingPreference(LogType.Client, LogLevel.Off);
ieOptions.SetLoggingPreference(LogType.Driver, LogLevel.Off);
ieOptions.SetLoggingPreference(LogType.Profiler, LogLevel.Off);
ieOptions.SetLoggingPreference(LogType.Server, LogLevel.Off);
var driverService = InternetExplorerDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;
IWebDriver driver = new InternetExplorerDriver(driverService, ieOptions);
driver.Manage().Window.Maximize();

Solution

  • This has been resolved with the most recent update (as of 9/9/24) 128.0.2739.67. All existing code is now completing as it was before this posted issue.