0

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"); 
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);
  • @ 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 '17 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 '17 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 '17 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 '17 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?? – Michael Roy Jul 12 '17 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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