diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs b/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs index e041fb3f01023..38cfdb039c620 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs @@ -121,7 +121,6 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; [JsonSerializable(typeof(Modules.BrowsingContext.UserPromptClosedEventArgs))] [JsonSerializable(typeof(Modules.BrowsingContext.Origin), TypeInfoPropertyName = "BrowsingContext_Origin")] -[JsonSerializable(typeof(Modules.Network.BytesValue.String), TypeInfoPropertyName = "Network_BytesValue_String")] [JsonSerializable(typeof(Modules.Network.ContinueWithAuthParameters.Default), TypeInfoPropertyName = "Network_ContinueWithAuthParameters_Default")] [JsonSerializable(typeof(Modules.Network.AddInterceptCommand))] [JsonSerializable(typeof(Modules.Network.AddInterceptResult))] diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/BytesValue.cs b/dotnet/src/webdriver/BiDi/Modules/Network/BytesValue.cs index ac0e3d1d9c747..3125ac4860f78 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/BytesValue.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/BytesValue.cs @@ -22,13 +22,13 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; [JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] -[JsonDerivedType(typeof(String), "string")] -[JsonDerivedType(typeof(Base64), "base64")] +[JsonDerivedType(typeof(StringBytesValue), "string")] +[JsonDerivedType(typeof(Base64BytesValue), "base64")] public abstract record BytesValue { - public static implicit operator BytesValue(string value) => new String(value); + public static implicit operator BytesValue(string value) => new StringBytesValue(value); +} - public record String(string Value) : BytesValue; +public record StringBytesValue(string Value) : BytesValue; - public record Base64(string Value) : BytesValue; -} +public record Base64BytesValue(string Value) : BytesValue; diff --git a/dotnet/test/common/BiDi/Network/NetworkEventsTest.cs b/dotnet/test/common/BiDi/Network/NetworkEventsTest.cs index 74e736e70b0c4..0de7e247e2b9e 100644 --- a/dotnet/test/common/BiDi/Network/NetworkEventsTest.cs +++ b/dotnet/test/common/BiDi/Network/NetworkEventsTest.cs @@ -101,7 +101,7 @@ public async Task CanListenToBeforeRequestSentEventWithCookie() Assert.That(req.Request.Cookies, Has.Count.EqualTo(1)); Assert.That(req.Request.Cookies[0].Name, Is.EqualTo("foo")); - Assert.That((req.Request.Cookies[0].Value as BytesValue.String).Value, Is.EqualTo("bar")); + Assert.That((req.Request.Cookies[0].Value as StringBytesValue).Value, Is.EqualTo("bar")); } [Test] diff --git a/dotnet/test/common/BiDi/Storage/StorageTest.cs b/dotnet/test/common/BiDi/Storage/StorageTest.cs index 642f17756ef57..f18df3d8f0bfa 100644 --- a/dotnet/test/common/BiDi/Storage/StorageTest.cs +++ b/dotnet/test/common/BiDi/Storage/StorageTest.cs @@ -99,7 +99,7 @@ await context.Storage.SetCookieAsync(new("fish", "cod", UrlBuilder.HostName) var cookie = cookies[0]; Assert.That(cookie.Name, Is.EqualTo("fish")); - Assert.That((cookie.Value as BytesValue.String).Value, Is.EqualTo("cod")); + Assert.That((cookie.Value as StringBytesValue).Value, Is.EqualTo("cod")); Assert.That(cookie.Path, Is.EqualTo("/common/animals")); Assert.That(cookie.HttpOnly, Is.True); Assert.That(cookie.Secure, Is.False);