Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/Browser/BrowserModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task<EmptyResult> CloseAsync(CloseOptions? options = null)

public async Task<UserContextInfo> CreateUserContextAsync(CreateUserContextOptions? options = null)
{
var @params = new CreateUserContextCommandParameters(options?.AcceptInsecureCerts, options?.Proxy, options?.UnhandledPromptBehavior);
var @params = new CreateUserContextParameters(options?.AcceptInsecureCerts, options?.Proxy, options?.UnhandledPromptBehavior);

return await Broker.ExecuteCommandAsync<CreateUserContextCommand, UserContextInfo>(new CreateUserContextCommand(@params), options).ConfigureAwait(false);
}
Expand All @@ -43,7 +43,7 @@ public async Task<GetUserContextsResult> GetUserContextsAsync(GetUserContextsOpt

public async Task<EmptyResult> RemoveUserContextAsync(UserContext userContext, RemoveUserContextOptions? options = null)
{
var @params = new RemoveUserContextCommandParameters(userContext);
var @params = new RemoveUserContextParameters(userContext);

return await Broker.ExecuteCommandAsync<RemoveUserContextCommand, EmptyResult>(new RemoveUserContextCommand(@params), options).ConfigureAwait(false);
}
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/Browser/CloseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
namespace OpenQA.Selenium.BiDi.Browser;

internal sealed class CloseCommand()
: Command<CommandParameters, EmptyResult>(CommandParameters.Empty, "browser.close");
: Command<Parameters, EmptyResult>(Parameters.Empty, "browser.close");

public sealed class CloseOptions : CommandOptions;
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/Browser/CreateUserContextCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.Browser;

internal sealed class CreateUserContextCommand(CreateUserContextCommandParameters @params)
: Command<CreateUserContextCommandParameters, UserContextInfo>(@params, "browser.createUserContext");
internal sealed class CreateUserContextCommand(CreateUserContextParameters @params)
: Command<CreateUserContextParameters, UserContextInfo>(@params, "browser.createUserContext");

internal sealed record CreateUserContextCommandParameters(bool? AcceptInsecureCerts, Session.ProxyConfiguration? Proxy, Session.UserPromptHandler? UnhandledPromptBehavior) : CommandParameters;
internal sealed record CreateUserContextParameters(bool? AcceptInsecureCerts, Session.ProxyConfiguration? Proxy, Session.UserPromptHandler? UnhandledPromptBehavior) : Parameters;

public sealed class CreateUserContextOptions : CommandOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace OpenQA.Selenium.BiDi.Browser;

internal sealed class GetClientWindowsCommand()
: Command<CommandParameters, GetClientWindowsResult>(CommandParameters.Empty, "browser.getClientWindows");
: Command<Parameters, GetClientWindowsResult>(Parameters.Empty, "browser.getClientWindows");

public sealed class GetClientWindowsOptions : CommandOptions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace OpenQA.Selenium.BiDi.Browser;

internal sealed class GetUserContextsCommand()
: Command<CommandParameters, GetUserContextsResult>(CommandParameters.Empty, "browser.getUserContexts");
: Command<Parameters, GetUserContextsResult>(Parameters.Empty, "browser.getUserContexts");

public class GetUserContextsOptions : CommandOptions;

Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/Browser/RemoveUserContextCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace OpenQA.Selenium.BiDi.Browser;

internal sealed class RemoveUserContextCommand(RemoveUserContextCommandParameters @params)
: Command<RemoveUserContextCommandParameters, EmptyResult>(@params, "browser.removeUserContext");
internal sealed class RemoveUserContextCommand(RemoveUserContextParameters @params)
: Command<RemoveUserContextParameters, EmptyResult>(@params, "browser.removeUserContext");

internal sealed record RemoveUserContextCommandParameters(UserContext UserContext) : CommandParameters;
internal sealed record RemoveUserContextParameters(UserContext UserContext) : Parameters;

public sealed class RemoveUserContextOptions : CommandOptions;
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/ActivateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class ActivateCommand(ActivateCommandParameters @params)
: Command<ActivateCommandParameters, EmptyResult>(@params, "browsingContext.activate");
internal sealed class ActivateCommand(ActivateParameters @params)
: Command<ActivateParameters, EmptyResult>(@params, "browsingContext.activate");

internal sealed record ActivateCommandParameters(BrowsingContext Context) : CommandParameters;
internal sealed record ActivateParameters(BrowsingContext Context) : Parameters;

public sealed class ActivateOptions : CommandOptions;
24 changes: 12 additions & 12 deletions dotnet/src/webdriver/BiDi/BrowsingContext/BrowsingContextModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public sealed class BrowsingContextModule(Broker broker) : Module(broker)
{
public async Task<BrowsingContext> CreateAsync(ContextType type, CreateOptions? options = null)
{
var @params = new CreateCommandParameters(type, options?.ReferenceContext, options?.Background, options?.UserContext);
var @params = new CreateParameters(type, options?.ReferenceContext, options?.Background, options?.UserContext);

var createResult = await Broker.ExecuteCommandAsync<CreateCommand, CreateResult>(new CreateCommand(@params), options).ConfigureAwait(false);

Expand All @@ -36,77 +36,77 @@ public async Task<BrowsingContext> CreateAsync(ContextType type, CreateOptions?

public async Task<NavigateResult> NavigateAsync(BrowsingContext context, string url, NavigateOptions? options = null)
{
var @params = new NavigateCommandParameters(context, url, options?.Wait);
var @params = new NavigateParameters(context, url, options?.Wait);

return await Broker.ExecuteCommandAsync<NavigateCommand, NavigateResult>(new NavigateCommand(@params), options).ConfigureAwait(false);
}

public async Task<EmptyResult> ActivateAsync(BrowsingContext context, ActivateOptions? options = null)
{
var @params = new ActivateCommandParameters(context);
var @params = new ActivateParameters(context);

return await Broker.ExecuteCommandAsync<ActivateCommand, EmptyResult>(new ActivateCommand(@params), options).ConfigureAwait(false);
}

public async Task<LocateNodesResult> LocateNodesAsync(BrowsingContext context, Locator locator, LocateNodesOptions? options = null)
{
var @params = new LocateNodesCommandParameters(context, locator, options?.MaxNodeCount, options?.SerializationOptions, options?.StartNodes);
var @params = new LocateNodesParameters(context, locator, options?.MaxNodeCount, options?.SerializationOptions, options?.StartNodes);

return await Broker.ExecuteCommandAsync<LocateNodesCommand, LocateNodesResult>(new LocateNodesCommand(@params), options).ConfigureAwait(false);
}

public async Task<CaptureScreenshotResult> CaptureScreenshotAsync(BrowsingContext context, CaptureScreenshotOptions? options = null)
{
var @params = new CaptureScreenshotCommandParameters(context, options?.Origin, options?.Format, options?.Clip);
var @params = new CaptureScreenshotParameters(context, options?.Origin, options?.Format, options?.Clip);

return await Broker.ExecuteCommandAsync<CaptureScreenshotCommand, CaptureScreenshotResult>(new CaptureScreenshotCommand(@params), options).ConfigureAwait(false);
}

public async Task<EmptyResult> CloseAsync(BrowsingContext context, CloseOptions? options = null)
{
var @params = new CloseCommandParameters(context, options?.PromptUnload);
var @params = new CloseParameters(context, options?.PromptUnload);

return await Broker.ExecuteCommandAsync<CloseCommand, EmptyResult>(new CloseCommand(@params), options).ConfigureAwait(false);
}

public async Task<TraverseHistoryResult> TraverseHistoryAsync(BrowsingContext context, int delta, TraverseHistoryOptions? options = null)
{
var @params = new TraverseHistoryCommandParameters(context, delta);
var @params = new TraverseHistoryParameters(context, delta);

return await Broker.ExecuteCommandAsync<TraverseHistoryCommand, TraverseHistoryResult>(new TraverseHistoryCommand(@params), options).ConfigureAwait(false);
}

public async Task<NavigateResult> ReloadAsync(BrowsingContext context, ReloadOptions? options = null)
{
var @params = new ReloadCommandParameters(context, options?.IgnoreCache, options?.Wait);
var @params = new ReloadParameters(context, options?.IgnoreCache, options?.Wait);

return await Broker.ExecuteCommandAsync<ReloadCommand, NavigateResult>(new ReloadCommand(@params), options).ConfigureAwait(false);
}

public async Task<EmptyResult> SetViewportAsync(BrowsingContext context, SetViewportOptions? options = null)
{
var @params = new SetViewportCommandParameters(context, options?.Viewport, options?.DevicePixelRatio);
var @params = new SetViewportParameters(context, options?.Viewport, options?.DevicePixelRatio);

return await Broker.ExecuteCommandAsync<SetViewportCommand, EmptyResult>(new SetViewportCommand(@params), options).ConfigureAwait(false);
}

public async Task<GetTreeResult> GetTreeAsync(GetTreeOptions? options = null)
{
var @params = new GetTreeCommandParameters(options?.MaxDepth, options?.Root);
var @params = new GetTreeParameters(options?.MaxDepth, options?.Root);

return await Broker.ExecuteCommandAsync<GetTreeCommand, GetTreeResult>(new GetTreeCommand(@params), options).ConfigureAwait(false);
}

public async Task<PrintResult> PrintAsync(BrowsingContext context, PrintOptions? options = null)
{
var @params = new PrintCommandParameters(context, options?.Background, options?.Margin, options?.Orientation, options?.Page, options?.PageRanges, options?.Scale, options?.ShrinkToFit);
var @params = new PrintParameters(context, options?.Background, options?.Margin, options?.Orientation, options?.Page, options?.PageRanges, options?.Scale, options?.ShrinkToFit);

return await Broker.ExecuteCommandAsync<PrintCommand, PrintResult>(new PrintCommand(@params), options).ConfigureAwait(false);
}

public async Task<EmptyResult> HandleUserPromptAsync(BrowsingContext context, HandleUserPromptOptions? options = null)
{
var @params = new HandleUserPromptCommandParameters(context, options?.Accept, options?.UserText);
var @params = new HandleUserPromptParameters(context, options?.Accept, options?.UserText);

return await Broker.ExecuteCommandAsync<HandleUserPromptCommand, EmptyResult>(new HandleUserPromptCommand(@params), options).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class CaptureScreenshotCommand(CaptureScreenshotCommandParameters @params)
: Command<CaptureScreenshotCommandParameters, CaptureScreenshotResult>(@params, "browsingContext.captureScreenshot");
internal sealed class CaptureScreenshotCommand(CaptureScreenshotParameters @params)
: Command<CaptureScreenshotParameters, CaptureScreenshotResult>(@params, "browsingContext.captureScreenshot");

internal sealed record CaptureScreenshotCommandParameters(BrowsingContext Context, ScreenshotOrigin? Origin, ImageFormat? Format, ClipRectangle? Clip) : CommandParameters;
internal sealed record CaptureScreenshotParameters(BrowsingContext Context, ScreenshotOrigin? Origin, ImageFormat? Format, ClipRectangle? Clip) : Parameters;

public sealed class CaptureScreenshotOptions : CommandOptions
{
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/CloseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class CloseCommand(CloseCommandParameters @params)
: Command<CloseCommandParameters, EmptyResult>(@params, "browsingContext.close");
internal sealed class CloseCommand(CloseParameters @params)
: Command<CloseParameters, EmptyResult>(@params, "browsingContext.close");

internal sealed record CloseCommandParameters(BrowsingContext Context, bool? PromptUnload) : CommandParameters;
internal sealed record CloseParameters(BrowsingContext Context, bool? PromptUnload) : Parameters;

public sealed class CloseOptions : CommandOptions
{
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/CreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class CreateCommand(CreateCommandParameters @params)
: Command<CreateCommandParameters, CreateResult>(@params, "browsingContext.create");
internal sealed class CreateCommand(CreateParameters @params)
: Command<CreateParameters, CreateResult>(@params, "browsingContext.create");

internal sealed record CreateCommandParameters(ContextType Type, BrowsingContext? ReferenceContext, bool? Background, Browser.UserContext? UserContext) : CommandParameters;
internal sealed record CreateParameters(ContextType Type, BrowsingContext? ReferenceContext, bool? Background, Browser.UserContext? UserContext) : Parameters;

public sealed class CreateOptions : CommandOptions
{
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/GetTreeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class GetTreeCommand(GetTreeCommandParameters @params)
: Command<GetTreeCommandParameters, GetTreeResult>(@params, "browsingContext.getTree");
internal sealed class GetTreeCommand(GetTreeParameters @params)
: Command<GetTreeParameters, GetTreeResult>(@params, "browsingContext.getTree");

internal sealed record GetTreeCommandParameters(long? MaxDepth, BrowsingContext? Root) : CommandParameters;
internal sealed record GetTreeParameters(long? MaxDepth, BrowsingContext? Root) : Parameters;

public sealed class GetTreeOptions : CommandOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class HandleUserPromptCommand(HandleUserPromptCommandParameters @params)
: Command<HandleUserPromptCommandParameters, EmptyResult>(@params, "browsingContext.handleUserPrompt");
internal sealed class HandleUserPromptCommand(HandleUserPromptParameters @params)
: Command<HandleUserPromptParameters, EmptyResult>(@params, "browsingContext.handleUserPrompt");

internal sealed record HandleUserPromptCommandParameters(BrowsingContext Context, bool? Accept, string? UserText) : CommandParameters;
internal sealed record HandleUserPromptParameters(BrowsingContext Context, bool? Accept, string? UserText) : Parameters;

public sealed class HandleUserPromptOptions : CommandOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class LocateNodesCommand(LocateNodesCommandParameters @params)
: Command<LocateNodesCommandParameters, LocateNodesResult>(@params, "browsingContext.locateNodes");
internal sealed class LocateNodesCommand(LocateNodesParameters @params)
: Command<LocateNodesParameters, LocateNodesResult>(@params, "browsingContext.locateNodes");

internal sealed record LocateNodesCommandParameters(BrowsingContext Context, Locator Locator, long? MaxNodeCount, Script.SerializationOptions? SerializationOptions, IEnumerable<Script.ISharedReference>? StartNodes) : CommandParameters;
internal sealed record LocateNodesParameters(BrowsingContext Context, Locator Locator, long? MaxNodeCount, Script.SerializationOptions? SerializationOptions, IEnumerable<Script.ISharedReference>? StartNodes) : Parameters;

public sealed class LocateNodesOptions : CommandOptions
{
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class NavigateCommand(NavigateCommandParameters @params)
: Command<NavigateCommandParameters, NavigateResult>(@params, "browsingContext.navigate");
internal sealed class NavigateCommand(NavigateParameters @params)
: Command<NavigateParameters, NavigateResult>(@params, "browsingContext.navigate");

internal sealed record NavigateCommandParameters(BrowsingContext Context, string Url, ReadinessState? Wait) : CommandParameters;
internal sealed record NavigateParameters(BrowsingContext Context, string Url, ReadinessState? Wait) : Parameters;

public sealed class NavigateOptions : CommandOptions
{
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/PrintCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class PrintCommand(PrintCommandParameters @params)
: Command<PrintCommandParameters, PrintResult>(@params, "browsingContext.print");
internal sealed class PrintCommand(PrintParameters @params)
: Command<PrintParameters, PrintResult>(@params, "browsingContext.print");

internal sealed record PrintCommandParameters(BrowsingContext Context, bool? Background, PrintMargin? Margin, PrintOrientation? Orientation, PrintPage? Page, IEnumerable<PrintPageRange>? PageRanges, double? Scale, bool? ShrinkToFit) : CommandParameters;
internal sealed record PrintParameters(BrowsingContext Context, bool? Background, PrintMargin? Margin, PrintOrientation? Orientation, PrintPage? Page, IEnumerable<PrintPageRange>? PageRanges, double? Scale, bool? ShrinkToFit) : Parameters;

public sealed class PrintOptions : CommandOptions
{
Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/BrowsingContext/ReloadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class ReloadCommand(ReloadCommandParameters @params)
: Command<ReloadCommandParameters, NavigateResult>(@params, "browsingContext.reload");
internal sealed class ReloadCommand(ReloadParameters @params)
: Command<ReloadParameters, NavigateResult>(@params, "browsingContext.reload");

internal sealed record ReloadCommandParameters(BrowsingContext Context, bool? IgnoreCache, ReadinessState? Wait) : CommandParameters;
internal sealed record ReloadParameters(BrowsingContext Context, bool? IgnoreCache, ReadinessState? Wait) : Parameters;

public sealed class ReloadOptions : CommandOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class SetViewportCommand(SetViewportCommandParameters @params)
: Command<SetViewportCommandParameters, EmptyResult>(@params, "browsingContext.setViewport");
internal sealed class SetViewportCommand(SetViewportParameters @params)
: Command<SetViewportParameters, EmptyResult>(@params, "browsingContext.setViewport");

internal sealed record SetViewportCommandParameters(BrowsingContext Context, Viewport? Viewport, double? DevicePixelRatio) : CommandParameters;
internal sealed record SetViewportParameters(BrowsingContext Context, Viewport? Viewport, double? DevicePixelRatio) : Parameters;

public sealed class SetViewportOptions : CommandOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

internal sealed class TraverseHistoryCommand(TraverseHistoryCommandParameters @params)
: Command<TraverseHistoryCommandParameters, TraverseHistoryResult>(@params, "browsingContext.traverseHistory");
internal sealed class TraverseHistoryCommand(TraverseHistoryParameters @params)
: Command<TraverseHistoryParameters, TraverseHistoryResult>(@params, "browsingContext.traverseHistory");

internal sealed record TraverseHistoryCommandParameters(BrowsingContext Context, long Delta) : CommandParameters;
internal sealed record TraverseHistoryParameters(BrowsingContext Context, long Delta) : Parameters;

public sealed class TraverseHistoryOptions : CommandOptions;

Expand Down
12 changes: 6 additions & 6 deletions dotnet/src/webdriver/BiDi/Communication/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ protected Command(string method, Type resultType)
public Type ResultType { get; }
}

internal abstract class Command<TCommandParameters, TCommandResult>(TCommandParameters @params, string method) : Command(method, typeof(TCommandResult))
where TCommandParameters : CommandParameters
where TCommandResult : EmptyResult
internal abstract class Command<TParameters, TResult>(TParameters @params, string method) : Command(method, typeof(TResult))
where TParameters : Parameters
where TResult : EmptyResult
{
[JsonPropertyOrder(2)]
public TCommandParameters Params { get; } = @params;
public TParameters Params { get; } = @params;
}

internal record CommandParameters
internal record Parameters
{
public static CommandParameters Empty { get; } = new CommandParameters();
public static Parameters Empty { get; } = new Parameters();
}

public record EmptyResult;
Loading
Loading