How to get multiple login instances working in Internet Explorer?

Am working on a banking application. Our requirement is to execute tests in parallel in one system.

A) Below is how our application responds to selenium parallel execution :-

• Does not allow multiple logins in IE

• Allows multiple logins in chrome and FF [During automation we create new profile every time, so I presume that selenium creates new browser profile every time ]

We are able to execute tests in parallel using firefox and chrome without any session issues.But while executing on IE our application logs out from the second instance automatically.. I have tried launching IE in private mode using below IE capabilities , But still facing problem in IE

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true);
сapabilities.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");
InternetExplorerDriver driver = new InternetExplorerDriver(capabilities);


Manually if you launch two IE in private mode with two different logins, it is working fine, Am getting issue only when automating via selenium.

We are using our inhouse framework for running multiple instance. we are not using testng or other unit testing frameworks

Please let me know if you need more details..

EDIT:-

Below link says lot about how to design application not to share sessions between tabs...But I did not found any solution for my issue..

https://social.msdn.microsoft.com/Forums/ie/en-US/bcd9b000-8c14-4d91-9aac-3e258a11557d/how-to-prevent-session-sharing-across-ie-tabs?forum=iewebdevelopment

• fyi in other browsers subsequent incognite/private windows still share cookies with the first incognito window. Many folks don't realize this. It probably has to be this was so that pop-ups and page transitions still work correctly. u may start incognito but if you use a system with a login, it will need to remember you, even in the incognito session. The assurance is that it is not a different session and can only be one. – Michael Durrant Jan 27 '17 at 14:54

If I remember correctly, IE shares cookies even in in-private mode.

Caveat: Mac user currently, and I have not touched IE for some time. You might want to check that with this site.

Maybe this will help

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
InternetExplorerDriver driver = new InternetExplorerDriver(capabilities);

• How does this help? – IAmMilinPatel Feb 9 '17 at 2:49
• Thanks Frederik, I have tried all straight forward solutions :) Is there any hack we can do? – TechDog Feb 9 '17 at 6:33

Try using something like this (it's Ruby code but presumably you can adapt to your Java language):

before(:each) do
caps = Selenium::WebDriver::Remote::Capabilities..internet_explorer('ie.ensureCleanSession' => true, 'ie.browserCommandLineSwitches' => 'private')
@driver = Selenium::WebDriver.for(:internet_explorer, :desired_capabilities => caps)
@driver.manage.window.maximize
@base_url = "https://www.example.com/"