Table of Contents

Class DownloadEndEventArgs

Namespace
WebDriverBiDi.BrowsingContext
Assembly
WebDriverBiDi.dll

Object containing event data for the browsingContext.downloadEnd event. The event data is a DownloadCompleteEventArgs when the download completed, and a DownloadCanceledEventArgs when it was canceled; only a completed download has a file path.

[JsonConverter(typeof(DiscriminatedUnionJsonConverter<DownloadEndEventArgs>))]
[DiscriminatedTypeProperty("status")]
[DiscriminatedDerivedType(typeof(DownloadCompleteEventArgs), "complete")]
[DiscriminatedDerivedType(typeof(DownloadCanceledEventArgs), "canceled")]
public abstract record DownloadEndEventArgs : NavigationEventArgs, IEquatable<WebDriverBiDiEventArgs>, IEquatable<NavigationEventArgs>, IEquatable<DownloadEndEventArgs>
Inheritance
DownloadEndEventArgs
Implements
Derived
Inherited Members

Constructors

DownloadEndEventArgs(DownloadEndEventArgs)

protected DownloadEndEventArgs(DownloadEndEventArgs original)

Parameters

original DownloadEndEventArgs

Properties

DownloadId

Gets the ID for this download.

[JsonPropertyName("download")]
[JsonRequired]
[JsonInclude]
public string DownloadId { get; }

Property Value

string

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

Status

Gets the status of the download. The status determines the type of this object: Complete for DownloadCompleteEventArgs, and Canceled for DownloadCanceledEventArgs.

[JsonPropertyName("status")]
[JsonInclude]
[JsonRequired]
public DownloadEndStatus Status { get; }

Property Value

DownloadEndStatus

Methods

As<T>()

Casts this DownloadEndEventArgs to a status-specific download end event args, throwing if it is not of that type. Use TryAs<T>(out T?) to test without throwing.

public T As<T>() where T : DownloadEndEventArgs

Returns

T

This instance cast to the specified type.

Type Parameters

T

The specific type of DownloadEndEventArgs to return.

Exceptions

WebDriverBiDiException

Thrown if this DownloadEndEventArgs is not the specified type.

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Equals(DownloadEndEventArgs?)

public virtual bool Equals(DownloadEndEventArgs? other)

Parameters

other DownloadEndEventArgs

Returns

bool

Equals(NavigationEventArgs?)

public override sealed bool Equals(NavigationEventArgs? other)

Parameters

other NavigationEventArgs

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

TryAs<T>(out T?)

Attempts to cast this DownloadEndEventArgs to a status-specific download end event args, returning false rather than throwing when it is not of that type.

public bool TryAs<T>(out T? result) where T : DownloadEndEventArgs

Parameters

result T

When this method returns, contains the cast value or null if the cast failed.

Returns

bool

true if the cast was successful; otherwise, false.

Type Parameters

T

The specific type of DownloadEndEventArgs to return.

Operators

operator ==(DownloadEndEventArgs?, DownloadEndEventArgs?)

public static bool operator ==(DownloadEndEventArgs? left, DownloadEndEventArgs? right)

Parameters

left DownloadEndEventArgs
right DownloadEndEventArgs

Returns

bool

operator !=(DownloadEndEventArgs?, DownloadEndEventArgs?)

public static bool operator !=(DownloadEndEventArgs? left, DownloadEndEventArgs? right)

Parameters

left DownloadEndEventArgs
right DownloadEndEventArgs

Returns

bool