I want to test my test cases in private window or incognito window.
How to do the same in various browsers:
How to achieve it?
Chrome:
DesiredCapabilities capabilities = DesiredCapabilities.chrome(); ChromeOptions options = new ChromeOptions(); options.addArguments("incognito"); capabilities.setCapability(ChromeOptions.CAPABILITY, options);
FireFox:
FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.setPreference("browser.privatebrowsing.autostart", true);
Internet Explorer:
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true); capabilities.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");
Opera:
DesiredCapabilities capabilities = DesiredCapabilities.operaBlink(); OperaOptions options = new OperaOptions(); options.addArguments("private"); capabilities.setCapability(OperaOptions.CAPABILITY, options);
1.4m articles
1.4m replys
5 comments
56.9k users