diff --git a/dotnet/src/webdriver/BiDi/Communication/Broker.cs b/dotnet/src/webdriver/BiDi/Communication/Broker.cs index 528b571e8b1ca..9dba18f3c2628 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Broker.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Broker.cs @@ -32,19 +32,20 @@ namespace OpenQA.Selenium.BiDi.Communication; -public class Broker : IAsyncDisposable +public sealed class Broker : IAsyncDisposable { private readonly ILogger _logger = Log.GetLogger(); private readonly BiDi _bidi; private readonly ITransport _transport; - private readonly ConcurrentDictionary> _pendingCommands = new(); + private readonly ConcurrentDictionary _pendingCommands = new(); private readonly BlockingCollection _pendingEvents = []; + private readonly Dictionary _eventTypesMap = []; private readonly ConcurrentDictionary> _eventHandlers = new(); - private int _currentCommandId; + private long _currentCommandId; private static readonly TaskFactory _myTaskFactory = new(CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskContinuationOptions.None, TaskScheduler.Default); @@ -89,7 +90,6 @@ internal Broker(BiDi bidi, Uri url) new JsonStringEnumConverter(JsonNamingPolicy.CamelCase), // https://github.com/dotnet/runtime/issues/72604 - new Json.Converters.Polymorphic.MessageConverter(), new Json.Converters.Polymorphic.EvaluateResultConverter(), new Json.Converters.Polymorphic.RemoteValueConverter(), new Json.Converters.Polymorphic.RealmInfoConverter(), @@ -122,23 +122,18 @@ private async Task ReceiveMessagesAsync(CancellationToken cancellationToken) { while (!cancellationToken.IsCancellationRequested) { - var data = await _transport.ReceiveAsync(cancellationToken).ConfigureAwait(false); - - var message = JsonSerializer.Deserialize(new ReadOnlySpan(data), _jsonSerializerContext.Message); + try + { + var data = await _transport.ReceiveAsync(cancellationToken).ConfigureAwait(false); - switch (message) + ProcessReceivedMessage(data); + } + catch (Exception ex) { - case MessageSuccess messageSuccess: - _pendingCommands[messageSuccess.Id].SetResult(messageSuccess.Result); - _pendingCommands.TryRemove(messageSuccess.Id, out _); - break; - case MessageEvent messageEvent: - _pendingEvents.Add(messageEvent); - break; - case MessageError mesageError: - _pendingCommands[mesageError.Id].SetException(new BiDiException($"{mesageError.Error}: {mesageError.Message}")); - _pendingCommands.TryRemove(mesageError.Id, out _); - break; + if (cancellationToken.IsCancellationRequested is not true && _logger.IsEnabled(LogEventLevel.Error)) + { + _logger.Error($"Couldn't process received BiDi remote message: {ex}"); + } } } } @@ -155,7 +150,7 @@ private async Task ProcessEventsAwaiterAsync() { foreach (var handler in eventHandlers.ToArray()) // copy handlers avoiding modified collection while iterating { - var args = (EventArgs)result.Params.Deserialize(handler.EventArgsType, _jsonSerializerContext)!; + var args = result.Params; args.BiDi = _bidi; @@ -177,32 +172,33 @@ private async Task ProcessEventsAwaiterAsync() { if (_logger.IsEnabled(LogEventLevel.Error)) { - _logger.Error($"Unhandled error processing BiDi event: {ex}"); + _logger.Error($"Unhandled error processing BiDi event handler: {ex}"); } } } } - public async Task ExecuteCommandAsync(TCommand command, CommandOptions? options) + public async Task ExecuteCommandAsync(TCommand command, CommandOptions? options) where TCommand : Command { - var jsonElement = await ExecuteCommandCoreAsync(command, options).ConfigureAwait(false); - - return (TResult)jsonElement.Deserialize(typeof(TResult), _jsonSerializerContext)!; + await ExecuteCommandCoreAsync(command, options).ConfigureAwait(false); } - public async Task ExecuteCommandAsync(TCommand command, CommandOptions? options) + public async Task ExecuteCommandAsync(TCommand command, CommandOptions? options) where TCommand : Command + where TResult : EmptyResult { - await ExecuteCommandCoreAsync(command, options).ConfigureAwait(false); + var result = await ExecuteCommandCoreAsync(command, options).ConfigureAwait(false); + + return (TResult)result; } - private async Task ExecuteCommandCoreAsync(TCommand command, CommandOptions? options) + private async Task ExecuteCommandCoreAsync(TCommand command, CommandOptions? options) where TCommand : Command { command.Id = Interlocked.Increment(ref _currentCommandId); - var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); var timeout = options?.Timeout ?? TimeSpan.FromSeconds(30); @@ -210,7 +206,7 @@ private async Task ExecuteCommandCoreAsync(TCommand comma cts.Token.Register(() => tcs.TrySetCanceled(cts.Token)); - _pendingCommands[command.Id] = tcs; + _pendingCommands[command.Id] = new(command.Id, command.ResultType, tcs); var data = JsonSerializer.SerializeToUtf8Bytes(command, typeof(TCommand), _jsonSerializerContext); @@ -222,6 +218,8 @@ private async Task ExecuteCommandCoreAsync(TCommand comma public async Task SubscribeAsync(string eventName, Action action, SubscriptionOptions? options = null) where TEventArgs : EventArgs { + _eventTypesMap[eventName] = typeof(TEventArgs); + var handlers = _eventHandlers.GetOrAdd(eventName, (a) => []); if (options is BrowsingContextsSubscriptionOptions browsingContextsOptions) @@ -249,6 +247,8 @@ public async Task SubscribeAsync(string eventName, Act public async Task SubscribeAsync(string eventName, Func func, SubscriptionOptions? options = null) where TEventArgs : EventArgs { + _eventTypesMap[eventName] = typeof(TEventArgs); + var handlers = _eventHandlers.GetOrAdd(eventName, (a) => []); if (options is BrowsingContextsSubscriptionOptions browsingContextsOptions) @@ -303,12 +303,6 @@ public async Task UnsubscribeAsync(Modules.Session.Subscription subscription, Ev } public async ValueTask DisposeAsync() - { - await DisposeAsyncCore(); - GC.SuppressFinalize(this); - } - - protected virtual async ValueTask DisposeAsyncCore() { _pendingEvents.CompleteAdding(); @@ -320,5 +314,104 @@ protected virtual async ValueTask DisposeAsyncCore() } _transport.Dispose(); + + GC.SuppressFinalize(this); } + + private void ProcessReceivedMessage(byte[]? data) + { + long? id = default; + string? type = default; + string? method = default; + string? error = default; + string? message = default; + Utf8JsonReader resultReader = default; + Utf8JsonReader paramsReader = default; + + Utf8JsonReader reader = new(new ReadOnlySpan(data)); + reader.Read(); + + reader.Read(); // "{" + + while (reader.TokenType == JsonTokenType.PropertyName) + { + string? propertyName = reader.GetString(); + reader.Read(); + + switch (propertyName) + { + case "id": + id = reader.GetInt64(); + break; + + case "type": + type = reader.GetString(); + break; + + case "method": + method = reader.GetString(); + break; + + case "result": + resultReader = reader; // cloning reader with current position + break; + + case "params": + paramsReader = reader; // cloning reader with current position + break; + + case "error": + error = reader.GetString(); + break; + + case "message": + message = reader.GetString(); + break; + } + + reader.Skip(); + reader.Read(); + } + + switch (type) + { + case "success": + if (id is null) throw new JsonException("The remote end responded with 'success' message type, but missed required 'id' property."); + + var successCommand = _pendingCommands[id.Value]; + var messageSuccess = JsonSerializer.Deserialize(ref resultReader, successCommand.ResultType, _jsonSerializerContext)!; + successCommand.TaskCompletionSource.SetResult((EmptyResult)messageSuccess); + _pendingCommands.TryRemove(id.Value, out _); + break; + + case "event": + if (method is null) throw new JsonException("The remote end responded with 'event' message type, but missed required 'method' property."); + + var eventType = _eventTypesMap[method]; + + var eventArgs = (EventArgs)JsonSerializer.Deserialize(ref paramsReader, eventType, _jsonSerializerContext)!; + + var messageEvent = new MessageEvent(method, eventArgs); + _pendingEvents.Add(messageEvent); + break; + + case "error": + if (id is null) throw new JsonException("The remote end responded with 'error' message type, but missed required 'id' property."); + + var messageError = new MessageError(id.Value) { Error = error, Message = message }; + var errorCommand = _pendingCommands[messageError.Id]; + errorCommand.TaskCompletionSource.SetException(new BiDiException($"{messageError.Error}: {messageError.Message}")); + _pendingCommands.TryRemove(messageError.Id, out _); + break; + } + } + + class CommandInfo(long id, Type resultType, TaskCompletionSource taskCompletionSource) + { + public long Id { get; } = id; + + public Type ResultType { get; } = resultType; + + public TaskCompletionSource TaskCompletionSource { get; } = taskCompletionSource; + }; } diff --git a/dotnet/src/webdriver/BiDi/Communication/Command.cs b/dotnet/src/webdriver/BiDi/Communication/Command.cs index 24e0d1b8783e0..ce12b125e08a2 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Command.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Command.cs @@ -17,26 +17,32 @@ // under the License. // +using System; using System.Text.Json.Serialization; namespace OpenQA.Selenium.BiDi.Communication; public abstract class Command { - protected Command(string method) + protected Command(string method, Type resultType) { Method = method; + ResultType = resultType; } [JsonPropertyOrder(1)] public string Method { get; } [JsonPropertyOrder(0)] - public int Id { get; internal set; } + public long Id { get; internal set; } + + [JsonIgnore] + public Type ResultType { get; } } -internal abstract class Command(TCommandParameters @params, string method) : Command(method) +internal abstract class Command(TCommandParameters @params, string method) : Command(method, typeof(TCommandResult)) where TCommandParameters : CommandParameters + where TCommandResult : EmptyResult { [JsonPropertyOrder(2)] public TCommandParameters Params { get; } = @params; @@ -46,3 +52,5 @@ internal record CommandParameters { public static CommandParameters Empty { get; } = new CommandParameters(); } + +public record EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs b/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs index 240e30330655a..ceb42345e9840 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Json/BiDiJsonSerializerContext.cs @@ -23,10 +23,6 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; #region https://github.com/dotnet/runtime/issues/72604 -[JsonSerializable(typeof(MessageSuccess))] -[JsonSerializable(typeof(MessageError))] -[JsonSerializable(typeof(MessageEvent))] - [JsonSerializable(typeof(Modules.Script.EvaluateResultSuccess))] [JsonSerializable(typeof(Modules.Script.EvaluateResultException))] @@ -71,7 +67,7 @@ namespace OpenQA.Selenium.BiDi.Communication.Json; #endregion [JsonSerializable(typeof(Command))] -[JsonSerializable(typeof(Message))] +[JsonSerializable(typeof(EmptyResult))] [JsonSerializable(typeof(Modules.Session.StatusCommand))] [JsonSerializable(typeof(Modules.Session.StatusResult))] diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/MessageConverter.cs b/dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/MessageConverter.cs deleted file mode 100644 index 3c9155f8bf979..0000000000000 --- a/dotnet/src/webdriver/BiDi/Communication/Json/Converters/Polymorphic/MessageConverter.cs +++ /dev/null @@ -1,45 +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.Communication.Json.Internal; -using System; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Polymorphic; - -// https://github.com/dotnet/runtime/issues/72604 -internal class MessageConverter : JsonConverter -{ - public override Message? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return reader.GetDiscriminator("type") switch - { - "success" => JsonSerializer.Deserialize(ref reader, options), - "error" => JsonSerializer.Deserialize(ref reader, options), - "event" => JsonSerializer.Deserialize(ref reader, options), - _ => null, - }; - } - - public override void Write(Utf8JsonWriter writer, Message value, JsonSerializerOptions options) - { - throw new NotImplementedException(); - } -} diff --git a/dotnet/src/webdriver/BiDi/Communication/Json/Internal/JsonExtensions.cs b/dotnet/src/webdriver/BiDi/Communication/Json/Internal/JsonExtensions.cs index 3a8b687665ac1..812416dc02e95 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Json/Internal/JsonExtensions.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Json/Internal/JsonExtensions.cs @@ -41,6 +41,7 @@ public static string GetDiscriminator(this ref Utf8JsonReader reader, string nam if (propertyName == name) { discriminator = readerClone.GetString(); + break; } @@ -48,6 +49,6 @@ public static string GetDiscriminator(this ref Utf8JsonReader reader, string nam readerClone.Read(); } - return discriminator ?? throw new JsonException($"Couldn't determine '{name}' descriminator."); + return discriminator ?? throw new JsonException($"Couldn't determine '{name}' discriminator."); } } diff --git a/dotnet/src/webdriver/BiDi/Communication/Message.cs b/dotnet/src/webdriver/BiDi/Communication/Message.cs index fc8c2020ffe8a..03f948cc18873 100644 --- a/dotnet/src/webdriver/BiDi/Communication/Message.cs +++ b/dotnet/src/webdriver/BiDi/Communication/Message.cs @@ -17,24 +17,18 @@ // under the License. // -using System.Text.Json; - namespace OpenQA.Selenium.BiDi.Communication; -// https://github.com/dotnet/runtime/issues/72604 -//[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] -//[JsonDerivedType(typeof(MessageSuccess), "success")] -//[JsonDerivedType(typeof(MessageError), "error")] -//[JsonDerivedType(typeof(MessageEvent), "event")] internal abstract record Message; -internal record MessageSuccess(int Id, JsonElement Result) : Message; +internal record MessageSuccess(long Id, EmptyResult Result) : Message; -internal record MessageError(int Id) : Message +internal record MessageError(long Id) : Message { public string? Error { get; set; } public string? Message { get; set; } } -internal record MessageEvent(string Method, JsonElement Params) : Message; +internal record MessageEvent(string Method, EventArgs Params) : Message; + diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/CloseCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/CloseCommand.cs index 528c96afa20ed..fe29a937ec4d4 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/CloseCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/CloseCommand.cs @@ -22,6 +22,6 @@ namespace OpenQA.Selenium.BiDi.Modules.Browser; internal class CloseCommand() - : Command(CommandParameters.Empty, "browser.close"); + : Command(CommandParameters.Empty, "browser.close"); public record CloseOptions : CommandOptions; diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs index 9b30c91626c3f..f847168ebd9f4 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/CreateUserContextCommand.cs @@ -22,6 +22,6 @@ namespace OpenQA.Selenium.BiDi.Modules.Browser; internal class CreateUserContextCommand() - : Command(CommandParameters.Empty, "browser.createUserContext"); + : Command(CommandParameters.Empty, "browser.createUserContext"); public record CreateUserContextOptions : CommandOptions; diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/GetClientWindowsCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/GetClientWindowsCommand.cs index 432457c85bb61..5e6f4f2b65d30 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/GetClientWindowsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/GetClientWindowsCommand.cs @@ -24,11 +24,11 @@ namespace OpenQA.Selenium.BiDi.Modules.Browser; internal class GetClientWindowsCommand() - : Command(CommandParameters.Empty, "browser.getClientWindows"); + : Command(CommandParameters.Empty, "browser.getClientWindows"); public record GetClientWindowsOptions : CommandOptions; -public record GetClientWindowsResult : IReadOnlyList +public record GetClientWindowsResult : EmptyResult, IReadOnlyList { private readonly IReadOnlyList _clientWindows; diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/GetUserContextsCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/GetUserContextsCommand.cs index e9185b2308634..42891aa3664ba 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/GetUserContextsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/GetUserContextsCommand.cs @@ -24,11 +24,11 @@ namespace OpenQA.Selenium.BiDi.Modules.Browser; internal class GetUserContextsCommand() - : Command(CommandParameters.Empty, "browser.getUserContexts"); + : Command(CommandParameters.Empty, "browser.getUserContexts"); public record GetUserContextsOptions : CommandOptions; -public record GetUserContextsResult : IReadOnlyList +public record GetUserContextsResult : EmptyResult, IReadOnlyList { private readonly IReadOnlyList _userContexts; diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/RemoveUserContextCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/RemoveUserContextCommand.cs index 67a99e4f1e72d..7dcfe38c7bb0a 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/RemoveUserContextCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/RemoveUserContextCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Browser; internal class RemoveUserContextCommand(RemoveUserContextCommandParameters @params) - : Command(@params, "browser.removeUserContext"); + : Command(@params, "browser.removeUserContext"); internal record RemoveUserContextCommandParameters(UserContext UserContext) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Browser/UserContextInfo.cs b/dotnet/src/webdriver/BiDi/Modules/Browser/UserContextInfo.cs index 06fd45edf188c..f439f678b3f64 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Browser/UserContextInfo.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Browser/UserContextInfo.cs @@ -17,6 +17,8 @@ // under the License. // +using OpenQA.Selenium.BiDi.Communication; + namespace OpenQA.Selenium.BiDi.Modules.Browser; -public record UserContextInfo(UserContext UserContext); +public record UserContextInfo(UserContext UserContext) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ActivateCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ActivateCommand.cs index c8d036e182e47..9b091965f8c21 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ActivateCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ActivateCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class ActivateCommand(ActivateCommandParameters @params) - : Command(@params, "browsingContext.activate"); + : Command(@params, "browsingContext.activate"); internal record ActivateCommandParameters(BrowsingContext Context) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs index 6b2ac687f5d45..51be0130a92ad 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CaptureScreenshotCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class CaptureScreenshotCommand(CaptureScreenshotCommandParameters @params) - : Command(@params, "browsingContext.captureScreenshot"); + : Command(@params, "browsingContext.captureScreenshot"); internal record CaptureScreenshotCommandParameters(BrowsingContext Context, ScreenshotOrigin? Origin, ImageFormat? Format, ClipRectangle? Clip) : CommandParameters; @@ -56,7 +56,7 @@ public record BoxClipRectangle(double X, double Y, double Width, double Height) public record ElementClipRectangle([property: JsonPropertyName("element")] Script.ISharedReference SharedReference) : ClipRectangle; -public record CaptureScreenshotResult(string Data) +public record CaptureScreenshotResult(string Data) : EmptyResult { public byte[] ToByteArray() => System.Convert.FromBase64String(Data); } diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CloseCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CloseCommand.cs index 474f611af76c8..7d7d5c6beb5c5 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CloseCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CloseCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class CloseCommand(CloseCommandParameters @params) - : Command(@params, "browsingContext.close"); + : Command(@params, "browsingContext.close"); internal record CloseCommandParameters(BrowsingContext Context, bool? PromptUnload) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CreateCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CreateCommand.cs index ade319e27390c..58900de151e51 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CreateCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/CreateCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class CreateCommand(CreateCommandParameters @params) - : Command(@params, "browsingContext.create"); + : Command(@params, "browsingContext.create"); internal record CreateCommandParameters(ContextType Type, BrowsingContext? ReferenceContext, bool? Background, Browser.UserContext? UserContext) : CommandParameters; @@ -41,4 +41,4 @@ public enum ContextType Window } -public record CreateResult(BrowsingContext Context); +public record CreateResult(BrowsingContext Context) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/GetTreeCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/GetTreeCommand.cs index dd95a6bd5f9d6..0c6e0d7dd777a 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/GetTreeCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/GetTreeCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class GetTreeCommand(GetTreeCommandParameters @params) - : Command(@params, "browsingContext.getTree"); + : Command(@params, "browsingContext.getTree"); internal record GetTreeCommandParameters(long? MaxDepth, BrowsingContext? Root) : CommandParameters; @@ -46,4 +46,4 @@ public record BrowsingContextGetTreeOptions public long? MaxDepth { get; set; } } -public record GetTreeResult(IReadOnlyList Contexts); +public record GetTreeResult(IReadOnlyList Contexts) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/HandleUserPromptCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/HandleUserPromptCommand.cs index 01de5c8adca9b..cd76961c4cf7f 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/HandleUserPromptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/HandleUserPromptCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; class HandleUserPromptCommand(HandleUserPromptCommandParameters @params) - : Command(@params, "browsingContext.handleUserPrompt"); + : Command(@params, "browsingContext.handleUserPrompt"); internal record HandleUserPromptCommandParameters(BrowsingContext Context, bool? Accept, string? UserText) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/LocateNodesCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/LocateNodesCommand.cs index 147dbc0303ed9..393cdff1c9e22 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/LocateNodesCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/LocateNodesCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class LocateNodesCommand(LocateNodesCommandParameters @params) - : Command(@params, "browsingContext.locateNodes"); + : Command(@params, "browsingContext.locateNodes"); internal record LocateNodesCommandParameters(BrowsingContext Context, Locator Locator, long? MaxNodeCount, Script.SerializationOptions? SerializationOptions, IEnumerable? StartNodes) : CommandParameters; @@ -37,7 +37,7 @@ public record LocateNodesOptions : CommandOptions public IEnumerable? StartNodes { get; set; } } -public record LocateNodesResult : IReadOnlyList +public record LocateNodesResult : EmptyResult, IReadOnlyList { private readonly IReadOnlyList _nodes; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/NavigateCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/NavigateCommand.cs index 87a2e295c8c8c..1ca3c3b19a598 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/NavigateCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/NavigateCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class NavigateCommand(NavigateCommandParameters @params) - : Command(@params, "browsingContext.navigate"); + : Command(@params, "browsingContext.navigate"); internal record NavigateCommandParameters(BrowsingContext Context, string Url, ReadinessState? Wait) : CommandParameters; @@ -38,4 +38,4 @@ public enum ReadinessState Complete } -public record NavigateResult(Navigation Navigation, string Url); +public record NavigateResult(Navigation Navigation, string Url) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/PrintCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/PrintCommand.cs index b3362f59fa139..0e68022eb3f6a 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/PrintCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/PrintCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class PrintCommand(PrintCommandParameters @params) - : Command(@params, "browsingContext.print"); + : Command(@params, "browsingContext.print"); internal record PrintCommandParameters(BrowsingContext Context, bool? Background, PrintMargin? Margin, PrintOrientation? Orientation, PrintPage? Page, IEnumerable? PageRanges, double? Scale, bool? ShrinkToFit) : CommandParameters; @@ -112,7 +112,7 @@ public static implicit operator PrintPageRange(Range range) #endif } -public record PrintResult(string Data) +public record PrintResult(string Data) : EmptyResult { public byte[] ToByteArray() => Convert.FromBase64String(Data); } diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ReloadCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ReloadCommand.cs index 402fbdd05d79d..bea343a5e9bd1 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ReloadCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/ReloadCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class ReloadCommand(ReloadCommandParameters @params) - : Command(@params, "browsingContext.reload"); + : Command(@params, "browsingContext.reload"); internal record ReloadCommandParameters(BrowsingContext Context, bool? IgnoreCache, ReadinessState? Wait) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/SetViewportCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/SetViewportCommand.cs index 4eba7d458f6db..0b3437b29d5a7 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/SetViewportCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/SetViewportCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class SetViewportCommand(SetViewportCommandParameters @params) - : Command(@params, "browsingContext.setViewport"); + : Command(@params, "browsingContext.setViewport"); internal record SetViewportCommandParameters(BrowsingContext Context, Viewport? Viewport, double? DevicePixelRatio) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/TraverseHistoryCommand.cs b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/TraverseHistoryCommand.cs index 21b74635fbb72..ed166ad0beae4 100644 --- a/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/TraverseHistoryCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/BrowsingContext/TraverseHistoryCommand.cs @@ -22,10 +22,10 @@ namespace OpenQA.Selenium.BiDi.Modules.BrowsingContext; internal class TraverseHistoryCommand(TraverseHistoryCommandParameters @params) - : Command(@params, "browsingContext.traverseHistory"); + : Command(@params, "browsingContext.traverseHistory"); internal record TraverseHistoryCommandParameters(BrowsingContext Context, long Delta) : CommandParameters; public record TraverseHistoryOptions : CommandOptions; -public record TraverseHistoryResult; +public record TraverseHistoryResult : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/Input/PerformActionsCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Input/PerformActionsCommand.cs index 35f4462a78cc5..fab508ee77eb8 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Input/PerformActionsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Input/PerformActionsCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Input; internal class PerformActionsCommand(PerformActionsCommandParameters @params) - : Command(@params, "input.performActions"); + : Command(@params, "input.performActions"); internal record PerformActionsCommandParameters(BrowsingContext.BrowsingContext Context, IEnumerable Actions) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Input/ReleaseActionsCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Input/ReleaseActionsCommand.cs index 14e0edee4719b..e38969a302086 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Input/ReleaseActionsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Input/ReleaseActionsCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Input; internal class ReleaseActionsCommand(ReleaseActionsCommandParameters @params) - : Command(@params, "input.releaseActions"); + : Command(@params, "input.releaseActions"); internal record ReleaseActionsCommandParameters(BrowsingContext.BrowsingContext Context) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Input/SetFilesCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Input/SetFilesCommand.cs index 6486578388ebe..65489147d3f40 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Input/SetFilesCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Input/SetFilesCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Input; internal class SetFilesCommand(SetFilesCommandParameters @params) - : Command(@params, "input.setFiles"); + : Command(@params, "input.setFiles"); internal record SetFilesCommandParameters(BrowsingContext.BrowsingContext Context, Script.ISharedReference Element, IEnumerable Files) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/AddInterceptCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/AddInterceptCommand.cs index 67490235f9651..e4237b26bc6e4 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/AddInterceptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/AddInterceptCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class AddInterceptCommand(AddInterceptCommandParameters @params) - : Command(@params, "network.addIntercept"); + : Command(@params, "network.addIntercept"); internal record AddInterceptCommandParameters(IEnumerable Phases, IEnumerable? Contexts, IEnumerable? UrlPatterns) : CommandParameters; @@ -46,7 +46,7 @@ public record BrowsingContextAddInterceptOptions public IEnumerable? UrlPatterns { get; set; } } -public record AddInterceptResult(Intercept Intercept); +public record AddInterceptResult(Intercept Intercept) : EmptyResult; public enum InterceptPhase { diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/ContinueRequestCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/ContinueRequestCommand.cs index 9c54a76fe522c..6054610f61022 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/ContinueRequestCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/ContinueRequestCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class ContinueRequestCommand(ContinueRequestCommandParameters @params) - : Command(@params, "network.continueRequest"); + : Command(@params, "network.continueRequest"); internal record ContinueRequestCommandParameters(Request Request, BytesValue? Body, IEnumerable? Cookies, IEnumerable
? Headers, string? Method, string? Url) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/ContinueResponseCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/ContinueResponseCommand.cs index a78e6e59ff509..86127f89ab6e2 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/ContinueResponseCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/ContinueResponseCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class ContinueResponseCommand(ContinueResponseCommandParameters @params) - : Command(@params, "network.continueResponse"); + : Command(@params, "network.continueResponse"); internal record ContinueResponseCommandParameters(Request Request, IEnumerable? Cookies, IEnumerable? Credentials, IEnumerable
? Headers, string? ReasonPhrase, long? StatusCode) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/ContinueWithAuthCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/ContinueWithAuthCommand.cs index ccc938205b216..1a7b263b8419c 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/ContinueWithAuthCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/ContinueWithAuthCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class ContinueWithAuthCommand(ContinueWithAuthParameters @params) - : Command(@params, "network.continueWithAuth"); + : Command(@params, "network.continueWithAuth"); [JsonPolymorphic(TypeDiscriminatorPropertyName = "action")] [JsonDerivedType(typeof(ContinueWithAuthCredentials), "provideCredentials")] diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/FailRequestCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/FailRequestCommand.cs index 918e8fa19be38..8f8f58c86d006 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/FailRequestCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/FailRequestCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class FailRequestCommand(FailRequestCommandParameters @params) - : Command(@params, "network.failRequest"); + : Command(@params, "network.failRequest"); internal record FailRequestCommandParameters(Request Request) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/ProvideResponseCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/ProvideResponseCommand.cs index 1b6c91063e087..cb11ddd5ffe2d 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/ProvideResponseCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/ProvideResponseCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class ProvideResponseCommand(ProvideResponseCommandParameters @params) - : Command(@params, "network.provideResponse"); + : Command(@params, "network.provideResponse"); internal record ProvideResponseCommandParameters(Request Request, BytesValue? Body, IEnumerable? Cookies, IEnumerable
? Headers, string? ReasonPhrase, long? StatusCode) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/RemoveInterceptCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/RemoveInterceptCommand.cs index 165e7ea34b148..32760dbc029f3 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/RemoveInterceptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/RemoveInterceptCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class RemoveInterceptCommand(RemoveInterceptCommandParameters @params) - : Command(@params, "network.removeIntercept"); + : Command(@params, "network.removeIntercept"); internal record RemoveInterceptCommandParameters(Intercept Intercept) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Network/SetCacheBehaviorCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Network/SetCacheBehaviorCommand.cs index 11a372901c22a..7d49cc35a8947 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Network/SetCacheBehaviorCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Network/SetCacheBehaviorCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Network; internal class SetCacheBehaviorCommand(SetCacheBehaviorCommandParameters @params) - : Command(@params, "network.setCacheBehavior"); + : Command(@params, "network.setCacheBehavior"); internal record SetCacheBehaviorCommandParameters(CacheBehavior CacheBehavior, IEnumerable? Contexts) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Script/AddPreloadScriptCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Script/AddPreloadScriptCommand.cs index 2f72438115465..68ddc27170de3 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Script/AddPreloadScriptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Script/AddPreloadScriptCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Script; internal class AddPreloadScriptCommand(AddPreloadScriptCommandParameters @params) - : Command(@params, "script.addPreloadScript"); + : Command(@params, "script.addPreloadScript"); internal record AddPreloadScriptCommandParameters(string FunctionDeclaration, IEnumerable? Arguments, IEnumerable? Contexts, string? Sandbox) : CommandParameters; @@ -51,4 +51,4 @@ public record BrowsingContextAddPreloadScriptOptions public string? Sandbox { get; set; } } -internal record AddPreloadScriptResult(PreloadScript Script); +internal record AddPreloadScriptResult(PreloadScript Script) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/Script/CallFunctionCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Script/CallFunctionCommand.cs index c51545239d0d8..7e460baff6547 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Script/CallFunctionCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Script/CallFunctionCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Script; internal class CallFunctionCommand(CallFunctionCommandParameters @params) - : Command(@params, "script.callFunction"); + : Command(@params, "script.callFunction"); internal record CallFunctionCommandParameters(string FunctionDeclaration, bool AwaitPromise, Target Target, IEnumerable? Arguments, ResultOwnership? ResultOwnership, SerializationOptions? SerializationOptions, LocalValue? This, bool? UserActivation) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Script/DisownCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Script/DisownCommand.cs index f9e3550c47c54..241b9f5e88048 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Script/DisownCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Script/DisownCommand.cs @@ -23,6 +23,6 @@ namespace OpenQA.Selenium.BiDi.Modules.Script; internal class DisownCommand(DisownCommandParameters @params) - : Command(@params, "script.disown"); + : Command(@params, "script.disown"); internal record DisownCommandParameters(IEnumerable Handles, Target Target) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Script/EvaluateCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Script/EvaluateCommand.cs index d125b59fd706b..45317ddeb1e94 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Script/EvaluateCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Script/EvaluateCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Script; internal class EvaluateCommand(EvaluateCommandParameters @params) - : Command(@params, "script.evaluate"); + : Command(@params, "script.evaluate"); internal record EvaluateCommandParameters(string Expression, Target Target, bool AwaitPromise, ResultOwnership? ResultOwnership, SerializationOptions? SerializationOptions, bool? UserActivation) : CommandParameters; @@ -39,7 +39,7 @@ public record EvaluateOptions : CommandOptions //[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] //[JsonDerivedType(typeof(EvaluateResultSuccess), "success")] //[JsonDerivedType(typeof(EvaluateResultException), "exception")] -public abstract record EvaluateResult; +public abstract record EvaluateResult : EmptyResult; public record EvaluateResultSuccess(RemoteValue Result, Realm Realm) : EvaluateResult { diff --git a/dotnet/src/webdriver/BiDi/Modules/Script/GetRealmsCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Script/GetRealmsCommand.cs index 9d7348e32f9dd..641602e4c6ee5 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Script/GetRealmsCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Script/GetRealmsCommand.cs @@ -24,7 +24,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Script; internal class GetRealmsCommand(GetRealmsCommandParameters @params) - : Command(@params, "script.getRealms"); + : Command(@params, "script.getRealms"); internal record GetRealmsCommandParameters(BrowsingContext.BrowsingContext? Context, RealmType? Type) : CommandParameters; @@ -35,7 +35,7 @@ public record GetRealmsOptions : CommandOptions public RealmType? Type { get; set; } } -public record GetRealmsResult : IReadOnlyList +public record GetRealmsResult : EmptyResult, IReadOnlyList { private readonly IReadOnlyList _realms; diff --git a/dotnet/src/webdriver/BiDi/Modules/Script/RemovePreloadScriptCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Script/RemovePreloadScriptCommand.cs index f35851954f2f7..123cdcc75f7e1 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Script/RemovePreloadScriptCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Script/RemovePreloadScriptCommand.cs @@ -22,7 +22,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Script; internal class RemovePreloadScriptCommand(RemovePreloadScriptCommandParameters @params) - : Command(@params, "script.removePreloadScript"); + : Command(@params, "script.removePreloadScript"); internal record RemovePreloadScriptCommandParameters(PreloadScript Script) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Session/EndCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Session/EndCommand.cs index 8ed7a24ce3cb0..014e59499572d 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Session/EndCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Session/EndCommand.cs @@ -22,6 +22,6 @@ namespace OpenQA.Selenium.BiDi.Modules.Session; internal class EndCommand() - : Command(CommandParameters.Empty, "session.end"); + : Command(CommandParameters.Empty, "session.end"); public record EndOptions : CommandOptions; diff --git a/dotnet/src/webdriver/BiDi/Modules/Session/NewCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Session/NewCommand.cs index 3befe631a37e9..4490d51207cc8 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Session/NewCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Session/NewCommand.cs @@ -22,13 +22,13 @@ namespace OpenQA.Selenium.BiDi.Modules.Session; internal class NewCommand(NewCommandParameters @params) - : Command(@params, "session.new"); + : Command(@params, "session.new"); internal record NewCommandParameters(CapabilitiesRequest Capabilities) : CommandParameters; public record NewOptions : CommandOptions; -public record NewResult(string SessionId, Capability Capability); +public record NewResult(string SessionId, Capability Capability) : EmptyResult; public record Capability(bool AcceptInsecureCerts, string BrowserName, string BrowserVersion, string PlatformName, bool SetWindowRect, string UserAgent) { diff --git a/dotnet/src/webdriver/BiDi/Modules/Session/StatusCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Session/StatusCommand.cs index 8cc0a8ed63ffe..d8bf6035ec272 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Session/StatusCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Session/StatusCommand.cs @@ -22,8 +22,8 @@ namespace OpenQA.Selenium.BiDi.Modules.Session; internal class StatusCommand() - : Command(CommandParameters.Empty, "session.status"); + : Command(CommandParameters.Empty, "session.status"); -public record StatusResult(bool Ready, string Message); +public record StatusResult(bool Ready, string Message) : EmptyResult; public record StatusOptions : CommandOptions; diff --git a/dotnet/src/webdriver/BiDi/Modules/Session/SubscribeCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Session/SubscribeCommand.cs index 3cd4479a23390..7b0413c2b3445 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Session/SubscribeCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Session/SubscribeCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Session; internal class SubscribeCommand(SubscribeCommandParameters @params) - : Command(@params, "session.subscribe"); + : Command(@params, "session.subscribe"); internal record SubscribeCommandParameters(IEnumerable Events, IEnumerable? Contexts) : CommandParameters; @@ -32,4 +32,4 @@ public record SubscribeOptions : CommandOptions public IEnumerable? Contexts { get; set; } } -internal record SubscribeResult(Subscription Subscription); +internal record SubscribeResult(Subscription Subscription) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/Session/UnsubscribeCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Session/UnsubscribeCommand.cs index 09c7d3581d826..907b42e51c579 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Session/UnsubscribeCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Session/UnsubscribeCommand.cs @@ -24,10 +24,10 @@ namespace OpenQA.Selenium.BiDi.Modules.Session; internal class UnsubscribeByIdCommand(UnsubscribeByIdCommandParameters @params) - : Command(@params, "session.unsubscribe"); + : Command(@params, "session.unsubscribe"); internal class UnsubscribeByAttributesCommand(UnsubscribeByAttributesCommandParameters @params) - : Command(@params, "session.unsubscribe"); + : Command(@params, "session.unsubscribe"); internal record UnsubscribeByIdCommandParameters(IEnumerable Subscriptions) : CommandParameters; diff --git a/dotnet/src/webdriver/BiDi/Modules/Storage/DeleteCookiesCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Storage/DeleteCookiesCommand.cs index 67a6aba02e949..1b7a7534754ed 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Storage/DeleteCookiesCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Storage/DeleteCookiesCommand.cs @@ -22,10 +22,10 @@ namespace OpenQA.Selenium.BiDi.Modules.Storage; internal class DeleteCookiesCommand(DeleteCookiesCommandParameters @params) - : Command(@params, "storage.deleteCookies"); + : Command(@params, "storage.deleteCookies"); internal record DeleteCookiesCommandParameters(CookieFilter? Filter, PartitionDescriptor? Partition) : CommandParameters; public record DeleteCookiesOptions : GetCookiesOptions; -public record DeleteCookiesResult(PartitionKey PartitionKey); +public record DeleteCookiesResult(PartitionKey PartitionKey) : EmptyResult; diff --git a/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs index 1f0f06806bcc3..5d409c639e64a 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs @@ -26,7 +26,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Storage; internal class GetCookiesCommand(GetCookiesCommandParameters @params) - : Command(@params, "storage.getCookies"); + : Command(@params, "storage.getCookies"); internal record GetCookiesCommandParameters(CookieFilter? Filter, PartitionDescriptor? Partition) : CommandParameters; @@ -37,7 +37,7 @@ public record GetCookiesOptions : CommandOptions public PartitionDescriptor? Partition { get; set; } } -public record GetCookiesResult : IReadOnlyList +public record GetCookiesResult : EmptyResult, IReadOnlyList { private readonly IReadOnlyList _cookies; diff --git a/dotnet/src/webdriver/BiDi/Modules/Storage/SetCookieCommand.cs b/dotnet/src/webdriver/BiDi/Modules/Storage/SetCookieCommand.cs index f03bbbcc5bbf7..c34196abff93d 100644 --- a/dotnet/src/webdriver/BiDi/Modules/Storage/SetCookieCommand.cs +++ b/dotnet/src/webdriver/BiDi/Modules/Storage/SetCookieCommand.cs @@ -23,7 +23,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Storage; internal class SetCookieCommand(SetCookieCommandParameters @params) - : Command(@params, "storage.setCookie"); + : Command(@params, "storage.setCookie"); internal record SetCookieCommandParameters(PartialCookie Cookie, PartitionDescriptor? Partition) : CommandParameters; @@ -45,4 +45,4 @@ public record SetCookieOptions : CommandOptions public PartitionDescriptor? Partition { get; set; } } -public record SetCookieResult(PartitionKey PartitionKey); +public record SetCookieResult(PartitionKey PartitionKey) : EmptyResult;