diff --git a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs index 4030840dab6e0..b7145a028f5a6 100644 --- a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs +++ b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs @@ -55,29 +55,6 @@ public abstract class ChromiumOptions : DriverOptions private string? mobileEmulationDeviceName; private ChromiumMobileEmulationDeviceSettings? mobileEmulationDeviceSettings; - /// - /// Initializes a new instance of the class. - /// - public ChromiumOptions() : base() - { - this.AddKnownCapabilityName(this.CapabilityName, "current ChromiumOptions class instance"); - this.AddKnownCapabilityName(CapabilityType.LoggingPreferences, "SetLoggingPreference method"); - this.AddKnownCapabilityName(this.LoggingPreferencesChromeOption, "SetLoggingPreference method"); - this.AddKnownCapabilityName(ChromiumOptions.ArgumentsChromeOption, "AddArguments method"); - this.AddKnownCapabilityName(ChromiumOptions.BinaryChromeOption, "BinaryLocation property"); - this.AddKnownCapabilityName(ChromiumOptions.ExtensionsChromeOption, "AddExtensions method"); - this.AddKnownCapabilityName(ChromiumOptions.LocalStateChromeOption, "AddLocalStatePreference method"); - this.AddKnownCapabilityName(ChromiumOptions.PreferencesChromeOption, "AddUserProfilePreference method"); - this.AddKnownCapabilityName(ChromiumOptions.DetachChromeOption, "LeaveBrowserRunning property"); - this.AddKnownCapabilityName(ChromiumOptions.DebuggerAddressChromeOption, "DebuggerAddress property"); - this.AddKnownCapabilityName(ChromiumOptions.ExcludeSwitchesChromeOption, "AddExcludedArgument property"); - this.AddKnownCapabilityName(ChromiumOptions.MinidumpPathChromeOption, "MinidumpPath property"); - this.AddKnownCapabilityName(ChromiumOptions.MobileEmulationChromeOption, "EnableMobileEmulation method"); - this.AddKnownCapabilityName(ChromiumOptions.PerformanceLoggingPreferencesChromeOption, "PerformanceLoggingPreferences property"); - this.AddKnownCapabilityName(ChromiumOptions.WindowTypesChromeOption, "AddWindowTypes method"); - this.AddKnownCapabilityName(ChromiumOptions.UseSpecCompliantProtocolOption, "UseSpecCompliantProtocol property"); - } - /// /// Gets the vendor prefix to apply to Chromium-specific capability names. /// diff --git a/dotnet/src/webdriver/DriverOptions.cs b/dotnet/src/webdriver/DriverOptions.cs index 483ceb03130a4..18a995dd9af6e 100644 --- a/dotnet/src/webdriver/DriverOptions.cs +++ b/dotnet/src/webdriver/DriverOptions.cs @@ -22,7 +22,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Globalization; namespace OpenQA.Selenium; @@ -115,23 +114,6 @@ public abstract class DriverOptions { private readonly Dictionary additionalCapabilities = new Dictionary(); private readonly Dictionary loggingPreferences = new Dictionary(); - private readonly Dictionary knownCapabilityNames = new Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - protected DriverOptions() - { - this.AddKnownCapabilityName(CapabilityType.BrowserName, "BrowserName property"); - this.AddKnownCapabilityName(CapabilityType.BrowserVersion, "BrowserVersion property"); - this.AddKnownCapabilityName(CapabilityType.PlatformName, "PlatformName property"); - this.AddKnownCapabilityName(CapabilityType.Proxy, "Proxy property"); - this.AddKnownCapabilityName(CapabilityType.UnhandledPromptBehavior, "UnhandledPromptBehavior property"); - this.AddKnownCapabilityName(CapabilityType.PageLoadStrategy, "PageLoadStrategy property"); - this.AddKnownCapabilityName(CapabilityType.UseStrictFileInteractability, "UseStrictFileInteractability property"); - this.AddKnownCapabilityName(CapabilityType.WebSocketUrl, "UseWebSocketUrl property"); - this.AddKnownCapabilityName(CapabilityType.EnableDownloads, "EnableDownloads property"); - } /// /// Gets or sets the name of the browser. @@ -361,71 +343,6 @@ protected void ValidateCapabilityName([NotNull] string? capabilityName) { throw new ArgumentException("Capability name may not be null an empty string.", nameof(capabilityName)); } - - if (this.TryGetKnownCapability(capabilityName!, out string? typeSafeOptionName)) - { - string message = string.Format(CultureInfo.InvariantCulture, "There is already an option for the {0} capability. Please use the {1} instead.", capabilityName, typeSafeOptionName); - throw new ArgumentException(message, nameof(capabilityName)); - } - } - - /// - /// Adds a known capability to the list of known capabilities and associates it - /// with the type-safe property name of the options class to be used instead. - /// - /// The name of the capability. - /// The name of the option property or method to be used instead. - protected void AddKnownCapabilityName(string capabilityName, string typeSafeOptionName) - { - this.knownCapabilityNames[capabilityName] = typeSafeOptionName; - } - - /// - /// Remove a capability from the list of known capabilities - /// - /// The name of the capability to be removed. - protected void RemoveKnownCapabilityName(string? capabilityName) - { - if (capabilityName is not null) - { - this.knownCapabilityNames.Remove(capabilityName); - } - } - - /// - /// Gets a value indicating whether the specified capability name is a known capability name which has a type-safe option. - /// - /// The name of the capability to check. - /// if the capability name is known; otherwise . - protected bool IsKnownCapabilityName(string capabilityName) - { - return this.knownCapabilityNames.ContainsKey(capabilityName); - } - - /// - /// Gets a value indicating whether the specified capability name is a known capability name which has a type-safe option. - /// - /// The name of the capability to check. - /// The name of the type-safe option for the given capability name, or if not found. - /// if the capability name is known; otherwise . - protected bool TryGetKnownCapability(string capabilityName, [NotNullWhen(true)] out string? typeSafeOptionName) - { - return this.knownCapabilityNames.TryGetValue(capabilityName, out typeSafeOptionName); - } - - /// - /// Gets the name of the type-safe option for a given capability name. - /// - /// The name of the capability to check. - /// The name of the type-safe option for the given capability name. - protected string GetTypeSafeOptionName(string capabilityName) - { - if (!this.IsKnownCapabilityName(capabilityName)) - { - return string.Empty; - } - - return this.knownCapabilityNames[capabilityName]; } /// diff --git a/dotnet/src/webdriver/Firefox/FirefoxOptions.cs b/dotnet/src/webdriver/Firefox/FirefoxOptions.cs index 25ae10039fba8..d1f979f41c44d 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxOptions.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxOptions.cs @@ -72,17 +72,7 @@ public FirefoxOptions() : base() { this.BrowserName = BrowserNameValue; - this.AddKnownCapabilityName(FirefoxOptions.FirefoxOptionsCapability, "current FirefoxOptions class instance"); - this.AddKnownCapabilityName(FirefoxOptions.IsMarionetteCapability, "UseLegacyImplementation property"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxProfileCapability, "Profile property"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxBinaryCapability, "BrowserExecutableLocation property"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxArgumentsCapability, "AddArguments method"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxPrefsCapability, "SetPreference method"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxEnvCapability, "SetEnvironmentVariable method"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxLogCapability, "LogLevel property"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxLegacyProfileCapability, "Profile property"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxLegacyBinaryCapability, "BrowserExecutableLocation property"); - this.AddKnownCapabilityName(FirefoxOptions.FirefoxEnableDevToolsProtocolCapability, "EnableDevToolsProtocol property"); + // https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/. // Enable BiDi only this.SetPreference("remote.active-protocols", 1); diff --git a/dotnet/src/webdriver/IE/InternetExplorerOptions.cs b/dotnet/src/webdriver/IE/InternetExplorerOptions.cs index 41c20a20f3be4..dd010c80cbb85 100644 --- a/dotnet/src/webdriver/IE/InternetExplorerOptions.cs +++ b/dotnet/src/webdriver/IE/InternetExplorerOptions.cs @@ -102,27 +102,6 @@ public InternetExplorerOptions() : base() { this.BrowserName = BrowserNameValue; this.PlatformName = "windows"; - this.AddKnownCapabilityName(Capability, "current InterentExplorerOptions class instance"); - this.AddKnownCapabilityName(IgnoreProtectedModeSettingsCapability, "IntroduceInstabilityByIgnoringProtectedModeSettings property"); - this.AddKnownCapabilityName(IgnoreZoomSettingCapability, "IgnoreZoomLevel property"); - this.AddKnownCapabilityName(CapabilityType.HasNativeEvents, "EnableNativeEvents property"); - this.AddKnownCapabilityName(InitialBrowserUrlCapability, "InitialBrowserUrl property"); - this.AddKnownCapabilityName(ElementScrollBehaviorCapability, "ElementScrollBehavior property"); - this.AddKnownCapabilityName(CapabilityType.UnexpectedAlertBehavior, "UnhandledPromptBehavior property"); - this.AddKnownCapabilityName(EnablePersistentHoverCapability, "EnablePersistentHover property"); - this.AddKnownCapabilityName(RequireWindowFocusCapability, "RequireWindowFocus property"); - this.AddKnownCapabilityName(BrowserAttachTimeoutCapability, "BrowserAttachTimeout property"); - this.AddKnownCapabilityName(ForceCreateProcessApiCapability, "ForceCreateProcessApi property"); - this.AddKnownCapabilityName(ForceShellWindowsApiCapability, "ForceShellWindowsApi property"); - this.AddKnownCapabilityName(BrowserCommandLineSwitchesCapability, "BrowserComaandLineArguments property"); - this.AddKnownCapabilityName(UsePerProcessProxyCapability, "UsePerProcessProxy property"); - this.AddKnownCapabilityName(EnsureCleanSessionCapability, "EnsureCleanSession property"); - this.AddKnownCapabilityName(FileUploadDialogTimeoutCapability, "FileUploadDialogTimeout property"); - this.AddKnownCapabilityName(EnableFullPageScreenshotCapability, "EnableFullPageScreenshot property"); - this.AddKnownCapabilityName(LegacyFileUploadDialogHandlingCapability, "LegacyFileUploadDialogHanlding property"); - this.AddKnownCapabilityName(AttachToEdgeChromeCapability, "AttachToEdgeChrome property"); - this.AddKnownCapabilityName(EdgeExecutablePathCapability, "EdgeExecutablePath property"); - this.AddKnownCapabilityName(IgnoreProcessMatchCapability, "IgnoreProcessMatch property"); } /// diff --git a/dotnet/src/webdriver/Safari/SafariOptions.cs b/dotnet/src/webdriver/Safari/SafariOptions.cs index cad0132eb5236..b5d165f2d90c9 100644 --- a/dotnet/src/webdriver/Safari/SafariOptions.cs +++ b/dotnet/src/webdriver/Safari/SafariOptions.cs @@ -53,8 +53,6 @@ public SafariOptions() : base() { this.BrowserName = BrowserNameValue; this.TechnologyPreview = false; - this.AddKnownCapabilityName(SafariOptions.EnableAutomaticInspectionSafariOption, "EnableAutomaticInspection property"); - this.AddKnownCapabilityName(SafariOptions.EnableAutomaticProfilingSafariOption, "EnableAutomaticProfiling property"); } ///