1

I hardly tried to open InPrivate mode in IE and Edge browser using Selenium C#. Below code for IE11 Windows 8 but doesn't work for me:

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

IWebDriver driver = new InternetExplorerDriver(options);
driver.Navigate().GoToUrl("www.google.com"); 

1 Answer 1

4

Microsoft has changed the behavior of IE11, and broken the IE driver in the process. The problem is with the browser's behavior change. There is no clear-cut workaround yet. You could try setting the initialBrowserUrl capability via the InternetExplorerOptions class, but there's no guarantee that it will work.

InternetExplorerDriverService ieDriverService = InternetExplorerDriverService.CreateDefaultService(webDriverDir);

ieDriverService.LoggingLevel = InternetExplorerDriverLogLevel.Trace;   
ieDriverService.LogFile = "c:\\jenkins\\iedriver.log";

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

return new InternetExplorerDriver(ieDriverService, ieOptions);
5
  • @ Bharat Thanks. I have tried that way but does not work. InternetExplorerDriver does not contain a definition for "FORCE_CREATE_PROCESS". Same for "IE_SWITCHES".
    – Mohammad
    Jul 10, 2017 at 14:36
  • Currently, I'm using IE-10 version and it's working on my PC. You have to check some changes for IE-11.
    – Bharat Mane
    Jul 10, 2017 at 15:00
  • 1
    Ha, we've been searching all day yesterday why IE11 tests wouldn't run for someone with a higher IE11 build than me. Where did you get this information?
    – FDM
    Jul 12, 2017 at 5:41
  • 2
    This issue was already raised by someone on Github. You may search BUG-ID-#6511 & #6544 on Github. You can check on GitHub it will be great if you found any updates on this. github.com/seleniumhq/selenium-google-code-issue-archive/issues/…
    – Bharat Mane
    Jul 12, 2017 at 6:00
  • Yup....Thanks for the info. I have been facing this issue from last 3/4 months. When we get the update on this?? Jul 12, 2017 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.