From f7fdfb64d80913583cab87add4436548b632f7d9 Mon Sep 17 00:00:00 2001 From: Brandon Walderman Date: Tue, 12 Oct 2021 23:46:21 -0700 Subject: [PATCH] Use vendor-specific method names for additional Chromium options. --- dotnet/src/webdriver/Chrome/ChromeOptions.cs | 20 +++++++++++++++++++ .../src/webdriver/Chromium/ChromiumOptions.cs | 10 +++++----- dotnet/src/webdriver/Edge/EdgeOptions.cs | 20 +++++++++++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/dotnet/src/webdriver/Chrome/ChromeOptions.cs b/dotnet/src/webdriver/Chrome/ChromeOptions.cs index ff503bf9dcc62..45c4d0ea28b1a 100644 --- a/dotnet/src/webdriver/Chrome/ChromeOptions.cs +++ b/dotnet/src/webdriver/Chrome/ChromeOptions.cs @@ -79,5 +79,25 @@ public override string CapabilityName { get { return string.Format(CultureInfo.InvariantCulture, "{0}:{1}", this.VendorPrefix, ChromeOptionsCapabilityName); } } + + /// + /// Provides a means to add additional capabilities not yet added as type safe options + /// for the Chrome driver. + /// + /// The name of the capability to add. + /// The value of the capability to add. + /// + /// thrown when attempting to add a capability for which there is already a type safe option, or + /// when is or the empty string. + /// + /// Calling + /// where has already been added will overwrite the + /// existing value with the new value in . + /// Calling this method adds capabilities to the Chrome-specific options object passed to + /// webdriver executable (property name 'goog:chromeOptions'). + public void AddAdditionalChromeOption(string optionName, object optionValue) + { + this.AddAdditionalChromiumOption(optionName, optionValue); + } } } diff --git a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs index 2188e74953659..5b7ca1137c811 100644 --- a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs +++ b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs @@ -495,12 +495,12 @@ public void AddWindowTypes(IEnumerable windowTypesToAdd) /// thrown when attempting to add a capability for which there is already a type safe option, or /// when is or the empty string. /// - /// Calling + /// Calling /// where has already been added will overwrite the /// existing value with the new value in . - /// Calling this method adds capabilities to the Chrome-specific options object passed to - /// webdriver executable (property name 'goog:chromeOptions'). - public void AddAdditionalChromeOption(string optionName, object optionValue) + /// Calling this method adds capabilities to the Chromium-specific options object passed to + /// webdriver executable (e.g. property name 'goog:chromeOptions'). + protected void AddAdditionalChromiumOption(string optionName, object optionValue) { this.ValidateCapabilityName(optionName); this.additionalChromeOptions[optionName] = optionValue; @@ -554,7 +554,7 @@ public void AddAdditionalCapability(string capabilityName, object capabilityValu } else { - this.AddAdditionalChromeOption(capabilityName, capabilityValue); + this.AddAdditionalChromiumOption(capabilityName, capabilityValue); } } diff --git a/dotnet/src/webdriver/Edge/EdgeOptions.cs b/dotnet/src/webdriver/Edge/EdgeOptions.cs index 7e0776686a843..1da8e466abdb7 100644 --- a/dotnet/src/webdriver/Edge/EdgeOptions.cs +++ b/dotnet/src/webdriver/Edge/EdgeOptions.cs @@ -82,5 +82,25 @@ public bool UseWebView get { return this.BrowserName == WebViewBrowserNameValue; } set { this.BrowserName = value ? WebViewBrowserNameValue : DefaultBrowserNameValue; } } + + /// + /// Provides a means to add additional capabilities not yet added as type safe options + /// for the Edge driver. + /// + /// The name of the capability to add. + /// The value of the capability to add. + /// + /// thrown when attempting to add a capability for which there is already a type safe option, or + /// when is or the empty string. + /// + /// Calling + /// where has already been added will overwrite the + /// existing value with the new value in . + /// Calling this method adds capabilities to the Edge-specific options object passed to + /// webdriver executable (property name 'ms:edgeOptions'). + public void AddAdditionalEdgeOption(string optionName, object optionValue) + { + this.AddAdditionalChromiumOption(optionName, optionValue); + } } }