Skip to content

Commit

Permalink
[dotnet] mark UseSpecCompliantProtocol obsolete and throw error when …
Browse files Browse the repository at this point in the history
…false (#10448)
  • Loading branch information
titusfortner committed Aug 5, 2022
1 parent a52bfcd commit d830a13
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
12 changes: 11 additions & 1 deletion dotnet/src/webdriver/Chromium/ChromiumOptions.cs
Expand Up @@ -190,10 +190,20 @@ public ChromiumAndroidOptions AndroidOptions
/// should use the legacy OSS protocol dialect or a dialect compliant with the W3C
/// WebDriver Specification.
/// </summary>
[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;
}
}

/// <summary>
Expand Down
19 changes: 18 additions & 1 deletion 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<ArgumentException>(() => new ChromeOptions
{
UseSpecCompliantProtocol = false
});
}
}
}

0 comments on commit d830a13

Please sign in to comment.