diff --git a/dotnet/src/webdriver/Chromium/ChromiumDriver.cs b/dotnet/src/webdriver/Chromium/ChromiumDriver.cs
index e4378134e72d2..b8615ac15ef90 100644
--- a/dotnet/src/webdriver/Chromium/ChromiumDriver.cs
+++ b/dotnet/src/webdriver/Chromium/ChromiumDriver.cs
@@ -73,6 +73,16 @@ public ChromiumDriver(ChromiumDriverService service, ChromiumOptions options, Ti
this.AddCustomChromeCommand(SendChromeCommandWithResult, CommandInfo.PostCommand, "/session/{sessionId}/chromium/send_command_and_get_result");
}
+ ///
+ /// Initializes a new instance of the class
+ ///
+ /// An object which executes commands for the driver.
+ /// An object containing the desired capabilities of the browser.
+ protected ChromiumDriver(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
+ : base(commandExecutor, desiredCapabilities)
+ {
+ }
+
///
/// Gets or sets the responsible for detecting
/// sequences of keystrokes representing file paths and names.
diff --git a/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs b/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs
index 43d0bb15fcf43..bde56a04ef5e7 100644
--- a/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs
+++ b/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs
@@ -172,7 +172,7 @@ protected override string CommandLineArguments
///
/// Returns the Chromium driver filename for the currently running platform
///
- /// The name of the Chromium executable. Defaulit is "chromedriver".
+ /// The name of the Chromium executable. Default is "chromedriver".
/// The file name of the Chromium driver service executable.
protected static string ChromiumDriverServiceFileName(string fileName = DefaultChromeDriverServiceExecutableName)
{
diff --git a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs
index e32b504cfc4e4..29b1a8cee9b2a 100644
--- a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs
+++ b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs
@@ -561,6 +561,8 @@ public override ICapabilities ToCapabilities()
IWritableCapabilities capabilities = this.GenerateDesiredCapabilities(false);
capabilities.SetCapability(this.CapabilityName, chromeOptions);
+ AddVendorSpecificChromiumCapabilities(capabilities);
+
Dictionary loggingPreferences = this.GenerateLoggingPreferencesDictionary();
if (loggingPreferences != null)
{
@@ -570,6 +572,8 @@ public override ICapabilities ToCapabilities()
return capabilities.AsReadOnly();
}
+ protected virtual void AddVendorSpecificChromiumCapabilities(IWritableCapabilities capabilities) { }
+
private Dictionary BuildChromeOptionsDictionary()
{
Dictionary chromeOptions = new Dictionary();
diff --git a/dotnet/src/webdriver/Edge/EdgeDriver.cs b/dotnet/src/webdriver/Edge/EdgeDriver.cs
index 0da8d7ed29d8a..d3741e1cada22 100644
--- a/dotnet/src/webdriver/Edge/EdgeDriver.cs
+++ b/dotnet/src/webdriver/Edge/EdgeDriver.cs
@@ -40,7 +40,7 @@ public EdgeDriver()
///
/// The to be used with the Edge driver.
public EdgeDriver(EdgeOptions options)
- : this(EdgeDriverService.CreateDefaultService(), options)
+ : this(EdgeDriverService.CreateDefaultServiceFromOptions(options), options)
{
}
@@ -49,15 +49,15 @@ public EdgeDriver(EdgeOptions options)
///
/// The used to initialize the driver.
public EdgeDriver(EdgeDriverService service)
- : this(service, new EdgeOptions())
+ : this(service, new EdgeOptions() { UseChromium = service.UsingChromium })
{
}
///
/// Initializes a new instance of the class using the specified path
- /// to the directory containing EdgeDriver.exe.
+ /// to the directory containing the WebDriver executable.
///
- /// The full path to the directory containing EdgeDriver.exe.
+ /// The full path to the directory containing the WebDriver executable.
public EdgeDriver(string edgeDriverDirectory)
: this(edgeDriverDirectory, new EdgeOptions())
{
@@ -65,9 +65,9 @@ public EdgeDriver(string edgeDriverDirectory)
///
/// Initializes a new instance of the class using the specified path
- /// to the directory containing EdgeDriver.exe and options.
+ /// to the directory containing the WebDriver executable and options.
///
- /// The full path to the directory containing EdgeDriver.exe.
+ /// The full path to the directory containing the WebDriver executable.
/// The to be used with the Edge driver.
public EdgeDriver(string edgeDriverDirectory, EdgeOptions options)
: this(edgeDriverDirectory, options, RemoteWebDriver.DefaultCommandTimeout)
@@ -76,13 +76,13 @@ public EdgeDriver(string edgeDriverDirectory, EdgeOptions options)
///
/// Initializes a new instance of the class using the specified path
- /// to the directory containing EdgeDriver.exe, options, and command timeout.
+ /// to the directory containing the WebDriver executable, options, and command timeout.
///
- /// The full path to the directory containing EdgeDriver.exe.
+ /// The full path to the directory containing the WebDriver executable.
/// The to be used with the Edge driver.
/// The maximum amount of time to wait for each command.
public EdgeDriver(string edgeDriverDirectory, EdgeOptions options, TimeSpan commandTimeout)
- : this(EdgeDriverService.CreateDefaultService(edgeDriverDirectory), options, commandTimeout)
+ : this(EdgeDriverService.CreateDefaultServiceFromOptions(edgeDriverDirectory, options), options, commandTimeout)
{
}
@@ -104,9 +104,30 @@ public EdgeDriver(EdgeDriverService service, EdgeOptions options)
/// The to be used with the Edge driver.
/// The maximum amount of time to wait for each command.
public EdgeDriver(EdgeDriverService service, EdgeOptions options, TimeSpan commandTimeout)
- : base(service, options, commandTimeout)
+ : base(new DriverServiceCommandExecutor(service, commandTimeout), ConvertOptionsToCapabilities(options, service.UsingChromium))
{
}
+ private static ICapabilities ConvertOptionsToCapabilities(EdgeOptions options, bool serviceUsingChromium)
+ {
+ if (options == null)
+ {
+ throw new ArgumentNullException("options", "options must not be null");
+ }
+
+ if (serviceUsingChromium != options.UseChromium)
+ {
+ if (serviceUsingChromium)
+ {
+ throw new WebDriverException("options.UseChromium must be set to true when using an Edge Chromium driver service.");
+ }
+ else
+ {
+ throw new WebDriverException("options.UseChromium must be set to false when using an Edge Legacy driver service.");
+ }
+ }
+
+ return options.ToCapabilities();
+ }
}
}
diff --git a/dotnet/src/webdriver/Edge/EdgeDriverService.cs b/dotnet/src/webdriver/Edge/EdgeDriverService.cs
index 829b5fa53af23..9cc8e154b94b9 100644
--- a/dotnet/src/webdriver/Edge/EdgeDriverService.cs
+++ b/dotnet/src/webdriver/Edge/EdgeDriverService.cs
@@ -31,12 +31,16 @@ public sealed class EdgeDriverService : ChromiumDriverService
{
private const string MicrosoftWebDriverServiceFileName = "MicrosoftWebDriver.exe";
private const string MSEdgeDriverServiceFileName = "msedgedriver";
+
private static readonly Uri MicrosoftWebDriverDownloadUrl = new Uri("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/");
+
+ // Engine switching
+ private readonly bool usingChromium;
+
+ // Legacy properties
private string host;
private string package;
- private bool useVerboseLogging;
private bool? useSpecCompliantProtocol;
- private bool isLegacy;
///
/// Initializes a new instance of the class.
@@ -44,95 +48,51 @@ public sealed class EdgeDriverService : ChromiumDriverService
/// The full path to the EdgeDriver executable.
/// The file name of the EdgeDriver executable.
/// The port on which the EdgeDriver executable should listen.
- /// Whether to use legacy mode to launch Edge.
- private EdgeDriverService(string executablePath, string executableFileName, int port, bool isLegacy)
+ /// Whether to use the Legacy or Chromium EdgeDriver executable.
+ private EdgeDriverService(string executablePath, string executableFileName, int port, bool usingChromium)
: base(executablePath, executableFileName, port, MicrosoftWebDriverDownloadUrl)
{
- this.isLegacy = isLegacy;
+ this.usingChromium = usingChromium;
+ }
+
+ ///
+ /// Gets a value indicating whether the driver service is using Edge Chromium.
+ ///
+ public bool UsingChromium
+ {
+ get { return this.usingChromium; }
}
///
/// Gets or sets the value of the host adapter on which the Edge driver service should listen for connections.
- /// The property only exists in legacy mode.
///
public string Host
{
- get
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("Host property does not exist");
- }
-
- return this.host;
- }
- set
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("Host property does not exist");
- }
-
- this.host = value;
- }
+ get { return this.host; }
+ set { this.host = value; }
}
///
/// Gets or sets the value of the package the Edge driver service will launch and automate.
- /// The property only exists in legacy mode.
///
public string Package
{
- get
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("Package property does not exist");
- }
-
- return this.package;
- }
- set
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("Package property does not exist");
- }
-
- this.package = value;
- }
+ get { return this.package; }
+ set { this.package = value; }
}
///
/// Gets or sets a value indicating whether the service should use verbose logging.
- /// The property only exists in legacy mode.
///
public bool UseVerboseLogging
{
- get
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("UseVerboseLogging property does not exist");
- }
-
- return this.useVerboseLogging;
- }
- set
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("UseVerboseLogging property does not exist");
- }
-
- this.useVerboseLogging = value;
- }
+ get { return this.EnableVerboseLogging; }
+ set { this.EnableVerboseLogging = value; }
}
///
/// Gets or sets a value indicating whether the instance
- /// should use a protocol dialect compliant with the W3C WebDriver Specification.
- /// The property only exists in legacy mode.
+ /// should use the a protocol dialect compliant with the W3C WebDriver Specification.
///
///
/// Setting this property to a non- value for driver
@@ -144,24 +104,8 @@ public bool UseVerboseLogging
///
public bool? UseSpecCompliantProtocol
{
- get
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("UseSpecCompliantProtocol property does not exist");
- }
-
- return this.useSpecCompliantProtocol;
- }
- set
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("UseSpecCompliantProtocol property does not exist");
- }
-
- this.useSpecCompliantProtocol = value;
- }
+ get { return this.useSpecCompliantProtocol; }
+ set { this.useSpecCompliantProtocol = value; }
}
///
@@ -172,7 +116,7 @@ protected override bool HasShutdown
{
get
{
- if (!this.isLegacy || (this.useSpecCompliantProtocol.HasValue && !this.useSpecCompliantProtocol.Value))
+ if (this.usingChromium || (this.useSpecCompliantProtocol.HasValue && !this.useSpecCompliantProtocol.Value))
{
return base.HasShutdown;
}
@@ -192,7 +136,7 @@ protected override TimeSpan TerminationTimeout
// gets us to the termination point much faster.
get
{
- if (!this.isLegacy || (this.useSpecCompliantProtocol.HasValue && !this.useSpecCompliantProtocol.Value))
+ if (this.usingChromium || (this.useSpecCompliantProtocol.HasValue && !this.useSpecCompliantProtocol.Value))
{
return base.TerminationTimeout;
}
@@ -208,12 +152,15 @@ protected override string CommandLineArguments
{
get
{
- if (!this.isLegacy)
- {
- return base.CommandLineArguments;
- }
+ return this.usingChromium ? base.CommandLineArguments : LegacyCommandLineArguments;
+ }
+ }
- StringBuilder argsBuilder = new StringBuilder(base.CommandLineArguments);
+ private string LegacyCommandLineArguments
+ {
+ get
+ {
+ StringBuilder argsBuilder = new StringBuilder(string.Format(CultureInfo.InvariantCulture, "--port={0}", this.Port));
if (!string.IsNullOrEmpty(this.host))
{
argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " --host={0}", this.host));
@@ -224,7 +171,7 @@ protected override string CommandLineArguments
argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " --package={0}", this.package));
}
- if (this.useVerboseLogging)
+ if (this.UseVerboseLogging)
{
argsBuilder.Append(" --verbose");
}
@@ -250,63 +197,138 @@ protected override string CommandLineArguments
}
}
+ ///
+ /// Creates an instance of the EdgeDriverService for Edge Chromium.
+ ///
+ /// A EdgeDriverService that implements default settings.
+ public static EdgeDriverService CreateChromiumService()
+ {
+ return CreateDefaultServiceFromOptions(new EdgeOptions() { UseChromium = true });
+ }
+
+ ///
+ /// Creates an instance of the EdgeDriverService for Edge Chromium using a specified path to the WebDriver executable.
+ ///
+ /// The directory containing the WebDriver executable.
+ /// A EdgeDriverService using a random port.
+ public static EdgeDriverService CreateChromiumService(string driverPath)
+ {
+ return CreateDefaultServiceFromOptions(driverPath, EdgeDriverServiceFileName(true), new EdgeOptions() { UseChromium = true });
+ }
+
+ ///
+ /// Creates an instance of the EdgeDriverService for Edge Chromium using a specified path to the WebDriver executable with the given name.
+ ///
+ /// The directory containing the WebDriver executable.
+ /// The name of the WebDriver executable file.
+ /// A EdgeDriverService using a random port.
+ public static EdgeDriverService CreateChromiumService(string driverPath, string driverExecutableFileName)
+ {
+ return CreateDefaultServiceFromOptions(driverPath, driverExecutableFileName, new EdgeOptions() { UseChromium = true });
+ }
+
+ ///
+ /// Creates an instance of the EdgeDriverService for Edge Chromium using a specified path to the WebDriver executable with the given name and listening port.
+ ///
+ /// The directory containing the WebDriver executable.
+ /// The name of the WebDriver executable file
+ /// The port number on which the driver will listen
+ /// A EdgeDriverService using the specified port.
+ public static EdgeDriverService CreateChromiumService(string driverPath, string driverExecutableFileName, int port)
+ {
+ return CreateDefaultServiceFromOptions(driverPath, driverExecutableFileName, port, new EdgeOptions() { UseChromium = true });
+ }
+
+
///
/// Creates a default instance of the EdgeDriverService.
///
- /// Whether to use legacy mode. Default is to true.
/// A EdgeDriverService that implements default settings.
- public static EdgeDriverService CreateDefaultService(bool isLegacy = true)
+ public static EdgeDriverService CreateDefaultService()
{
- string serviceFileName = ChromiumDriverServiceFileName(MSEdgeDriverServiceFileName);
- if (isLegacy)
- {
- serviceFileName = MicrosoftWebDriverServiceFileName;
- }
+ return CreateDefaultServiceFromOptions(new EdgeOptions());
+ }
- string serviceDirectory = DriverService.FindDriverServiceExecutable(serviceFileName, MicrosoftWebDriverDownloadUrl);
- EdgeDriverService service = CreateDefaultService(serviceDirectory, isLegacy);
- return service;
+ ///
+ /// Creates a default instance of the EdgeDriverService using a specified path to the WebDriver executable.
+ ///
+ /// The directory containing the WebDriver executable.
+ /// A EdgeDriverService using a random port.
+ public static EdgeDriverService CreateDefaultService(string driverPath)
+ {
+ return CreateDefaultServiceFromOptions(driverPath, EdgeDriverServiceFileName(false), new EdgeOptions());
}
///
- /// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable.
+ /// Creates a default instance of the EdgeDriverService using a specified path to the WebDriver executable with the given name.
///
- /// The directory containing the EdgeDriver executable.
- /// Whether to use legacy mode. Default is to true.
+ /// The directory containing the WebDriver executable.
+ /// The name of the WebDriver executable file.
/// A EdgeDriverService using a random port.
- public static EdgeDriverService CreateDefaultService(string driverPath, bool isLegacy = true)
+ public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName)
{
- string serviceFileName = ChromiumDriverServiceFileName(MSEdgeDriverServiceFileName);
- if (isLegacy)
- {
- serviceFileName = MicrosoftWebDriverServiceFileName;
- }
+ return CreateDefaultServiceFromOptions(driverPath, driverExecutableFileName, new EdgeOptions());
+ }
- return CreateDefaultService(driverPath, serviceFileName, isLegacy);
+ ///
+ /// Creates a default instance of the EdgeDriverService using a specified path to the WebDriver executable with the given name and listening port.
+ ///
+ /// The directory containing the WebDriver executable.
+ /// The name of the WebDriver executable file
+ /// The port number on which the driver will listen
+ /// A EdgeDriverService using the specified port.
+ public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName, int port)
+ {
+ return CreateDefaultServiceFromOptions(driverPath, driverExecutableFileName, port, new EdgeOptions());
}
- ///
- /// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable with the given name.
+
+ ///
+ /// Creates a default instance of the EdgeDriverService.
///
- /// The directory containing the EdgeDriver executable.
- /// The name of the EdgeDriver executable file.
+ /// A EdgeDriverService that implements default settings.
+ public static EdgeDriverService CreateDefaultServiceFromOptions(EdgeOptions options)
+ {
+ string serviceDirectory = DriverService.FindDriverServiceExecutable(EdgeDriverServiceFileName(options.UseChromium), MicrosoftWebDriverDownloadUrl);
+ return CreateDefaultServiceFromOptions(serviceDirectory, options);
+ }
+
+ ///
+ /// Creates a default instance of the EdgeDriverService using a specified path to the WebDriver executable.
+ ///
+ /// The directory containing the WebDriver executable.
+ /// A EdgeDriverService using a random port.
+ public static EdgeDriverService CreateDefaultServiceFromOptions(string driverPath, EdgeOptions options)
+ {
+ return CreateDefaultServiceFromOptions(driverPath, EdgeDriverServiceFileName(options.UseChromium), options);
+ }
+
+ ///
+ /// Creates a default instance of the EdgeDriverService using a specified path to the WebDriver executable with the given name.
+ ///
+ /// The directory containing the WebDriver executable.
+ /// The name of the WebDriver executable file.
/// A EdgeDriverService using a random port.
- public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName, bool isLegacy = true)
+ public static EdgeDriverService CreateDefaultServiceFromOptions(string driverPath, string driverExecutableFileName, EdgeOptions options)
{
- return CreateDefaultService(driverPath, driverExecutableFileName, PortUtilities.FindFreePort(), isLegacy);
+ return CreateDefaultServiceFromOptions(driverPath, driverExecutableFileName, PortUtilities.FindFreePort(), options);
}
///
- /// Creates a default instance of the EdgeDriverService using a specified path to the EdgeDriver executable with the given name and listening port.
+ /// Creates a default instance of the EdgeDriverService using a specified path to the WebDriver executable with the given name and listening port.
///
- /// The directory containing the EdgeDriver executable.
- /// The name of the EdgeDriver executable file
+ /// The directory containing the WebDriver executable.
+ /// The name of the WebDriver executable file
/// The port number on which the driver will listen
- /// Wheter to use legacy mode. Default is to true.
/// A EdgeDriverService using the specified port.
- public static EdgeDriverService CreateDefaultService(string driverPath, string driverExecutableFileName, int port, bool isLegacy = true)
+ public static EdgeDriverService CreateDefaultServiceFromOptions(string driverPath, string driverExecutableFileName, int port, EdgeOptions options)
+ {
+ return new EdgeDriverService(driverPath, driverExecutableFileName, port, options.UseChromium);
+ }
+
+ private static string EdgeDriverServiceFileName(bool useChromium)
{
- return new EdgeDriverService(driverPath, driverExecutableFileName, port, isLegacy);
+ return useChromium ? ChromiumDriverServiceFileName(MSEdgeDriverServiceFileName) : MicrosoftWebDriverServiceFileName;
}
}
}
diff --git a/dotnet/src/webdriver/Edge/EdgeOptions.cs b/dotnet/src/webdriver/Edge/EdgeOptions.cs
index 07e201691ff16..48139cc1d86a1 100644
--- a/dotnet/src/webdriver/Edge/EdgeOptions.cs
+++ b/dotnet/src/webdriver/Edge/EdgeOptions.cs
@@ -46,49 +46,44 @@ namespace OpenQA.Selenium.Edge
public class EdgeOptions : ChromiumOptions
{
private const string DefaultBrowserNameValue = "MicrosoftEdge";
+ private const string WebViewBrowserNameValue = "WebView2";
+
+ // Engine switching
+ private const string UseChromiumCapability = "ms:edgeChromium";
+ private bool useChromium = false;
+
+ private const string EdgeOptionsCapabilityName = "edgeOptions";
+
+ // Edge Legacy options
private const string UseInPrivateBrowsingCapability = "ms:inPrivate";
private const string ExtensionPathsCapability = "ms:extensionPaths";
private const string StartPageCapability = "ms:startPage";
- private const string EdgeOptionsCapabilityName = "edgeOptions";
-
- private static readonly string[] ChromiumCapabilityNames = { "goog:chromeOptions", "se:forceAlwaysMatch", "args",
- "binary", "extensions", "localState", "prefs", "detach", "debuggerAddress", "excludeSwitches", "minidumpPath",
- "mobileEmulation", "perfLoggingPrefs", "windowTypes", "w3c"};
- private readonly string browserName;
private bool useInPrivateBrowsing;
private string startPage;
private List extensionPaths = new List();
- private bool isLegacy;
+
+ // Additional Edge-specific Chromium options
+ private bool useWebView;
///
/// Initializes a new instance of the class.
///
- public EdgeOptions() : this(true)
+ public EdgeOptions()
{
+ this.AddKnownCapabilityName(UseChromiumCapability, "UseChromium property");
+ this.AddKnownCapabilityName(UseInPrivateBrowsingCapability, "UseInPrivateBrowsing property");
+ this.AddKnownCapabilityName(StartPageCapability, "StartPage property");
+ this.AddKnownCapabilityName(ExtensionPathsCapability, "AddExtensionPaths method");
}
///
- /// Create an EdgeOptions for Chromium-based Edge.
+ /// Gets or sets a value indicating whether to launch Edge Chromium. Defaults to using Edge Legacy.
///
- /// Whether to use Legacy Mode. If so, remove all Chromium Capabilities.
- /// The name of the browser to use. Defaults to "MicrosoftEdge".
- public EdgeOptions(bool isLegacy, string browserName = DefaultBrowserNameValue)
+ public bool UseChromium
{
- this.isLegacy = isLegacy;
- this.browserName = browserName;
-
- if (this.isLegacy)
- {
- foreach (string capabilityName in ChromiumCapabilityNames)
- {
- this.RemoveKnownCapabilityName(capabilityName);
- }
-
- this.AddKnownCapabilityName(UseInPrivateBrowsingCapability, "UseInPrivateBrowsing property");
- this.AddKnownCapabilityName(StartPageCapability, "StartPage property");
- this.AddKnownCapabilityName(ExtensionPathsCapability, "AddExtensionPaths method");
- }
+ get { return this.useChromium; }
+ set { this.useChromium = value; }
}
///
@@ -96,7 +91,7 @@ public EdgeOptions(bool isLegacy, string browserName = DefaultBrowserNameValue)
///
protected override string BrowserNameValue
{
- get { return browserName; }
+ get { return UseWebView ? WebViewBrowserNameValue : DefaultBrowserNameValue; }
}
///
@@ -117,54 +112,23 @@ public override string CapabilityName
}
///
- /// Gets or sets the location of the Edge browser's binary executable file.
+ /// Gets or sets whether to create a WebView session used for launching an Edge (Chromium) WebView-based app on desktop.
///
- public new string BinaryLocation
+ public bool UseWebView
{
- get
- {
- if (this.isLegacy)
- {
- throw new ArgumentException("BinaryLocation does not exist in Legacy Edge");
- }
-
- return base.BinaryLocation;
- }
- set
- {
- if (this.isLegacy)
- {
- throw new ArgumentException("BinaryLocation does not exist in Legacy Edge");
- }
-
- base.BinaryLocation = value;
- }
+ get { return this.useWebView; }
+ set { this.useWebView = value; }
}
+
///
/// Gets or sets a value indicating whether the browser should be launched using
/// InPrivate browsing.
///
public bool UseInPrivateBrowsing
{
- get
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("UseInPrivateBrowsing property does not exist in Chromium Edge");
- }
-
- return this.useInPrivateBrowsing;
- }
- set
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("UseInPrivateBrowsing property does not exist in Chromium Edge");
- }
-
- this.useInPrivateBrowsing = value;
- }
+ get { return this.useInPrivateBrowsing; }
+ set { this.useInPrivateBrowsing = value; }
}
///
@@ -172,37 +136,16 @@ public bool UseInPrivateBrowsing
///
public string StartPage
{
- get
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("StartPage property does not exist in Chromium Edge");
- }
-
- return this.startPage;
- }
- set
- {
- if (!this.isLegacy)
- {
- throw new ArgumentException("StartPage property does not exist in Chromium Edge");
- }
-
- this.startPage = value;
- }
+ get { return this.startPage; }
+ set { this.startPage = value; }
}
///
- /// Adds a path to an extension that is to be used with the Edge driver.
+ /// Adds a path to an extension that is to be used with the Edge Legacy driver.
///
/// The full path and file name of the extension.
public void AddExtensionPath(string extensionPath)
{
- if (!this.isLegacy)
- {
- throw new ArgumentException("Property does not exist in Chromium Edge", "extensionPath");
- }
-
if (string.IsNullOrEmpty(extensionPath))
{
throw new ArgumentException("extensionPath must not be null or empty", "extensionPath");
@@ -212,30 +155,20 @@ public void AddExtensionPath(string extensionPath)
}
///
- /// Adds a list of paths to an extensions that are to be used with the Edge driver.
+ /// Adds a list of paths to an extensions that are to be used with the Edge Legacy driver.
///
/// An array of full paths with file names of extensions to add.
public void AddExtensionPaths(params string[] extensionPathsToAdd)
{
- if (!this.isLegacy)
- {
- throw new ArgumentException("Property does not exist in Chromium Edge", "extensionPathsToAdd");
- }
-
this.AddExtensionPaths(new List(extensionPathsToAdd));
}
///
- /// Adds a list of paths to an extensions that are to be used with the Edge driver.
+ /// Adds a list of paths to an extensions that are to be used with the Edge Legacy driver.
///
/// An of full paths with file names of extensions to add.
public void AddExtensionPaths(IEnumerable extensionPathsToAdd)
{
- if (!this.isLegacy)
- {
- throw new ArgumentException("Property does not exist in Chromium Edge", "extensionPathsToAdd");
- }
-
if (extensionPathsToAdd == null)
{
throw new ArgumentNullException("extensionPathsToAdd", "extensionPathsToAdd must not be null");
@@ -252,12 +185,23 @@ public void AddExtensionPaths(IEnumerable extensionPathsToAdd)
/// The DesiredCapabilities for Edge with these options.
public override ICapabilities ToCapabilities()
{
- if (!this.isLegacy)
- {
- return base.ToCapabilities();
- }
+ return this.useChromium ? ToChromiumCapabilities() : ToLegacyCapabilities();
+ }
+
+ protected override void AddVendorSpecificChromiumCapabilities(IWritableCapabilities capabilities)
+ {
+ capabilities.SetCapability(EdgeOptions.UseChromiumCapability, this.useChromium);
+ }
+
+ private ICapabilities ToChromiumCapabilities()
+ {
+ return base.ToCapabilities();
+ }
+ private ICapabilities ToLegacyCapabilities()
+ {
IWritableCapabilities capabilities = this.GenerateDesiredCapabilities(true);
+ capabilities.SetCapability(EdgeOptions.UseChromiumCapability, this.useChromium);
if (this.useInPrivateBrowsing)
{
diff --git a/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs b/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs
index c724b3597add1..b47bcc03e4073 100644
--- a/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs
+++ b/dotnet/test/common/CustomDriverConfigs/DevChannelEdgeDriver.cs
@@ -22,14 +22,20 @@ public DevChannelEdgeDriver(EdgeDriverService service, EdgeOptions options)
public static EdgeOptions DefaultOptions
{
- get { return new EdgeOptions(false) { BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe" }; }
+ get {
+ return new EdgeOptions()
+ {
+ UseChromium = true,
+ BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe"
+ };
+ }
}
public static EdgeDriverService DefaultService
{
get
{
- EdgeDriverService service = EdgeDriverService.CreateDefaultService(ServicePath, false);
+ EdgeDriverService service = EdgeDriverService.CreateChromiumService(ServicePath);
return service;
}
}