简体   繁体   中英

How to launch Microsoft Edge in InPrivate with Selenium WebDriver and Java

I need help with launching Edge in InPrivate mode with Selenium and Java. I am not using Robot framework so cannot use the below solution: Open Edge in InPrivate mode using Selenium

Also I tried the other solutions suggested by this solution, it did not work: How to start Edge browser in Incognito mode using selenium remote webdriver?

So, not sure if there are any other solutions to it.

A bit late to the party, but this answer helped me. Namely,

EdgeOptions options = new EdgeOptions();
options.AddAdditionalCapability("InPrivate", true);
this.edgeDriver = new EdgeDriver(options);

FYI, there's also a EdgeOptions property called UseInPrivateBrowsing (at least in C#). Setting this flag to true only works for Microsoft Edge browsers that support the "W3C WebDriver Specification", according to this post.

For Firefox driver works:

driver.switchTo().window("");

For Edge should be the same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM