I have written the below code for IE
System.setProperty("webdriver.ie.driver", pathOfDriver + "IEDriverServer.exe");
DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
cap.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
cap.setCapability(InternetExplorerDriver.FORCE_CREATE_PROCESS, true);
cap.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");
driver = new InternetExplorerDriver(cap);
And for Edge:
System.setProperty("webdriver.edge.driver", pathOfDriver + "MicrosoftWebDriver.exe");
EdgeOptions options = new EdgeOptions();
options.AddAdditionalCapability("InPrivate", true);
driver = new EdgeDriver();
But none of them is working. Can someone help me resolve the issue
Thanks
Instructor
Ashish Thakur Replied on 09/01/2019
Please refer this
https://stackoverflow.com/questions/33224070/how-to-open-incognito-private-window-with-selenium-wd-for-different-browser-type