Launching IE in InPrivate mode (C# Selenium)

1,245 views
Skip to first unread message

Christina Stead

unread,
Aug 4, 2016, 11:00:07 PM8/4/16
to Selenium Users
Hi guys, 
I have an automated test suite that only uses IE (based on what our users use). I need to switch it to use InPrivate mode for running tests because a normal session basically doesn't log you out of our app(it's complicated and dumb). I tried the following options for the driver to see if that would allow for launching IE as InPrivate. 

 var options = new InternetExplorerOptions
                {
                    IgnoreZoomLevel = true,
                    ForceCreateProcessApi = true,
                    BrowserCommandLineArguments = "-private"
                };

The result is that I get this: “Unexpected error launching Internet Explorer. Unable to use CreateProcess() API. To use CreateProcess() with Internet Explorer 8 or higher, the value of registry setting in HEKY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\TabProcGrowth must be '0’.” 

I tried adding and setting that registrykey to 0, but that results in IE not loading (for reasons unbeknownst to me). 
I tried switching to use the 64bit IE driver, but it runs at a very slow rate on my machine. 
Does anyone know WHY this error is being thrown exactly? I'm running out of ideas on how to make it launch InPrivate mode. 
Does anyone have any suggestions on how to fix this issue? I'm using IE11. 

Thanks! 

ח3בייס

unread,
Jul 19, 2017, 6:20:45 AM7/19/17
to Selenium Users
Hello,

I have a problem just like you said here,
Trying to open a private instance of the Explorer browser (selenium webdriver +  c#) with the following code:

                        InternetExplorerOptions option = new InternetExplorerOptions();
                        option.ForceCreateProcessApi = true;
                        option.BrowserCommandLineArguments = "-private";
                        driverUser = new InternetExplorerDriver(option);
                        Drivers.Add(Browsers.userIE.ToString() , driverUser);

And you get the following error:

Unable to use CreateProcess() API. To use CreateProcess() with Internet Explorer 8 or higher, the value of registry setting in HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\TabProcGrowth must be '0'.

I see that you published it about a year ago and you did not get an answer
Have you found a solution to this problem?
I would be very happy if you would share it with the solution

Thank you!

ח3בייס

unread,
Jul 19, 2017, 6:36:43 AM7/19/17
to Selenium Users

try do remove this line:
                    "ForceCreateProcessApi = true,"
For me it helped.



בתאריך יום שישי, 5 באוגוסט 2016 בשעה 06:00:07 UTC+3, מאת Christina Stead:

Brandon Dudek

unread,
Jun 11, 2018, 1:17:23 PM6/11/18
to Selenium Users
Removing `ForceCreateProcessApi = true` workd. But it also disables the Private browsing.
Reply all
Reply to author
Forward
0 new messages