Table of Contents

Interface IDOMSnapshot

Namespace
Selenium.WebDriver.BiDi.Cdp.DOMSnapshot
Assembly
Selenium.WebDriver.BiDi.Cdp.dll

This domain facilitates obtaining document snapshots with DOM, layout, and style information.

[Experimental("BIDICDP001")]
public interface IDOMSnapshot

Methods

CaptureSnapshotAsync(ImmutableArray<string>, bool?, bool?, bool?, bool?, string?, CancellationToken)

Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened.

Task<CaptureSnapshotResult> CaptureSnapshotAsync(ImmutableArray<string> computedStyles, bool? includePaintOrder = null, bool? includeDOMRects = null, bool? includeBlendedBackgroundColors = null, bool? includeTextColorOpacities = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

computedStyles ImmutableArray<string>

Whitelist of computed styles to return.

includePaintOrder bool?

Whether to include layout object paint orders into the snapshot.

includeDOMRects bool?

Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot

includeBlendedBackgroundColors bool?

Whether to include blended background colors in the snapshot (default: false). Blended background color is achieved by blending background colors of all elements that overlap with the current element.

includeTextColorOpacities bool?

Whether to include text color opacity in the snapshot (default: false). An element might have the opacity property set that affects the text color of the element. The final text color opacity is computed based on the opacity of all overlapping elements.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<CaptureSnapshotResult>

A task representing the asynchronous operation, containing a CaptureSnapshotResult.

DisableAsync(string?, CancellationToken)

Disables DOM snapshot agent for the given page.

Task<DisableResult> DisableAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<DisableResult>

A task representing the asynchronous operation, containing a DisableResult.

EnableAsync(string?, CancellationToken)

Enables DOM snapshot agent for the given page.

Task<EnableResult> EnableAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<EnableResult>

A task representing the asynchronous operation, containing a EnableResult.

GetSnapshotAsync(ImmutableArray<string>, bool?, bool?, bool?, string?, CancellationToken)

Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened.

[Obsolete]
Task<GetSnapshotResult> GetSnapshotAsync(ImmutableArray<string> computedStyleWhitelist, bool? includeEventListeners = null, bool? includePaintOrder = null, bool? includeUserAgentShadowTree = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

computedStyleWhitelist ImmutableArray<string>

Whitelist of computed styles to return.

includeEventListeners bool?

Whether or not to retrieve details of DOM listeners (default false).

includePaintOrder bool?

Whether to determine and include the paint order index of LayoutTreeNodes (default false).

includeUserAgentShadowTree bool?

Whether to include UA shadow tree in the snapshot (default false).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetSnapshotResult>

A task representing the asynchronous operation, containing a GetSnapshotResult.