cmarquez
cmarquez

Reputation: 1

Selenium C# InPrivate Mode Internet Explorer

I'm trying to launch IE11 on InPrivate mode when running my automated tests using Selenium C#. Found the options to do it but I can't seem to make mine work with these line of codes.

        InternetExplorerOptions options = new InternetExplorerOptions();
        options.ForceCreateProcessApi = true;
        options.BrowserCommandLineArguments = "-private";

        IWebDriver driver = new InternetExplorerDriver(options);
        return driver;

The driver opens as I can see it on task manager, but then IE does not open. If I remove options though inside the InternetExplorerDriver, it works totally fine. So there's something wrong with options. Would you have any idea about this?

Thanks!

Upvotes: 0

Views: 1034

Answers (1)

Tybs
Tybs

Reputation: 532

Quite an old topic, but in case someone still happens to need it... I stumbled upon a similar issue.

Check if you are using the 32-bit IE driver. I found out the hard way that options.ForceCreateProcessApi = true; will cause this driver to timeout, at least for the versions I have tested (3.4.0 - 3.8.0). So far, I haven't managed to get private mode working for 32-bit in this setting.

For now, i use this as a work-around:

options.EnsureCleanSession = true;

This slows the tests down a lot, but at least it clears the cache.

Upvotes: 2

Related Questions