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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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<Parameters, CloseResult>(Parameters.Empty, "browser.close");

public sealed class CloseOptions : CommandOptions;
public sealed record CloseOptions : CommandOptions;

public sealed record CloseResult : EmptyResult;
8 changes: 4 additions & 4 deletions dotnet/src/webdriver/BiDi/Browser/CreateUserContextCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ internal sealed class CreateUserContextCommand(CreateUserContextParameters @para

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

public sealed class CreateUserContextOptions : CommandOptions
public sealed record CreateUserContextOptions : CommandOptions
{
public bool? AcceptInsecureCerts { get; set; }
public bool? AcceptInsecureCerts { get; init; }

public Session.ProxyConfiguration? Proxy { get; set; }
public Session.ProxyConfiguration? Proxy { get; init; }

public Session.UserPromptHandler? UnhandledPromptBehavior { get; set; }
public Session.UserPromptHandler? UnhandledPromptBehavior { get; init; }
}

public sealed record CreateUserContextResult(UserContext UserContext) : UserContextInfo(UserContext);
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ namespace OpenQA.Selenium.BiDi.Browser;
internal sealed class GetClientWindowsCommand()
: Command<Parameters, GetClientWindowsResult>(Parameters.Empty, "browser.getClientWindows");

public sealed class GetClientWindowsOptions : CommandOptions;
public sealed record GetClientWindowsOptions : CommandOptions;

public sealed record GetClientWindowsResult(IReadOnlyList<ClientWindowInfo> ClientWindows) : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ namespace OpenQA.Selenium.BiDi.Browser;
internal sealed class GetUserContextsCommand()
: Command<Parameters, GetUserContextsResult>(Parameters.Empty, "browser.getUserContexts");

public class GetUserContextsOptions : CommandOptions;
public record GetUserContextsOptions : CommandOptions;

public sealed record GetUserContextsResult(IReadOnlyList<UserContextInfo> UserContexts) : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ internal sealed class RemoveUserContextCommand(RemoveUserContextParameters @para

internal sealed record RemoveUserContextParameters(UserContext UserContext) : Parameters;

public sealed class RemoveUserContextOptions : CommandOptions;
public sealed record RemoveUserContextOptions : CommandOptions;

public sealed record RemoveUserContextResult : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ internal sealed record DownloadBehaviorAllowed(string DestinationFolder) : Downl

internal sealed record DownloadBehaviorDenied : DownloadBehavior;

public sealed class SetDownloadBehaviorOptions : CommandOptions
public sealed record SetDownloadBehaviorOptions : CommandOptions
{
public IEnumerable<UserContext>? UserContexts { get; set; }
public IEnumerable<UserContext>? UserContexts { get; init; }
}

public sealed record SetDownloadBehaviorResult : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ internal sealed class ActivateCommand(ActivateParameters @params)

internal sealed record ActivateParameters(BrowsingContext Context) : Parameters;

public sealed class ActivateOptions : CommandOptions;
public sealed record ActivateOptions : CommandOptions;

public sealed record ActivateResult : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ private void HandleAuthRequired(AuthRequiredEventArgs e, Action<AuthRequiredEven
}
}

public sealed class InterceptRequestOptions : ContextAddInterceptOptions;
public sealed record InterceptRequestOptions : ContextAddInterceptOptions;

public sealed class InterceptResponseOptions : ContextAddInterceptOptions;
public sealed record InterceptResponseOptions : ContextAddInterceptOptions;

public sealed class InterceptAuthOptions : ContextAddInterceptOptions;
public sealed record InterceptAuthOptions : ContextAddInterceptOptions;
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ public Task<GetRealmsResult> GetRealmsAsync(ContextGetRealmsOptions? options = n

public Task<EvaluateResult> EvaluateAsync([StringSyntax(StringSyntaxConstants.JavaScript)] string expression, bool awaitPromise, EvaluateOptions? options = null, ContextTargetOptions? targetOptions = null, CancellationToken cancellationToken = default)
{
var contextTarget = new ContextTarget(context);

if (targetOptions is not null)
var contextTarget = new ContextTarget(context)
{
contextTarget.Sandbox = targetOptions.Sandbox;
}
Sandbox = targetOptions?.Sandbox
};

return scriptModule.EvaluateAsync(expression, awaitPromise, contextTarget, options, cancellationToken);
}
Expand All @@ -57,12 +55,10 @@ public Task<EvaluateResult> EvaluateAsync([StringSyntax(StringSyntaxConstants.Ja

public Task<EvaluateResult> CallFunctionAsync([StringSyntax(StringSyntaxConstants.JavaScript)] string functionDeclaration, bool awaitPromise, CallFunctionOptions? options = null, ContextTargetOptions? targetOptions = null, CancellationToken cancellationToken = default)
{
var contextTarget = new ContextTarget(context);

if (targetOptions is not null)
var contextTarget = new ContextTarget(context)
{
contextTarget.Sandbox = targetOptions.Sandbox;
}
Sandbox = targetOptions?.Sandbox
};

return scriptModule.CallFunctionAsync(functionDeclaration, awaitPromise, contextTarget, options, cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ internal sealed class CaptureScreenshotCommand(CaptureScreenshotParameters @para

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

public sealed class CaptureScreenshotOptions : CommandOptions
public sealed record CaptureScreenshotOptions : CommandOptions
{
public ScreenshotOrigin? Origin { get; set; }
public ScreenshotOrigin? Origin { get; init; }

public ImageFormat? Format { get; set; }
public ImageFormat? Format { get; init; }

public ClipRectangle? Clip { get; set; }
public ClipRectangle? Clip { get; init; }
}

[JsonConverter(typeof(CamelCaseEnumConverter<ScreenshotOrigin>))]
Expand All @@ -46,7 +46,7 @@ public enum ScreenshotOrigin

public record struct ImageFormat(string Type)
{
public double? Quality { get; set; }
public double? Quality { get; init; }
}

[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/BrowsingContext/CloseCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ internal sealed class CloseCommand(CloseParameters @params)

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

public sealed class CloseOptions : CommandOptions
public sealed record CloseOptions : CommandOptions
{
public bool? PromptUnload { get; set; }
public bool? PromptUnload { get; init; }
}

public sealed record CloseResult : EmptyResult;
8 changes: 4 additions & 4 deletions dotnet/src/webdriver/BiDi/BrowsingContext/CreateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ internal sealed class CreateCommand(CreateParameters @params)

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

public sealed class CreateOptions : CommandOptions
public sealed record CreateOptions : CommandOptions
{
public BrowsingContext? ReferenceContext { get; set; }
public BrowsingContext? ReferenceContext { get; init; }

public bool? Background { get; set; }
public bool? Background { get; init; }

public Browser.UserContext? UserContext { get; set; }
public Browser.UserContext? UserContext { get; init; }
}

[JsonConverter(typeof(CamelCaseEnumConverter<ContextType>))]
Expand Down
10 changes: 5 additions & 5 deletions dotnet/src/webdriver/BiDi/BrowsingContext/GetTreeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ internal sealed class GetTreeCommand(GetTreeParameters @params)

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

public sealed class GetTreeOptions : CommandOptions
public sealed record GetTreeOptions : CommandOptions
{
public long? MaxDepth { get; set; }
public long? MaxDepth { get; init; }

public BrowsingContext? Root { get; set; }
public BrowsingContext? Root { get; init; }
}

public sealed class ContextGetTreeOptions : CommandOptions
public sealed record ContextGetTreeOptions : CommandOptions
{
public long? MaxDepth { get; set; }
public long? MaxDepth { get; init; }

internal static GetTreeOptions WithContext(ContextGetTreeOptions? options, BrowsingContext context) => new()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ internal sealed class HandleUserPromptCommand(HandleUserPromptParameters @params

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

public sealed class HandleUserPromptOptions : CommandOptions
public sealed record HandleUserPromptOptions : CommandOptions
{
public bool? Accept { get; set; }
public bool? Accept { get; init; }

public string? UserText { get; set; }
public string? UserText { get; init; }
}

public sealed record HandleUserPromptResult : EmptyResult;
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ internal sealed class LocateNodesCommand(LocateNodesParameters @params)

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

public sealed class LocateNodesOptions : CommandOptions
public sealed record LocateNodesOptions : CommandOptions
{
public long? MaxNodeCount { get; set; }
public long? MaxNodeCount { get; init; }

public Script.SerializationOptions? SerializationOptions { get; set; }
public Script.SerializationOptions? SerializationOptions { get; init; }

public IEnumerable<Script.ISharedReference>? StartNodes { get; set; }
public IEnumerable<Script.ISharedReference>? StartNodes { get; init; }
}

public sealed record LocateNodesResult(IReadOnlyList<Script.NodeRemoteValue> Nodes) : EmptyResult;
10 changes: 5 additions & 5 deletions dotnet/src/webdriver/BiDi/BrowsingContext/Locator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ public sealed record ContextLocator(ContextValue Value) : Locator;

public sealed record InnerTextLocator(string Value) : Locator
{
public bool? IgnoreCase { get; set; }
public bool? IgnoreCase { get; init; }

public MatchType? MatchType { get; set; }
public MatchType? MatchType { get; init; }

public long? MaxDepth { get; set; }
public long? MaxDepth { get; init; }
}

public sealed record XPathLocator(string Value) : Locator;

public sealed record AccessibilityValue
{
public string? Name { get; set; }
public string? Role { get; set; }
public string? Name { get; init; }
public string? Role { get; init; }
}

public sealed record ContextValue(BrowsingContext Context);
Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/BrowsingContext/NavigateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ internal sealed class NavigateCommand(NavigateParameters @params)

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

public sealed class NavigateOptions : CommandOptions
public sealed record NavigateOptions : CommandOptions
{
public ReadinessState? Wait { get; set; }
public ReadinessState? Wait { get; init; }
}

[JsonConverter(typeof(CamelCaseEnumConverter<ReadinessState>))]
Expand Down
28 changes: 14 additions & 14 deletions dotnet/src/webdriver/BiDi/BrowsingContext/PrintCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,32 @@ internal sealed class PrintCommand(PrintParameters @params)

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
public sealed record PrintOptions : CommandOptions
{
public bool? Background { get; set; }
public bool? Background { get; init; }

public PrintMargin? Margin { get; set; }
public PrintMargin? Margin { get; init; }

public PrintOrientation? Orientation { get; set; }
public PrintOrientation? Orientation { get; init; }

public PrintPage? Page { get; set; }
public PrintPage? Page { get; init; }

public IEnumerable<PrintPageRange>? PageRanges { get; set; }
public IEnumerable<PrintPageRange>? PageRanges { get; init; }

public double? Scale { get; set; }
public double? Scale { get; init; }

public bool? ShrinkToFit { get; set; }
public bool? ShrinkToFit { get; init; }
}

public struct PrintMargin
{
public double? Bottom { get; set; }
public double? Bottom { get; init; }

public double? Left { get; set; }
public double? Left { get; init; }

public double? Right { get; set; }
public double? Right { get; init; }

public double? Top { get; set; }
public double? Top { get; init; }
}

[JsonConverter(typeof(CamelCaseEnumConverter<PrintOrientation>))]
Expand All @@ -66,9 +66,9 @@ public enum PrintOrientation

public struct PrintPage
{
public double? Height { get; set; }
public double? Height { get; init; }

public double? Width { get; set; }
public double? Width { get; init; }
}

[JsonConverter(typeof(PrintPageRangeConverter))]
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 @@ -24,11 +24,11 @@ internal sealed class ReloadCommand(ReloadParameters @params)

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

public sealed class ReloadOptions : CommandOptions
public sealed record ReloadOptions : CommandOptions
{
public bool? IgnoreCache { get; set; }
public bool? IgnoreCache { get; init; }

public ReadinessState? Wait { get; set; }
public ReadinessState? Wait { get; init; }
}

public sealed record ReloadResult(Navigation? Navigation, string Url) : NavigateResult(Navigation, Url);
16 changes: 8 additions & 8 deletions dotnet/src/webdriver/BiDi/BrowsingContext/SetViewportCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ internal sealed record SetViewportParameters(
IEnumerable<Browser.UserContext>? UserContexts)
: Parameters;

public sealed class SetViewportOptions : CommandOptions
public sealed record SetViewportOptions : CommandOptions
{
public BrowsingContext? Context { get; set; }
public BrowsingContext? Context { get; init; }

public Optional<Viewport?>? Viewport { get; set; }
public Optional<Viewport?>? Viewport { get; init; }

public Optional<double?>? DevicePixelRatio { get; set; }
public Optional<double?>? DevicePixelRatio { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; set; }
public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
}

public sealed class ContextSetViewportOptions : CommandOptions
public sealed record ContextSetViewportOptions : CommandOptions
{
public Optional<Viewport?>? Viewport { get; set; }
public Optional<Viewport?>? Viewport { get; init; }

public Optional<double?>? DevicePixelRatio { get; set; }
public Optional<double?>? DevicePixelRatio { get; init; }

internal static SetViewportOptions WithContext(ContextSetViewportOptions? options, BrowsingContext context) => new()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ internal sealed class TraverseHistoryCommand(TraverseHistoryParameters @params)

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

public sealed class TraverseHistoryOptions : CommandOptions;
public sealed record TraverseHistoryOptions : CommandOptions;

public sealed record TraverseHistoryResult : EmptyResult;
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/CommandOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace OpenQA.Selenium.BiDi;

public abstract class CommandOptions
public abstract record CommandOptions
{
public TimeSpan? Timeout { get; set; }
public TimeSpan? Timeout { get; init; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ internal sealed class SetForcedColorsModeThemeOverrideCommand(SetForcedColorsMod

internal sealed record SetForcedColorsModeThemeOverrideParameters([property: JsonIgnore(Condition = JsonIgnoreCondition.Never)] ForcedColorsModeTheme? Theme, IEnumerable<BrowsingContext.BrowsingContext>? Contexts, IEnumerable<Browser.UserContext>? UserContexts) : Parameters;

public sealed class SetForcedColorsModeThemeOverrideOptions : CommandOptions
public sealed record SetForcedColorsModeThemeOverrideOptions : CommandOptions
{
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; set; }
public IEnumerable<BrowsingContext.BrowsingContext>? Contexts { get; init; }

public IEnumerable<Browser.UserContext>? UserContexts { get; set; }
public IEnumerable<Browser.UserContext>? UserContexts { get; init; }
}

[JsonConverter(typeof(CamelCaseEnumConverter<ForcedColorsModeTheme>))]
Expand Down
Loading
Loading