1

From the C# object model, it looks like this should do the trick, but the UseInPrivateBrowsing property has no effect at my end. Just opens a regular browser session in the edge.

var options = new EdgeOptions();
options.UseInPrivateBrowsing = true;
var driver = new EdgeDriver(options);

I am using the latest Selenium.WebDriver.MicrosoftDriver.

These are the installed packages:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="NUnit" version="3.10.1" targetFramework="net47" />
  <package id="NUnit3TestAdapter" version="3.10.0" targetFramework="net47" />
  <package id="Selenium.Chrome.WebDriver" version="2.40" targetFramework="net47" />
  <package id="Selenium.Support" version="3.13.0" targetFramework="net47" />
  <package id="Selenium.WebDriver" version="3.13.0" targetFramework="net47" />
  <package id="Selenium.WebDriver.MicrosoftDriver" version="17.17134.0" targetFramework="net47" />
</packages>

How is this supposed to be done?

Keyur Ramoliya
  • 1,900
  • 2
  • 16
  • 17
Oddleif
  • 751
  • 3
  • 9
  • 35

2 Answers2

2

The UseInPrivateBrowsing property will only work for versions of the driver for Microsoft Edge that support the W3C WebDriver Specification. Unfortunately, these versions of the driver are only available in Windows Insider builds at the moment. Once a version of the driver is released to widely available versions of Windows 10, this property will work everywhere for Edge.

JimEvans
  • 27,201
  • 7
  • 83
  • 108
0

Until UseInPrivateBrowsing works, you could try replacing just that line with:

options.AddArgument("inprivate");

that allowed me to open up an "InPrivate" window using Selenium.WebDriver 4.0.0-beta4.

Brian Cryer
  • 2,126
  • 18
  • 18