Is there any way how to run Selenium automation test in Internet Explorer 9 in InPrivate mode with IEDriverServer?
I need to test 2 (two) testcases:
1. browser is closed. Open one window of IE InPrivate mode. Run test.
2. browser is opened in normal mode. Open new window of IE InPrivate mode. Run test.
How should JAVA code look for this tests?
Thank you
Since Selenium gives the option of running our tests in multiple browsers, Selenium with IE browser blending can be used to test any application. IE has a driver, which creates a connection between Selenium WebDriver and IE. and then executes the Selenium tests on Internet Explorer.
There are two main ways to execute our selenium Test in Incognito Mode for Chrome Browser. v Right Click on Google Chrome and Select Properties. v In the “Target' field add an –incognito to the end of the program path. v Our incognito browser is now ready for execution.
We can perform Selenium testing without a browser. This is achieved by triggering the execution in a headless mode. The headless execution can decrease the utilization of key resources and is being adopted widely.
public void openBrowserInPrivacyMode(boolean isBrowserActive) {
System.setProperty("webdriver.ie.driver", "path/to/IEDriverServer_x32.exe");
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true);
сapabilities.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");
InternetExplorerDriver driver = new InternetExplorerDriver(capabilities);
@Roman's solution is now deprecated.
The new way to do this is as follows:
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true);
ieOptions.addCommandSwitches("-private");
InternetExplorerDriver driver = InternetExplorerDriver(ieOptions));
Also, I had problems doing this, until I set a TabProcGrowth registry value. Before doing this I got the following exception:
org.openqa.selenium.SessionNotCreatedException: 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
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\TabProcGrowth must be '0'.
I had this with happening with Windows 10 and Selenium 3.14. Curiously enough, setting the TabProcGrowth value also fixed this for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With