diff --git a/dotnet/src/webdriver/BiDi/Browser/ClientWindowInfo.cs b/dotnet/src/webdriver/BiDi/Browser/ClientWindowInfo.cs index d097e14ded209..d457830bf167d 100644 --- a/dotnet/src/webdriver/BiDi/Browser/ClientWindowInfo.cs +++ b/dotnet/src/webdriver/BiDi/Browser/ClientWindowInfo.cs @@ -17,10 +17,14 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; + namespace OpenQA.Selenium.BiDi.Browser; public sealed record ClientWindowInfo(bool Active, ClientWindow ClientWindow, ClientWindowState State, int Height, int Width, int X, int Y); +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ClientWindowState { Fullscreen, diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/CaptureScreenshotCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/CaptureScreenshotCommand.cs index 8fd178f1655d5..28a2441890b7d 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/CaptureScreenshotCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/CaptureScreenshotCommand.cs @@ -18,6 +18,7 @@ // using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System; using System.Text.Json.Serialization; @@ -37,6 +38,7 @@ public sealed class CaptureScreenshotOptions : CommandOptions public ClipRectangle? Clip { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ScreenshotOrigin { Viewport, diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/CreateCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/CreateCommand.cs index 65600ac14ce79..67bd979171ce2 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/CreateCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/CreateCommand.cs @@ -18,6 +18,8 @@ // using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.BrowsingContext; @@ -35,6 +37,7 @@ public sealed class CreateOptions : CommandOptions public Browser.UserContext? UserContext { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ContextType { Tab, diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/Locator.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/Locator.cs index b0aef53821dbf..2db99cb07f3f6 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/Locator.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/Locator.cs @@ -17,6 +17,7 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.BrowsingContext; @@ -54,6 +55,7 @@ public sealed record AccessibilityValue public sealed record ContextValue(BrowsingContext Context); +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum MatchType { Full, diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs index a39e4f89ffa74..f942e3b187124 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs @@ -18,6 +18,8 @@ // using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.BrowsingContext; @@ -31,6 +33,7 @@ public sealed class NavigateOptions : CommandOptions public ReadinessState? Wait { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ReadinessState { None, diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/PrintCommand.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/PrintCommand.cs index 710069ee9e163..41b184c98ce7f 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/PrintCommand.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/PrintCommand.cs @@ -18,8 +18,10 @@ // using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System; using System.Collections.Generic; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.BrowsingContext; @@ -56,6 +58,7 @@ public struct PrintMargin public double? Top { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum PrintOrientation { Portrait, diff --git a/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs b/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs index 6af71b761fde9..3a88648222921 100644 --- a/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs +++ b/dotnet/src/webdriver/BiDi/BrowsingContext/UserPromptOpenedEventArgs.cs @@ -17,6 +17,7 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.BrowsingContext; @@ -28,6 +29,7 @@ public sealed record UserPromptOpenedEventArgs(BiDi BiDi, BrowsingContext Contex public string? DefaultValue { get; internal set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum UserPromptType { Alert, diff --git a/dotnet/src/webdriver/BiDi/Communication/Broker.cs b/dotnet/src/webdriver/BiDi/Communication/Broker.cs index 3c549fd6195bb..8f5b7848bb21f 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Broker.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Broker.cs @@ -83,14 +83,11 @@ internal Broker(BiDi bidi, Uri url) new InternalIdConverter(_bidi), new PreloadScriptConverter(_bidi), new RealmConverter(_bidi), - new RealmTypeConverter(), - new ScreenOrientationTypeConverter(), new DateTimeOffsetConverter(), new PrintPageRangeConverter(), new InputOriginConverter(), new WebExtensionConverter(_bidi), new SubscriptionConverter(), - new JsonStringEnumConverter(JsonNamingPolicy.CamelCase), // https://github.com/dotnet/runtime/issues/72604 new Json.Converters.Polymorphic.EvaluateResultConverter(), diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/CamelCaseEnumConverter.cs b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/CamelCaseEnumConverter.cs new file mode 100644 index 0000000000000..1a40f7821b3a3 --- /dev/null +++ b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/CamelCaseEnumConverter.cs @@ -0,0 +1,27 @@ +// +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace OpenQA.Selenium.BiDi.Communication.Json.Converters; + +public class CamelCaseEnumConverter() : + JsonStringEnumConverter(JsonNamingPolicy.CamelCase) where TEnum : struct, Enum; diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/KebabCaseEnumConverter.cs b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/KebabCaseEnumConverter.cs new file mode 100644 index 0000000000000..3c5536a3a4b96 --- /dev/null +++ b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/KebabCaseEnumConverter.cs @@ -0,0 +1,27 @@ +// +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace OpenQA.Selenium.BiDi.Communication.Json.Converters; + +public class KebabCaseEnumConverter() : + JsonStringEnumConverter(JsonNamingPolicy.KebabCaseLower) where TEnum : struct, Enum; diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/RealmTypeConverter.cs b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/RealmTypeConverter.cs deleted file mode 100644 index 5d8cb1d4138e2..0000000000000 --- a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/RealmTypeConverter.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -using OpenQA.Selenium.BiDi.Script; -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace OpenQA.Selenium.BiDi.Communication.Json.Converters; - -internal class RealmTypeConverter : JsonConverter -{ - public override RealmType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var realmType = reader.GetString(); - - return realmType switch - { - "window" => RealmType.Window, - "dedicated-worker" => RealmType.DedicatedWorker, - "shared-worker" => RealmType.SharedWorker, - "service-worker" => RealmType.ServiceWorker, - "worker" => RealmType.Worker, - "paint-worker" => RealmType.PaintWorker, - "audio-worker" => RealmType.AudioWorker, - "worklet" => RealmType.Worklet, - _ => throw new JsonException($"Unrecognized '{realmType}' value of {typeof(RealmType)}."), - }; - } - - public override void Write(Utf8JsonWriter writer, RealmType value, JsonSerializerOptions options) - { - var str = value switch - { - RealmType.Window => "window", - RealmType.DedicatedWorker => "dedicated-worker", - RealmType.SharedWorker => "shared-worker", - RealmType.ServiceWorker => "service-worker", - RealmType.Worker => "worker", - RealmType.PaintWorker => "paint-worker", - RealmType.AudioWorker => "audio-worker", - RealmType.Worklet => "worklet", - _ => throw new JsonException($"Unrecognized '{value}' value of {typeof(RealmType)}."), - }; - - writer.WriteStringValue(str); - } -} diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/ScreenOrientationTypeConverter.cs b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/ScreenOrientationTypeConverter.cs deleted file mode 100644 index 6027288f60278..0000000000000 --- a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/ScreenOrientationTypeConverter.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Licensed to the Software Freedom Conservancy (SFC) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The SFC licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -using System; -using System.Text.Json; -using System.Text.Json.Serialization; -using OpenQA.Selenium.BiDi.Emulation; - -namespace OpenQA.Selenium.BiDi.Communication.Json.Converters; - -internal class ScreenOrientationTypeConverter : JsonConverter -{ - public override ScreenOrientationType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var str = reader.GetString(); - return str switch - { - "portrait-primary" => ScreenOrientationType.PortraitPrimary, - "portrait-secondary" => ScreenOrientationType.PortraitSecondary, - "landscape-primary" => ScreenOrientationType.LandscapePrimary, - "landscape-secondary" => ScreenOrientationType.LandscapeSecondary, - _ => throw new JsonException($"Unrecognized '{str}' value of {typeof(ScreenOrientationType)}."), - }; - } - - public override void Write(Utf8JsonWriter writer, ScreenOrientationType value, JsonSerializerOptions options) - { - var str = value switch - { - ScreenOrientationType.PortraitPrimary => "portrait-primary", - ScreenOrientationType.PortraitSecondary => "portrait-secondary", - ScreenOrientationType.LandscapePrimary => "landscape-primary", - ScreenOrientationType.LandscapeSecondary => "landscape-secondary", - _ => throw new JsonException($"Unrecognized '{value}' value of {typeof(ScreenOrientationType)}."), - }; - - writer.WriteStringValue(str); - } -} diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs index eceb0920a0d98..732eabb370387 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetForcedColorsModeThemeOverrideCommand.cs @@ -17,9 +17,10 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System.Collections.Generic; using System.Text.Json.Serialization; -using OpenQA.Selenium.BiDi.Communication; namespace OpenQA.Selenium.BiDi.Emulation; @@ -35,6 +36,7 @@ public sealed class SetForcedColorsModeThemeOverrideOptions : CommandOptions public IEnumerable? UserContexts { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ForcedColorsModeTheme { Light, diff --git a/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs b/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs index 3e638d8ebb61b..1b0a10409bd9b 100644 --- a/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs +++ b/dotnet/src/webdriver/BiDi/Emulation/SetScreenOrientationOverrideCommand.cs @@ -17,9 +17,10 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System.Collections.Generic; using System.Text.Json.Serialization; -using OpenQA.Selenium.BiDi.Communication; namespace OpenQA.Selenium.BiDi.Emulation; @@ -35,12 +36,14 @@ public sealed class SetScreenOrientationOverrideOptions : CommandOptions public IEnumerable? UserContexts { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ScreenOrientationNatural { Portrait, Landscape } +[JsonConverter(typeof(KebabCaseEnumConverter))] public enum ScreenOrientationType { PortraitPrimary, diff --git a/dotnet/src/webdriver/BiDi/Input/SourceActions.cs b/dotnet/src/webdriver/BiDi/Input/SourceActions.cs index 7a370c9b18982..e1152b1d3d89b 100644 --- a/dotnet/src/webdriver/BiDi/Input/SourceActions.cs +++ b/dotnet/src/webdriver/BiDi/Input/SourceActions.cs @@ -17,6 +17,7 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System; using System.Collections; using System.Collections.Generic; @@ -144,6 +145,7 @@ public sealed record PointerParameters public PointerType? PointerType { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum PointerType { Mouse, diff --git a/dotnet/src/webdriver/BiDi/Log/LogEntry.cs b/dotnet/src/webdriver/BiDi/Log/LogEntry.cs index eb6b7ac6df24d..b08d9d207dbe6 100644 --- a/dotnet/src/webdriver/BiDi/Log/LogEntry.cs +++ b/dotnet/src/webdriver/BiDi/Log/LogEntry.cs @@ -17,8 +17,10 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System; using System.Collections.Generic; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.Log; @@ -42,6 +44,7 @@ public sealed record ConsoleLogEntry(BiDi BiDi, Level Level, Script.Source Sourc public sealed record JavascriptLogEntry(BiDi BiDi, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp) : LogEntry(BiDi, Level, Source, Text, Timestamp); +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum Level { Debug, diff --git a/dotnet/src/webdriver/BiDi/Network/AddDataCollectorCommand.cs b/dotnet/src/webdriver/BiDi/Network/AddDataCollectorCommand.cs index fa9784f0a273b..974ea765983ea 100644 --- a/dotnet/src/webdriver/BiDi/Network/AddDataCollectorCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/AddDataCollectorCommand.cs @@ -17,8 +17,10 @@ // under the License. // -using System.Collections.Generic; using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Collections.Generic; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.Network; @@ -38,11 +40,13 @@ public class AddDataCollectorOptions : CommandOptions public sealed record AddDataCollectorResult(Collector Collector) : EmptyResult; +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum DataType { Response } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum CollectorType { Blob diff --git a/dotnet/src/webdriver/BiDi/Network/AddInterceptCommand.cs b/dotnet/src/webdriver/BiDi/Network/AddInterceptCommand.cs index 698d6ea865f67..f48115877588a 100644 --- a/dotnet/src/webdriver/BiDi/Network/AddInterceptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/AddInterceptCommand.cs @@ -17,8 +17,10 @@ // under the License. // -using System.Collections.Generic; using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Collections.Generic; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.Network; @@ -48,6 +50,7 @@ public record BrowsingContextAddInterceptOptions public sealed record AddInterceptResult(Intercept Intercept) : EmptyResult; +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum InterceptPhase { BeforeRequestSent, diff --git a/dotnet/src/webdriver/BiDi/Network/Cookie.cs b/dotnet/src/webdriver/BiDi/Network/Cookie.cs index 73671bd808fb6..c3914d1bc8761 100644 --- a/dotnet/src/webdriver/BiDi/Network/Cookie.cs +++ b/dotnet/src/webdriver/BiDi/Network/Cookie.cs @@ -25,6 +25,7 @@ namespace OpenQA.Selenium.BiDi.Network; public sealed record Cookie(string Name, BytesValue Value, string Domain, string Path, long Size, bool HttpOnly, bool Secure, SameSite SameSite, [property: JsonConverter(typeof(DateTimeOffsetSecondsConverter))] DateTimeOffset? Expiry); +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum SameSite { Strict, diff --git a/dotnet/src/webdriver/BiDi/Network/Initiator.cs b/dotnet/src/webdriver/BiDi/Network/Initiator.cs index cea2a48e59f98..522ae62daf1fa 100644 --- a/dotnet/src/webdriver/BiDi/Network/Initiator.cs +++ b/dotnet/src/webdriver/BiDi/Network/Initiator.cs @@ -17,6 +17,9 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; + namespace OpenQA.Selenium.BiDi.Network; public sealed record Initiator(InitiatorType Type) @@ -30,6 +33,7 @@ public sealed record Initiator(InitiatorType Type) public Request? Request { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum InitiatorType { Parser, diff --git a/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs b/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs index d61544eb275bd..4e1e2836be701 100644 --- a/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs +++ b/dotnet/src/webdriver/BiDi/Network/SetCacheBehaviorCommand.cs @@ -17,8 +17,10 @@ // under the License. // -using System.Collections.Generic; using OpenQA.Selenium.BiDi.Communication; +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Collections.Generic; +using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.Network; @@ -44,6 +46,7 @@ internal SetCacheBehaviorOptions(BrowsingContextSetCacheBehaviorOptions? options public sealed record BrowsingContextSetCacheBehaviorOptions; +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum CacheBehavior { Default, diff --git a/dotnet/src/webdriver/BiDi/Script/RealmType.cs b/dotnet/src/webdriver/BiDi/Script/RealmType.cs index 6dc81f1efcd3c..f415c00b5e560 100644 --- a/dotnet/src/webdriver/BiDi/Script/RealmType.cs +++ b/dotnet/src/webdriver/BiDi/Script/RealmType.cs @@ -17,8 +17,12 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; + namespace OpenQA.Selenium.BiDi.Script; +[JsonConverter(typeof(KebabCaseEnumConverter))] public enum RealmType { Window, diff --git a/dotnet/src/webdriver/BiDi/Script/RemoteValue.cs b/dotnet/src/webdriver/BiDi/Script/RemoteValue.cs index 80eaea6979116..e032b8d73f8c9 100644 --- a/dotnet/src/webdriver/BiDi/Script/RemoteValue.cs +++ b/dotnet/src/webdriver/BiDi/Script/RemoteValue.cs @@ -17,6 +17,7 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; using System; using System.Collections.Generic; using System.Numerics; @@ -269,6 +270,7 @@ public sealed record WindowProxyRemoteValue(WindowProxyProperties Value) : Remot public InternalId? InternalId { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum Mode { Open, diff --git a/dotnet/src/webdriver/BiDi/Script/ResultOwnership.cs b/dotnet/src/webdriver/BiDi/Script/ResultOwnership.cs index 17207584131dd..39bf31735f03d 100644 --- a/dotnet/src/webdriver/BiDi/Script/ResultOwnership.cs +++ b/dotnet/src/webdriver/BiDi/Script/ResultOwnership.cs @@ -17,8 +17,12 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; + namespace OpenQA.Selenium.BiDi.Script; +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ResultOwnership { Root, diff --git a/dotnet/src/webdriver/BiDi/Script/SerializationOptions.cs b/dotnet/src/webdriver/BiDi/Script/SerializationOptions.cs index ae4d1880dd30c..f34c602f799d8 100644 --- a/dotnet/src/webdriver/BiDi/Script/SerializationOptions.cs +++ b/dotnet/src/webdriver/BiDi/Script/SerializationOptions.cs @@ -17,6 +17,9 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; + namespace OpenQA.Selenium.BiDi.Script; public sealed class SerializationOptions @@ -28,6 +31,7 @@ public sealed class SerializationOptions public ShadowTree? IncludeShadowTree { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum ShadowTree { None, diff --git a/dotnet/src/webdriver/BiDi/Session/UserPromptHandler.cs b/dotnet/src/webdriver/BiDi/Session/UserPromptHandler.cs index 111a8b6985806..c4b051e4c30f4 100644 --- a/dotnet/src/webdriver/BiDi/Session/UserPromptHandler.cs +++ b/dotnet/src/webdriver/BiDi/Session/UserPromptHandler.cs @@ -17,6 +17,9 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication.Json.Converters; +using System.Text.Json.Serialization; + namespace OpenQA.Selenium.BiDi.Session; public sealed record UserPromptHandler @@ -34,6 +37,7 @@ public sealed record UserPromptHandler public UserPromptHandlerType? Prompt { get; set; } } +[JsonConverter(typeof(CamelCaseEnumConverter))] public enum UserPromptHandlerType { Accept,