Private and Incognito Mode
Selenium can open the browsers in Private mode.
In order to open the browser in private mode, use the Desired Capabilities applicable to the browser.
Chrome
DesiredCapabilities dc = new DesiredCapabilities();
// ...
ChromeOptions options = new ChromeOptions();
options.addArguments("--incognito");
dc.setCapability("goog:chromeOptions", options);
RemoteWebDriver driver = new RemoteWebDriver(new URL(URL), dc);
Firefox
DesiredCapabilities dc = new DesiredCapabilities();
// ...
FirefoxOptions options = new FirefoxOptions();
options.addArguments("--private");
dc.setCapability("moz:firefoxOptions",options);
RemoteWebDriver driver = new RemoteWebDriver(new URL(URL), dc);
Microsoft Edge
DesiredCapabilities dc = new DesiredCapabilities();
// ...
Map<String, Object> edgeOptions = new HashMap<>();
edgeOptions.put("args", ImmutableList.of("-inprivate"));
dc.setCapability("ms:edgeOptions", edgeOptions);
RemoteWebDriver driver = new RemoteWebDriver(new URL(URL), dc);