Skip to content

Commit d830a13

Browse files
committed
[dotnet] mark UseSpecCompliantProtocol obsolete and throw error when false (#10448)
1 parent a52bfcd commit d830a13

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

dotnet/src/webdriver/Chromium/ChromiumOptions.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,20 @@ public ChromiumAndroidOptions AndroidOptions
190190
/// should use the legacy OSS protocol dialect or a dialect compliant with the W3C
191191
/// WebDriver Specification.
192192
/// </summary>
193+
[Obsolete("Spec Compliant Protocol is the only supported protocol")]
193194
public bool UseSpecCompliantProtocol
194195
{
195196
get { return this.useSpecCompliantProtocol; }
196-
set { this.useSpecCompliantProtocol = value; }
197+
set
198+
{
199+
if (!value)
200+
{
201+
throw new ArgumentException("Only the spec compliant protocol is supported, " +
202+
"Please update to W3C Syntax: " +
203+
"https://www.selenium.dev/blog/2022/legacy-protocol-support/");
204+
}
205+
this.useSpecCompliantProtocol = true;
206+
}
197207
}
198208

199209
/// <summary>
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1-
using NUnit.Framework;
1+
using System;
2+
using NUnit.Framework;
3+
using OpenQA.Selenium.Environment;
24

35
namespace OpenQA.Selenium.Chrome
46
{
57
[TestFixture]
68
public class ChromeSpecificTests : DriverTestFixture
79
{
10+
[OneTimeTearDown]
11+
public void RunAfterAnyTests()
12+
{
13+
EnvironmentManager.Instance.CloseCurrentDriver();
14+
EnvironmentManager.Instance.WebServer.Stop();
15+
}
16+
17+
[Test]
18+
public void W3CFalse()
19+
{
20+
Assert.Throws<ArgumentException>(() => new ChromeOptions
21+
{
22+
UseSpecCompliantProtocol = false
23+
});
24+
}
825
}
926
}

0 commit comments

Comments
 (0)