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
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record BrowsingContextInfo(BiDi BiDi, IReadOnlyList<BrowsingContextInfo>? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent)
: BrowsingContextEventArgs(BiDi, Context);
public sealed record BrowsingContextInfo(IReadOnlyList<BrowsingContextInfo>? Children, Browser.ClientWindow ClientWindow, BrowsingContext Context, BrowsingContext? OriginalOpener, string Url, Browser.UserContext UserContext, BrowsingContext? Parent)
: BrowsingContextEventArgs(Context);
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ namespace OpenQA.Selenium.BiDi.BrowsingContext;
//[JsonDerivedType(typeof(DownloadCanceledEventArgs), "canceled")]
//[JsonDerivedType(typeof(DownloadCompleteEventArgs), "complete")]
[JsonConverter(typeof(DownloadEndEventArgsConverter))]
public abstract record DownloadEndEventArgs(BiDi BiDi, BrowsingContext Context)
: BrowsingContextEventArgs(BiDi, Context);
public abstract record DownloadEndEventArgs(BrowsingContext Context)
: BrowsingContextEventArgs(Context);

public sealed record DownloadCanceledEventArgs(BiDi BiDi, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: DownloadEndEventArgs(BiDi, Context), IBaseNavigationInfo;
public sealed record DownloadCanceledEventArgs(BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: DownloadEndEventArgs(Context), IBaseNavigationInfo;

public sealed record DownloadCompleteEventArgs(BiDi BiDi, string? Filepath, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: DownloadEndEventArgs(BiDi, Context), IBaseNavigationInfo;
public sealed record DownloadCompleteEventArgs(string? Filepath, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: DownloadEndEventArgs(Context), IBaseNavigationInfo;
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record DownloadWillBeginEventArgs(BiDi BiDi, string SuggestedFilename, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: BrowsingContextEventArgs(BiDi, Context), IBaseNavigationInfo;
public sealed record DownloadWillBeginEventArgs(string SuggestedFilename, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: BrowsingContextEventArgs(Context), IBaseNavigationInfo;
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record HistoryUpdatedEventArgs(BiDi BiDi, BrowsingContext Context, DateTimeOffset Timestamp, string Url)
: BrowsingContextEventArgs(BiDi, Context);
public sealed record HistoryUpdatedEventArgs(BrowsingContext Context, DateTimeOffset Timestamp, string Url)
: BrowsingContextEventArgs(Context);
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/BrowsingContext/NavigationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record NavigationInfo(BiDi BiDi, BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: BrowsingContextEventArgs(BiDi, Context), IBaseNavigationInfo;
public sealed record NavigationInfo(BrowsingContext Context, Navigation? Navigation, DateTimeOffset Timestamp, string Url)
: BrowsingContextEventArgs(Context), IBaseNavigationInfo;
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record UserPromptClosedEventArgs(BiDi BiDi, BrowsingContext Context, bool Accepted, string? UserText)
: BrowsingContextEventArgs(BiDi, Context);
public sealed record UserPromptClosedEventArgs(BrowsingContext Context, bool Accepted, string? UserText)
: BrowsingContextEventArgs(Context);
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

namespace OpenQA.Selenium.BiDi.BrowsingContext;

public sealed record UserPromptOpenedEventArgs(BiDi BiDi, BrowsingContext Context, Session.UserPromptHandlerType Handler, UserPromptType Type, string Message, string? DefaultValue)
: BrowsingContextEventArgs(BiDi, Context);
public sealed record UserPromptOpenedEventArgs(BrowsingContext Context, Session.UserPromptHandlerType Handler, UserPromptType Type, string Message, string? DefaultValue)
: BrowsingContextEventArgs(Context);

[JsonConverter(typeof(CamelCaseEnumConverter<UserPromptType>))]
public enum UserPromptType
Expand Down
8 changes: 4 additions & 4 deletions dotnet/src/webdriver/BiDi/EventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

namespace OpenQA.Selenium.BiDi;

public abstract record EventArgs(BiDi BiDi)
public abstract record EventArgs
{
[JsonIgnore]
public BiDi BiDi { get; internal set; } = BiDi;
public BiDi BiDi { get; internal set; }
}

public abstract record BrowsingContextEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext Context)
: EventArgs(BiDi);
public abstract record BrowsingContextEventArgs(BrowsingContext.BrowsingContext Context)
: EventArgs;
16 changes: 8 additions & 8 deletions dotnet/src/webdriver/BiDi/Log/LogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ namespace OpenQA.Selenium.BiDi.Log;
//[JsonDerivedType(typeof(ConsoleLogEntry), "console")]
//[JsonDerivedType(typeof(JavascriptLogEntry), "javascript")]
[JsonConverter(typeof(LogEntryConverter))]
public abstract record LogEntry(BiDi BiDi, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp)
: EventArgs(BiDi)
public abstract record LogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp)
: EventArgs
{
public Script.StackTrace? StackTrace { get; set; }
}

public sealed record GenericLogEntry(BiDi BiDi, string Type, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp)
: LogEntry(BiDi, Level, Source, Text, Timestamp);
public sealed record GenericLogEntry(string Type, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp)
: LogEntry(Level, Source, Text, Timestamp);

public sealed record ConsoleLogEntry(BiDi BiDi, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp, string Method, IReadOnlyList<Script.RemoteValue> Args)
: LogEntry(BiDi, Level, Source, Text, Timestamp);
public sealed record ConsoleLogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp, string Method, IReadOnlyList<Script.RemoteValue> Args)
: LogEntry(Level, Source, Text, Timestamp);

public sealed record JavascriptLogEntry(BiDi BiDi, Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp)
: LogEntry(BiDi, Level, Source, Text, Timestamp);
public sealed record JavascriptLogEntry(Level Level, Script.Source Source, string? Text, DateTimeOffset Timestamp)
: LogEntry(Level, Source, Text, Timestamp);

[JsonConverter(typeof(CamelCaseEnumConverter<Level>))]
public enum Level
Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/Network/AuthRequiredEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@

namespace OpenQA.Selenium.BiDi.Network;

public record AuthRequiredEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList<Intercept>? Intercepts) :
BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
public record AuthRequiredEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList<Intercept>? Intercepts) :
BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
6 changes: 3 additions & 3 deletions dotnet/src/webdriver/BiDi/Network/BaseParametersEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
// under the License.
// </copyright>

using System.Collections.Generic;
using System;
using System.Collections.Generic;

namespace OpenQA.Selenium.BiDi.Network;

public abstract record BaseParametersEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, IReadOnlyList<Intercept>? Intercepts)
: BrowsingContextEventArgs(BiDi, Context);
public abstract record BaseParametersEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, IReadOnlyList<Intercept>? Intercepts)
: BrowsingContextEventArgs(Context);
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@

