From d830a1393ef2bd32ca1a0236b2eecbedd3f15aff Mon Sep 17 00:00:00 2001 From: titusfortner Date: Thu, 4 Aug 2022 22:48:11 -0500 Subject: [PATCH] [dotnet] mark UseSpecCompliantProtocol obsolete and throw error when false (#10448) --- .../src/webdriver/Chromium/ChromiumOptions.cs | 12 +++++++++++- dotnet/test/chrome/ChromeSpecificTests.cs | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs index 0a126884bec6c..9c568fc5a811b 100644 --- a/dotnet/src/webdriver/Chromium/ChromiumOptions.cs +++ b/dotnet/src/webdriver/Chromium/ChromiumOptions.cs @@ -190,10 +190,20 @@ public ChromiumAndroidOptions AndroidOptions /// should use the legacy OSS protocol dialect or a dialect compliant with the W3C /// WebDriver Specification. /// + [Obsolete("Spec Compliant Protocol is the only supported protocol")] public bool UseSpecCompliantProtocol { get { return this.useSpecCompliantProtocol; } - set { this.useSpecCompliantProtocol = value; } + set + { + if (!value) + { + throw new ArgumentException("Only the spec compliant protocol is supported, " + + "Please update to W3C Syntax: " + + "https://www.selenium.dev/blog/2022/legacy-protocol-support/"); + } + this.useSpecCompliantProtocol = true; + } } /// diff --git a/dotnet/test/chrome/ChromeSpecificTests.cs b/dotnet/test/chrome/ChromeSpecificTests.cs index 063f9fc4ba90b..f19cbb5aa9cfd 100644 --- a/dotnet/test/chrome/ChromeSpecificTests.cs +++ b/dotnet/test/chrome/ChromeSpecificTests.cs @@ -1,9 +1,26 @@ -using NUnit.Framework; +using System; +using NUnit.Framework; +using OpenQA.Selenium.Environment; namespace OpenQA.Selenium.Chrome { [TestFixture] public class ChromeSpecificTests : DriverTestFixture { + [OneTimeTearDown] + public void RunAfterAnyTests() + { + EnvironmentManager.Instance.CloseCurrentDriver(); + EnvironmentManager.Instance.WebServer.Stop(); + } + + [Test] + public void W3CFalse() + { + Assert.Throws(() => new ChromeOptions + { + UseSpecCompliantProtocol = false + }); + } } }