namespace OpenQA.Selenium.BiDi.Network;

public record BeforeRequestSentEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, Initiator Initiator, IReadOnlyList<Intercept>? Intercepts)
: BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
public record BeforeRequestSentEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, Initiator Initiator, IReadOnlyList<Intercept>? Intercepts)
: BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/Network/FetchErrorEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@

namespace OpenQA.Selenium.BiDi.Network;

public sealed record FetchErrorEventArgs(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, string ErrorText, IReadOnlyList<Intercept>? Intercepts)
: BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
public sealed record FetchErrorEventArgs(BrowsingContext.BrowsingContext? Context, bool IsBlocked, Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, string ErrorText, IReadOnlyList<Intercept>? Intercepts)
: BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
27 changes: 21 additions & 6 deletions dotnet/src/webdriver/BiDi/Network/NetworkModule.HighLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ public sealed class InterceptResponseOptions : AddInterceptOptions;

public sealed class InterceptAuthOptions : AddInterceptOptions;

public sealed record InterceptedRequest(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, Initiator Initiator, IReadOnlyList<Intercept>? Intercepts)
: BeforeRequestSentEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Initiator, Intercepts)
public sealed record InterceptedRequest : BeforeRequestSentEventArgs
{
internal InterceptedRequest(BiDi bidi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, Initiator initiator, IReadOnlyList<Intercept>? intercepts)
: base(context, isBlocked, navigation, redirectCount, request, timestamp, initiator, intercepts)
{
BiDi = bidi;
}

public Task ContinueAsync(ContinueRequestOptions? options = null)
{
return BiDi.Network.ContinueRequestAsync(Request.Request, options);
Expand All @@ -78,18 +83,28 @@ public Task ProvideResponseAsync(ProvideResponseOptions? options = null)
}
}

public sealed record InterceptedResponse(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList<Intercept>? Intercepts)
: ResponseStartedEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Response, Intercepts)
public sealed record InterceptedResponse : ResponseStartedEventArgs
{
internal InterceptedResponse(BiDi bidi, BrowsingContext.BrowsingContext? context, bool isBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList<Intercept>? intercepts)
: base(context, isBlocked, navigation, redirectCount, request, timestamp, response, intercepts)
{
BiDi = bidi;
}

public Task ContinueAsync(ContinueResponseOptions? options = null)
{
return BiDi.Network.ContinueResponseAsync(Request.Request, options);
}
}

public sealed record InterceptedAuth(BiDi BiDi, BrowsingContext.BrowsingContext? Context, bool IsBlocked, BrowsingContext.Navigation? Navigation, long RedirectCount, RequestData Request, DateTimeOffset Timestamp, ResponseData Response, IReadOnlyList<Intercept>? Intercepts)
: AuthRequiredEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Response, Intercepts)
public sealed record InterceptedAuth : AuthRequiredEventArgs
{
internal InterceptedAuth(BiDi bidi, BrowsingContext.BrowsingContext? context, bool IsBlocked, BrowsingContext.Navigation? navigation, long redirectCount, RequestData request, DateTimeOffset timestamp, ResponseData response, IReadOnlyList<Intercept>? intercepts)
: base(context, IsBlocked, navigation, redirectCount, request, timestamp, response, intercepts)
{
BiDi = bidi;
}

public Task ContinueAsync(AuthCredentials credentials, ContinueWithAuthCredentialsOptions? options = null)
{
return BiDi.Network.ContinueWithAuthAsync(Request.Request, credentials, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OpenQA.Selenium.BiDi.Network;

public sealed record ResponseCompletedEventArgs(BiDi BiDi,
public sealed record ResponseCompletedEventArgs(
BrowsingContext.BrowsingContext? Context,
bool IsBlocked,
Navigation? Navigation,
Expand All @@ -32,4 +32,4 @@ public sealed record ResponseCompletedEventArgs(BiDi BiDi,
DateTimeOffset Timestamp,
ResponseData Response,
IReadOnlyList<Intercept>? Intercepts)
: BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
: BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
4 changes: 2 additions & 2 deletions dotnet/src/webdriver/BiDi/Network/ResponseStartedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OpenQA.Selenium.BiDi.Network;

public record ResponseStartedEventArgs(BiDi BiDi,
public record ResponseStartedEventArgs(
BrowsingContext.BrowsingContext? Context,
bool IsBlocked,
Navigation? Navigation,
Expand All @@ -32,4 +32,4 @@ public record ResponseStartedEventArgs(BiDi BiDi,
DateTimeOffset Timestamp,
ResponseData Response,
IReadOnlyList<Intercept>? Intercepts)
: BaseParametersEventArgs(BiDi, Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
: BaseParametersEventArgs(Context, IsBlocked, Navigation, RedirectCount, Request, Timestamp, Intercepts);
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/Script/MessageEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

namespace OpenQA.Selenium.BiDi.Script;

public sealed record MessageEventArgs(BiDi BiDi, Channel Channel, RemoteValue Data, Source Source) : EventArgs(BiDi);
public sealed record MessageEventArgs(Channel Channel, RemoteValue Data, Source Source) : EventArgs;
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

namespace OpenQA.Selenium.BiDi.Script;

public sealed record RealmDestroyedEventArgs(BiDi BiDi, Realm Realm) : EventArgs(BiDi);
public sealed record RealmDestroyedEventArgs(Realm Realm) : EventArgs;
18 changes: 9 additions & 9 deletions dotnet/src/webdriver/BiDi/Script/RealmInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ namespace OpenQA.Selenium.BiDi.Script;
//[JsonDerivedType(typeof(AudioWorkletRealmInfo), "audio-worklet")]
//[JsonDerivedType(typeof(WorkletRealmInfo), "worklet")]
[JsonConverter(typeof(RealmInfoConverter))]
public abstract record RealmInfo(BiDi BiDi, Realm Realm, string Origin) : EventArgs(BiDi);
public abstract record RealmInfo(Realm Realm, string Origin) : EventArgs;

public sealed record WindowRealmInfo(BiDi BiDi, Realm Realm, string Origin, BrowsingContext.BrowsingContext Context) : RealmInfo(BiDi, Realm, Origin)
public sealed record WindowRealmInfo(Realm Realm, string Origin, BrowsingContext.BrowsingContext Context) : RealmInfo(Realm, Origin)
{
public string? Sandbox { get; set; }
}

public sealed record DedicatedWorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin, IReadOnlyList<Realm> Owners) : RealmInfo(BiDi, Realm, Origin);
public sealed record DedicatedWorkerRealmInfo(Realm Realm, string Origin, IReadOnlyList<Realm> Owners) : RealmInfo(Realm, Origin);

public sealed record SharedWorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin);
public sealed record SharedWorkerRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin);

public sealed record ServiceWorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin);
public sealed record ServiceWorkerRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin);

public sealed record WorkerRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin);
public sealed record WorkerRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin);

public sealed record PaintWorkletRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin);
public sealed record PaintWorkletRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin);

public sealed record AudioWorkletRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin);
public sealed record AudioWorkletRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin);

public sealed record WorkletRealmInfo(BiDi BiDi, Realm Realm, string Origin) : RealmInfo(BiDi, Realm, Origin);
public sealed record WorkletRealmInfo(Realm Realm, string Origin) : RealmInfo(Realm, Origin);