Table of Contents

Interface IDOM

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

This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an id. This id can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client. Note that iframe owner elements will return corresponding document elements as their child nodes.

public interface IDOM

Properties

AdRelatedStateUpdated

Fired when a node's ad related state changes.

[Experimental("BIDICDP001")]
IEventSource<AdRelatedStateUpdatedEventArgs> AdRelatedStateUpdated { get; }

Property Value

IEventSource<AdRelatedStateUpdatedEventArgs>

Remarks

Event args (AdRelatedStateUpdatedEventArgs):

  • NodeId - The id of the node.
  • AdProvenance - The provenance of the ad related node, if it is ad related.

AdoptedStyleSheetsModified

Fired when Element's adoptedStyleSheets are modified.

[Experimental("BIDICDP001")]
IEventSource<AdoptedStyleSheetsModifiedEventArgs> AdoptedStyleSheetsModified { get; }

Property Value

IEventSource<AdoptedStyleSheetsModifiedEventArgs>

Remarks

Event args (AdoptedStyleSheetsModifiedEventArgs):

  • NodeId - Id of the node that has changed.
  • AdoptedStyleSheets - New adoptedStyleSheets array.

AffectedByStartingStylesFlagUpdated

Fired when a node's starting styles changes.

[Experimental("BIDICDP001")]
IEventSource<AffectedByStartingStylesFlagUpdatedEventArgs> AffectedByStartingStylesFlagUpdated { get; }

Property Value

IEventSource<AffectedByStartingStylesFlagUpdatedEventArgs>

Remarks

Event args (AffectedByStartingStylesFlagUpdatedEventArgs):

  • NodeId - The id of the node.
  • AffectedByStartingStyles - If the node has starting styles.

AttributeModified

Fired when Element's attribute is modified.

IEventSource<AttributeModifiedEventArgs> AttributeModified { get; }

Property Value

IEventSource<AttributeModifiedEventArgs>

Remarks

Event args (AttributeModifiedEventArgs):

  • NodeId - Id of the node that has changed.
  • Name - Attribute name.
  • Value - Attribute value.

AttributeRemoved

Fired when Element's attribute is removed.

IEventSource<AttributeRemovedEventArgs> AttributeRemoved { get; }

Property Value

IEventSource<AttributeRemovedEventArgs>

Remarks

Event args (AttributeRemovedEventArgs):

  • NodeId - Id of the node that has changed.
  • Name - A ttribute name.

CharacterDataModified

Mirrors DOMCharacterDataModified event.

IEventSource<CharacterDataModifiedEventArgs> CharacterDataModified { get; }

Property Value

IEventSource<CharacterDataModifiedEventArgs>

Remarks

Event args (CharacterDataModifiedEventArgs):

  • NodeId - Id of the node that has changed.
  • CharacterData - New text value.

ChildNodeCountUpdated

Fired when Container's child node count has changed.

IEventSource<ChildNodeCountUpdatedEventArgs> ChildNodeCountUpdated { get; }

Property Value

IEventSource<ChildNodeCountUpdatedEventArgs>

Remarks

Event args (ChildNodeCountUpdatedEventArgs):

  • NodeId - Id of the node that has changed.
  • ChildNodeCount - New node count.

ChildNodeInserted

Mirrors DOMNodeInserted event.

IEventSource<ChildNodeInsertedEventArgs> ChildNodeInserted { get; }

Property Value

IEventSource<ChildNodeInsertedEventArgs>

Remarks

Event args (ChildNodeInsertedEventArgs):

  • ParentNodeId - Id of the node that has changed.
  • PreviousNodeId - Id of the previous sibling.
  • Node - Inserted node data.

ChildNodeRemoved

Mirrors DOMNodeRemoved event.

IEventSource<ChildNodeRemovedEventArgs> ChildNodeRemoved { get; }

Property Value

IEventSource<ChildNodeRemovedEventArgs>

Remarks

Event args (ChildNodeRemovedEventArgs):

  • ParentNodeId - Parent id.
  • NodeId - Id of the node that has been removed.

DistributedNodesUpdated

Called when distribution is changed.

[Experimental("BIDICDP001")]
IEventSource<DistributedNodesUpdatedEventArgs> DistributedNodesUpdated { get; }

Property Value

IEventSource<DistributedNodesUpdatedEventArgs>

Remarks

Event args (DistributedNodesUpdatedEventArgs):

  • InsertionPointId - Insertion point where distributed nodes were updated.
  • DistributedNodes - Distributed nodes for given insertion point.

DocumentUpdated

Fired when Document has been totally updated. Node ids are no longer valid.

IEventSource<DocumentUpdatedEventArgs> DocumentUpdated { get; }

Property Value

IEventSource<DocumentUpdatedEventArgs>

InlineStyleInvalidated

Fired when Element's inline style is modified via a CSS property modification.

[Experimental("BIDICDP001")]
IEventSource<InlineStyleInvalidatedEventArgs> InlineStyleInvalidated { get; }

Property Value

IEventSource<InlineStyleInvalidatedEventArgs>

Remarks

Event args (InlineStyleInvalidatedEventArgs):

  • NodeIds - Ids of the nodes for which the inline styles have been invalidated.

PseudoElementAdded

Called when a pseudo element is added to an element.

[Experimental("BIDICDP001")]
IEventSource<PseudoElementAddedEventArgs> PseudoElementAdded { get; }

Property Value

IEventSource<PseudoElementAddedEventArgs>

Remarks

Event args (PseudoElementAddedEventArgs):

  • ParentId - Pseudo element's parent element id.
  • PseudoElement - The added pseudo element.

PseudoElementRemoved

Called when a pseudo element is removed from an element.

[Experimental("BIDICDP001")]
IEventSource<PseudoElementRemovedEventArgs> PseudoElementRemoved { get; }

Property Value

IEventSource<PseudoElementRemovedEventArgs>

Remarks

Event args (PseudoElementRemovedEventArgs):

  • ParentId - Pseudo element's parent element id.
  • PseudoElementId - The removed pseudo element id.

ScrollableFlagUpdated

Fired when a node's scrollability state changes.

[Experimental("BIDICDP001")]
IEventSource<ScrollableFlagUpdatedEventArgs> ScrollableFlagUpdated { get; }

Property Value

IEventSource<ScrollableFlagUpdatedEventArgs>

Remarks

Event args (ScrollableFlagUpdatedEventArgs):

  • NodeId - The id of the node.
  • IsScrollable - If the node is scrollable.

SetChildNodes

Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids.

IEventSource<SetChildNodesEventArgs> SetChildNodes { get; }

Property Value

IEventSource<SetChildNodesEventArgs>

Remarks

Event args (SetChildNodesEventArgs):

  • ParentId - Parent node id to populate with children.
  • Nodes - Child nodes array.

ShadowRootPopped

Called when shadow root is popped from the element.

[Experimental("BIDICDP001")]
IEventSource<ShadowRootPoppedEventArgs> ShadowRootPopped { get; }

Property Value

IEventSource<ShadowRootPoppedEventArgs>

Remarks

Event args (ShadowRootPoppedEventArgs):

  • HostId - Host element id.
  • RootId - Shadow root id.

ShadowRootPushed

Called when shadow root is pushed into the element.

[Experimental("BIDICDP001")]
IEventSource<ShadowRootPushedEventArgs> ShadowRootPushed { get; }

Property Value

IEventSource<ShadowRootPushedEventArgs>

Remarks

Event args (ShadowRootPushedEventArgs):

  • HostId - Host element id.
  • Root - Shadow root.

TopLayerElementsUpdated

Called when top layer elements are changed.

[Experimental("BIDICDP001")]
IEventSource<TopLayerElementsUpdatedEventArgs> TopLayerElementsUpdated { get; }

Property Value

IEventSource<TopLayerElementsUpdatedEventArgs>

Methods

CollectClassNamesFromSubtreeAsync(NodeId, string?, CancellationToken)

Collects class names for the node with given id and all of it's child nodes.

[Experimental("BIDICDP001")]
Task<CollectClassNamesFromSubtreeResult> CollectClassNamesFromSubtreeAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to collect class names.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<CollectClassNamesFromSubtreeResult>

A task representing the asynchronous operation, containing a CollectClassNamesFromSubtreeResult.

CopyToAsync(NodeId, NodeId, NodeId?, string?, CancellationToken)

Creates a deep copy of the specified node and places it into the target container before the given anchor.

[Experimental("BIDICDP001")]
Task<CopyToResult> CopyToAsync(NodeId nodeId, NodeId targetNodeId, NodeId? insertBeforeNodeId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to copy.

targetNodeId NodeId

Id of the element to drop the copy into.

insertBeforeNodeId NodeId

Drop the copy before this node (if absent, the copy becomes the last child of targetNodeId).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<CopyToResult>

A task representing the asynchronous operation, containing a CopyToResult.

DescribeNodeAsync(NodeId?, BackendNodeId?, RemoteObjectId?, long?, bool?, string?, CancellationToken)

Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation.

Task<DescribeNodeResult> DescribeNodeAsync(NodeId? nodeId = null, BackendNodeId? backendNodeId = null, RemoteObjectId? objectId = null, long? depth = null, bool? pierce = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Identifier of the node.

backendNodeId BackendNodeId

Identifier of the backend node.

objectId RemoteObjectId

JavaScript object id of the node wrapper.

depth long?

The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.

pierce bool?

Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<DescribeNodeResult>

A task representing the asynchronous operation, containing a DescribeNodeResult.

DisableAsync(string?, CancellationToken)

Disables DOM 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.

DiscardSearchResultsAsync(string, string?, CancellationToken)

Discards search results from the session with the given id. getSearchResults should no longer be called for that search.

[Experimental("BIDICDP001")]
Task<DiscardSearchResultsResult> DiscardSearchResultsAsync(string searchId, string? session = null, CancellationToken cancellationToken = default)

Parameters

searchId string

Unique search session identifier.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<DiscardSearchResultsResult>

A task representing the asynchronous operation, containing a DiscardSearchResultsResult.

EnableAsync(string?, string?, CancellationToken)

Enables DOM agent for the given page.

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

Parameters

includeWhitespace string

Whether to include whitespaces in the children array of returned Nodes.

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.

FocusAsync(NodeId?, BackendNodeId?, RemoteObjectId?, string?, CancellationToken)

Focuses the given element.

Task<FocusResult> FocusAsync(NodeId? nodeId = null, BackendNodeId? backendNodeId = null, RemoteObjectId? objectId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Identifier of the node.

backendNodeId BackendNodeId

Identifier of the backend node.

objectId RemoteObjectId

JavaScript object id of the node wrapper.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<FocusResult>

A task representing the asynchronous operation, containing a FocusResult.

ForceShowInterestAsync(NodeId, bool, string?, CancellationToken)

When enabling, this API forces an element to gain interest in its target, keeping interest active until disabled.

[Experimental("BIDICDP001")]
Task<ForceShowInterestResult> ForceShowInterestAsync(NodeId nodeId, bool enable, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the interest invoker HTMLElement.

enable bool

If true, opens and holds interest. If false, releases forced interest.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ForceShowInterestResult>

A task representing the asynchronous operation, containing a ForceShowInterestResult.

ForceShowPopoverAsync(NodeId, bool, BackendNodeId?, string?, CancellationToken)

When enabling, this API force-opens the popover identified by nodeId and keeps it open until disabled.

[Experimental("BIDICDP001")]
Task<ForceShowPopoverResult> ForceShowPopoverAsync(NodeId nodeId, bool enable, BackendNodeId? invokerNodeId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the popover HTMLElement

enable bool

If true, opens the popover and keeps it open. If false, closes the popover if it was previously force-opened.

invokerNodeId BackendNodeId

Optional ID of the element invoking this popover, used to establish the implicit anchor. If not provided, it will fall back to the first invoker in the document, preferring elements with a popovertarget attribute over those with a commandfor attribute. Note that if there are multiple invokers, this is just an estimate.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ForceShowPopoverResult>

A task representing the asynchronous operation, containing a ForceShowPopoverResult.

GetAnchorElementAsync(NodeId, string?, string?, CancellationToken)

Returns the target anchor element of the given anchor query according to https://www.w3.org/TR/css-anchor-position-1/#target.

[Experimental("BIDICDP001")]
Task<GetAnchorElementResult> GetAnchorElementAsync(NodeId nodeId, string? anchorSpecifier = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the positioned element from which to find the anchor.

anchorSpecifier string

An optional anchor specifier, as defined in https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier. If not provided, it will return the implicit anchor element for the given positioned element.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetAnchorElementResult>

A task representing the asynchronous operation, containing a GetAnchorElementResult.

GetAttributesAsync(NodeId, string?, CancellationToken)

Returns attributes for the specified node.

Task<GetAttributesResult> GetAttributesAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to retrieve attributes for.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetAttributesResult>

A task representing the asynchronous operation, containing a GetAttributesResult.

GetBoxModelAsync(NodeId?, BackendNodeId?, RemoteObjectId?, string?, CancellationToken)

Returns boxes for the given node.

Task<GetBoxModelResult> GetBoxModelAsync(NodeId? nodeId = null, BackendNodeId? backendNodeId = null, RemoteObjectId? objectId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Identifier of the node.

backendNodeId BackendNodeId

Identifier of the backend node.

objectId RemoteObjectId

JavaScript object id of the node wrapper.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetBoxModelResult>

A task representing the asynchronous operation, containing a GetBoxModelResult.

GetContainerForNodeAsync(NodeId, string?, PhysicalAxes?, LogicalAxes?, bool?, bool?, string?, CancellationToken)

Returns the query container of the given node based on container query conditions: containerName, physical and logical axes, and whether it queries scroll-state or anchored elements. If no axes are provided and queriesScrollState is false, the style container is returned, which is the direct parent or the closest element with a matching container-name.

[Experimental("BIDICDP001")]
Task<GetContainerForNodeResult> GetContainerForNodeAsync(NodeId nodeId, string? containerName = null, PhysicalAxes? physicalAxes = null, LogicalAxes? logicalAxes = null, bool? queriesScrollState = null, bool? queriesAnchored = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId
containerName string
physicalAxes PhysicalAxes?
logicalAxes LogicalAxes?
queriesScrollState bool?
queriesAnchored bool?
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetContainerForNodeResult>

A task representing the asynchronous operation, containing a GetContainerForNodeResult.

GetContentQuadsAsync(NodeId?, BackendNodeId?, RemoteObjectId?, string?, CancellationToken)

Returns quads that describe node position on the page. This method might return multiple quads for inline nodes.

[Experimental("BIDICDP001")]
Task<GetContentQuadsResult> GetContentQuadsAsync(NodeId? nodeId = null, BackendNodeId? backendNodeId = null, RemoteObjectId? objectId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Identifier of the node.

backendNodeId BackendNodeId

Identifier of the backend node.

objectId RemoteObjectId

JavaScript object id of the node wrapper.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetContentQuadsResult>

A task representing the asynchronous operation, containing a GetContentQuadsResult.

GetDetachedDomNodesAsync(string?, CancellationToken)

Returns list of detached nodes

[Experimental("BIDICDP001")]
Task<GetDetachedDomNodesResult> GetDetachedDomNodesAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetDetachedDomNodesResult>

A task representing the asynchronous operation, containing a GetDetachedDomNodesResult.

GetDocumentAsync(long?, bool?, string?, CancellationToken)

Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target.

Task<GetDocumentResult> GetDocumentAsync(long? depth = null, bool? pierce = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

depth long?

The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.

pierce bool?

Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetDocumentResult>

A task representing the asynchronous operation, containing a GetDocumentResult.

GetElementByRelationAsync(NodeId, string, string?, CancellationToken)

Returns the NodeId of the matched element according to certain relations.

[Experimental("BIDICDP001")]
Task<GetElementByRelationResult> GetElementByRelationAsync(NodeId nodeId, string relation, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node from which to query the relation.

relation string

Type of relation to get.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetElementByRelationResult>

A task representing the asynchronous operation, containing a GetElementByRelationResult.

GetFileInfoAsync(RemoteObjectId, string?, CancellationToken)

Returns file information for the given File wrapper.

[Experimental("BIDICDP001")]
Task<GetFileInfoResult> GetFileInfoAsync(RemoteObjectId objectId, string? session = null, CancellationToken cancellationToken = default)

Parameters

objectId RemoteObjectId

JavaScript object id of the node wrapper.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetFileInfoResult>

A task representing the asynchronous operation, containing a GetFileInfoResult.

GetFlattenedDocumentAsync(long?, bool?, string?, CancellationToken)

Returns the root DOM node (and optionally the subtree) to the caller. Deprecated, as it is not designed to work well with the rest of the DOM agent. Use DOMSnapshot.captureSnapshot instead.

[Obsolete]
Task<GetFlattenedDocumentResult> GetFlattenedDocumentAsync(long? depth = null, bool? pierce = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

depth long?

The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.

pierce bool?

Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetFlattenedDocumentResult>

A task representing the asynchronous operation, containing a GetFlattenedDocumentResult.

GetFrameOwnerAsync(FrameId, string?, CancellationToken)

Returns iframe node that owns iframe with the given domain.

[Experimental("BIDICDP001")]
Task<GetFrameOwnerResult> GetFrameOwnerAsync(FrameId frameId, string? session = null, CancellationToken cancellationToken = default)

Parameters

frameId FrameId
session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetFrameOwnerResult>

A task representing the asynchronous operation, containing a GetFrameOwnerResult.

GetImplicitAnchorCandidatesAsync(NodeId, string?, CancellationToken)

Returns candidate nodes that are configured as triggers for the given popover.

[Experimental("BIDICDP001")]
Task<GetImplicitAnchorCandidatesResult> GetImplicitAnchorCandidatesAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the popover HTMLElement.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetImplicitAnchorCandidatesResult>

A task representing the asynchronous operation, containing a GetImplicitAnchorCandidatesResult.

GetNodeForLocationAsync(long, long, bool?, bool?, string?, CancellationToken)

Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not.

Task<GetNodeForLocationResult> GetNodeForLocationAsync(long x, long y, bool? includeUserAgentShadowDOM = null, bool? ignorePointerEventsNone = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

x long

X coordinate.

y long

Y coordinate.

includeUserAgentShadowDOM bool?

False to skip to the nearest non-UA shadow root ancestor (default: false).

ignorePointerEventsNone bool?

Whether to ignore pointer-events: none on elements and hit test them.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetNodeForLocationResult>

A task representing the asynchronous operation, containing a GetNodeForLocationResult.

GetNodeStackTracesAsync(NodeId, string?, CancellationToken)

Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.

[Experimental("BIDICDP001")]
Task<GetNodeStackTracesResult> GetNodeStackTracesAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to get stack traces for.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetNodeStackTracesResult>

A task representing the asynchronous operation, containing a GetNodeStackTracesResult.

GetNodesForSubtreeByStyleAsync(NodeId, ImmutableArray<CSSComputedStyleProperty>, bool?, string?, CancellationToken)

Finds nodes with a given computed style in a subtree.

[Experimental("BIDICDP001")]
Task<GetNodesForSubtreeByStyleResult> GetNodesForSubtreeByStyleAsync(NodeId nodeId, ImmutableArray<CSSComputedStyleProperty> computedStyles, bool? pierce = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Node ID pointing to the root of a subtree.

computedStyles ImmutableArray<CSSComputedStyleProperty>

The style to filter nodes by (includes nodes if any of properties matches).

pierce bool?

Whether or not iframes and shadow roots in the same target should be traversed when returning the results (default is false).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetNodesForSubtreeByStyleResult>

A task representing the asynchronous operation, containing a GetNodesForSubtreeByStyleResult.

GetOuterHTMLAsync(NodeId?, BackendNodeId?, RemoteObjectId?, bool?, string?, CancellationToken)

Returns node's HTML markup.

Task<GetOuterHTMLResult> GetOuterHTMLAsync(NodeId? nodeId = null, BackendNodeId? backendNodeId = null, RemoteObjectId? objectId = null, bool? includeShadowDOM = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Identifier of the node.

backendNodeId BackendNodeId

Identifier of the backend node.

objectId RemoteObjectId

JavaScript object id of the node wrapper.

includeShadowDOM bool?

Include all shadow roots. Equals to false if not specified.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetOuterHTMLResult>

A task representing the asynchronous operation, containing a GetOuterHTMLResult.

GetQueryingDescendantsForContainerAsync(NodeId, string?, CancellationToken)

Returns the descendants of a container query container that have container queries against this container.

[Experimental("BIDICDP001")]
Task<GetQueryingDescendantsForContainerResult> GetQueryingDescendantsForContainerAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the container node to find querying descendants from.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetQueryingDescendantsForContainerResult>

A task representing the asynchronous operation, containing a GetQueryingDescendantsForContainerResult.

GetRelayoutBoundaryAsync(NodeId, string?, CancellationToken)

Returns the id of the nearest ancestor that is a relayout boundary.

[Experimental("BIDICDP001")]
Task<GetRelayoutBoundaryResult> GetRelayoutBoundaryAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetRelayoutBoundaryResult>

A task representing the asynchronous operation, containing a GetRelayoutBoundaryResult.

GetSearchResultsAsync(string, long, long, string?, CancellationToken)

Returns search results from given fromIndex to given toIndex from the search with the given identifier.

[Experimental("BIDICDP001")]
Task<GetSearchResultsResult> GetSearchResultsAsync(string searchId, long fromIndex, long toIndex, string? session = null, CancellationToken cancellationToken = default)

Parameters

searchId string

Unique search session identifier.

fromIndex long

Start index of the search result to be returned.

toIndex long

End index of the search result to be returned.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetSearchResultsResult>

A task representing the asynchronous operation, containing a GetSearchResultsResult.

GetTopLayerElementsAsync(string?, CancellationToken)

Returns NodeIds of current top layer elements. Top layer is rendered closest to the user within a viewport, therefore its elements always appear on top of all other content.

[Experimental("BIDICDP001")]
Task<GetTopLayerElementsResult> GetTopLayerElementsAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<GetTopLayerElementsResult>

A task representing the asynchronous operation, containing a GetTopLayerElementsResult.

HideHighlightAsync(string?, CancellationToken)

Hides any highlight.

Task<HideHighlightResult> HideHighlightAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<HideHighlightResult>

A task representing the asynchronous operation, containing a HideHighlightResult.

HighlightNodeAsync(string?, CancellationToken)

Highlights DOM node.

Task<HighlightNodeResult> HighlightNodeAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<HighlightNodeResult>

A task representing the asynchronous operation, containing a HighlightNodeResult.

HighlightRectAsync(string?, CancellationToken)

Highlights given rectangle.

Task<HighlightRectResult> HighlightRectAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<HighlightRectResult>

A task representing the asynchronous operation, containing a HighlightRectResult.

MarkUndoableStateAsync(string?, CancellationToken)

Marks last undoable state.

[Experimental("BIDICDP001")]
Task<MarkUndoableStateResult> MarkUndoableStateAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<MarkUndoableStateResult>

A task representing the asynchronous operation, containing a MarkUndoableStateResult.

MoveToAsync(NodeId, NodeId, NodeId?, string?, CancellationToken)

Moves node into the new container, places it before the given anchor.

Task<MoveToResult> MoveToAsync(NodeId nodeId, NodeId targetNodeId, NodeId? insertBeforeNodeId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to move.

targetNodeId NodeId

Id of the element to drop the moved node into.

insertBeforeNodeId NodeId

Drop node before this one (if absent, the moved node becomes the last child of targetNodeId).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<MoveToResult>

A task representing the asynchronous operation, containing a MoveToResult.

PerformSearchAsync(string, bool?, string?, CancellationToken)

Searches for a given string in the DOM tree. Use getSearchResults to access search results or cancelSearch to end this search session.

[Experimental("BIDICDP001")]
Task<PerformSearchResult> PerformSearchAsync(string query, bool? includeUserAgentShadowDOM = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

query string

Plain text or query selector or XPath search query.

includeUserAgentShadowDOM bool?

True to search in user agent shadow DOM.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<PerformSearchResult>

A task representing the asynchronous operation, containing a PerformSearchResult.

PushNodeByPathToFrontendAsync(string, string?, CancellationToken)

Requests that the node is sent to the caller given its path. // FIXME, use XPath

[Experimental("BIDICDP001")]
Task<PushNodeByPathToFrontendResult> PushNodeByPathToFrontendAsync(string path, string? session = null, CancellationToken cancellationToken = default)

Parameters

path string

Path to node in the proprietary format.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<PushNodeByPathToFrontendResult>

A task representing the asynchronous operation, containing a PushNodeByPathToFrontendResult.

PushNodesByBackendIdsToFrontendAsync(ImmutableArray<BackendNodeId>, string?, CancellationToken)

Requests that a batch of nodes is sent to the caller given their backend node ids.

[Experimental("BIDICDP001")]
Task<PushNodesByBackendIdsToFrontendResult> PushNodesByBackendIdsToFrontendAsync(ImmutableArray<BackendNodeId> backendNodeIds, string? session = null, CancellationToken cancellationToken = default)

Parameters

backendNodeIds ImmutableArray<BackendNodeId>

The array of backend node ids.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<PushNodesByBackendIdsToFrontendResult>

A task representing the asynchronous operation, containing a PushNodesByBackendIdsToFrontendResult.

QuerySelectorAllAsync(NodeId, string, string?, CancellationToken)

Executes querySelectorAll on a given node.

Task<QuerySelectorAllResult> QuerySelectorAllAsync(NodeId nodeId, string selector, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to query upon.

selector string

Selector string.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<QuerySelectorAllResult>

A task representing the asynchronous operation, containing a QuerySelectorAllResult.

QuerySelectorAsync(NodeId, string, string?, CancellationToken)

Executes querySelector on a given node.

Task<QuerySelectorResult> QuerySelectorAsync(NodeId nodeId, string selector, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to query upon.

selector string

Selector string.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<QuerySelectorResult>

A task representing the asynchronous operation, containing a QuerySelectorResult.

RedoAsync(string?, CancellationToken)

Re-does the last undone action.

[Experimental("BIDICDP001")]
Task<RedoResult> RedoAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RedoResult>

A task representing the asynchronous operation, containing a RedoResult.

RemoveAttributeAsync(NodeId, string, string?, CancellationToken)

Removes attribute with given name from an element with given id.

Task<RemoveAttributeResult> RemoveAttributeAsync(NodeId nodeId, string name, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the element to remove attribute from.

name string

Name of the attribute to remove.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RemoveAttributeResult>

A task representing the asynchronous operation, containing a RemoveAttributeResult.

RemoveNodeAsync(NodeId, string?, CancellationToken)

Removes node with given id.

Task<RemoveNodeResult> RemoveNodeAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to remove.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RemoveNodeResult>

A task representing the asynchronous operation, containing a RemoveNodeResult.

RequestChildNodesAsync(NodeId, long?, bool?, string?, CancellationToken)

Requests that children of the node with given id are returned to the caller in form of setChildNodes events where not only immediate children are retrieved, but all children down to the specified depth.

Task<RequestChildNodesResult> RequestChildNodesAsync(NodeId nodeId, long? depth = null, bool? pierce = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to get children for.

depth long?

The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.

pierce bool?

Whether or not iframes and shadow roots should be traversed when returning the sub-tree (default is false).

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RequestChildNodesResult>

A task representing the asynchronous operation, containing a RequestChildNodesResult.

RequestNodeAsync(RemoteObjectId, string?, CancellationToken)

Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of setChildNodes notifications.

Task<RequestNodeResult> RequestNodeAsync(RemoteObjectId objectId, string? session = null, CancellationToken cancellationToken = default)

Parameters

objectId RemoteObjectId

JavaScript object id to convert into node.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<RequestNodeResult>

A task representing the asynchronous operation, containing a RequestNodeResult.

ResolveNodeAsync(NodeId?, BackendNodeId?, string?, ExecutionContextId?, string?, CancellationToken)

Resolves the JavaScript node object for a given NodeId or BackendNodeId.

Task<ResolveNodeResult> ResolveNodeAsync(NodeId? nodeId = null, BackendNodeId? backendNodeId = null, string? objectGroup = null, ExecutionContextId? executionContextId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to resolve.

backendNodeId BackendNodeId

Backend identifier of the node to resolve.

objectGroup string

Symbolic group name that can be used to release multiple objects.

executionContextId ExecutionContextId

Execution context in which to resolve the node.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ResolveNodeResult>

A task representing the asynchronous operation, containing a ResolveNodeResult.

ScrollIntoViewIfNeededAsync(NodeId?, BackendNodeId?, RemoteObjectId?, Rect?, string?, CancellationToken)

Scrolls the specified rect of the given node into view if not already visible. Note: exactly one between nodeId, backendNodeId and objectId should be passed to identify the node.

Task<ScrollIntoViewIfNeededResult> ScrollIntoViewIfNeededAsync(NodeId? nodeId = null, BackendNodeId? backendNodeId = null, RemoteObjectId? objectId = null, Rect? rect = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Identifier of the node.

backendNodeId BackendNodeId

Identifier of the backend node.

objectId RemoteObjectId

JavaScript object id of the node wrapper.

rect Rect

The rect to be scrolled into view, relative to the node's border box, in CSS pixels. When omitted, center of the node will be used, similar to Element.scrollIntoView.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<ScrollIntoViewIfNeededResult>

A task representing the asynchronous operation, containing a ScrollIntoViewIfNeededResult.

SetAttributeValueAsync(NodeId, string, string, string?, CancellationToken)

Sets attribute for an element with given id.

Task<SetAttributeValueResult> SetAttributeValueAsync(NodeId nodeId, string name, string value, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the element to set attribute for.

name string

Attribute name.

value string

Attribute value.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetAttributeValueResult>

A task representing the asynchronous operation, containing a SetAttributeValueResult.

SetAttributesAsTextAsync(NodeId, string, string?, string?, CancellationToken)

Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.

Task<SetAttributesAsTextResult> SetAttributesAsTextAsync(NodeId nodeId, string text, string? name = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the element to set attributes for.

text string

Text with a number of attributes. Will parse this text using HTML parser.

name string

Attribute name to replace with new attributes derived from text in case text parsed successfully.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetAttributesAsTextResult>

A task representing the asynchronous operation, containing a SetAttributesAsTextResult.

SetFileInputFilesAsync(ImmutableArray<string>, NodeId?, BackendNodeId?, RemoteObjectId?, string?, CancellationToken)

Sets files for the given file input element.

Task<SetFileInputFilesResult> SetFileInputFilesAsync(ImmutableArray<string> files, NodeId? nodeId = null, BackendNodeId? backendNodeId = null, RemoteObjectId? objectId = null, string? session = null, CancellationToken cancellationToken = default)

Parameters

files ImmutableArray<string>

Array of file paths to set.

nodeId NodeId

Identifier of the node.

backendNodeId BackendNodeId

Identifier of the backend node.

objectId RemoteObjectId

JavaScript object id of the node wrapper.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetFileInputFilesResult>

A task representing the asynchronous operation, containing a SetFileInputFilesResult.

SetInspectedNodeAsync(NodeId, string?, CancellationToken)

Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).

[Experimental("BIDICDP001")]
Task<SetInspectedNodeResult> SetInspectedNodeAsync(NodeId nodeId, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

DOM node id to be accessible by means of $x command line API.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetInspectedNodeResult>

A task representing the asynchronous operation, containing a SetInspectedNodeResult.

SetNodeNameAsync(NodeId, string, string?, CancellationToken)

Sets node name for a node with given id.

Task<SetNodeNameResult> SetNodeNameAsync(NodeId nodeId, string name, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to set name for.

name string

New node's name.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetNodeNameResult>

A task representing the asynchronous operation, containing a SetNodeNameResult.

SetNodeStackTracesEnabledAsync(bool, string?, CancellationToken)

Sets if stack traces should be captured for Nodes. See Node.getNodeStackTraces. Default is disabled.

[Experimental("BIDICDP001")]
Task<SetNodeStackTracesEnabledResult> SetNodeStackTracesEnabledAsync(bool enable, string? session = null, CancellationToken cancellationToken = default)

Parameters

enable bool

Enable or disable.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetNodeStackTracesEnabledResult>

A task representing the asynchronous operation, containing a SetNodeStackTracesEnabledResult.

SetNodeValueAsync(NodeId, string, string?, CancellationToken)

Sets node value for a node with given id.

Task<SetNodeValueResult> SetNodeValueAsync(NodeId nodeId, string value, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to set value for.

value string

New node's value.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetNodeValueResult>

A task representing the asynchronous operation, containing a SetNodeValueResult.

SetOuterHTMLAsync(NodeId, string, string?, CancellationToken)

Sets node HTML markup, returns new node id.

Task<SetOuterHTMLResult> SetOuterHTMLAsync(NodeId nodeId, string outerHTML, string? session = null, CancellationToken cancellationToken = default)

Parameters

nodeId NodeId

Id of the node to set markup for.

outerHTML string

Outer HTML markup to set.

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<SetOuterHTMLResult>

A task representing the asynchronous operation, containing a SetOuterHTMLResult.

UndoAsync(string?, CancellationToken)

Undoes the last performed action.

[Experimental("BIDICDP001")]
Task<UndoResult> UndoAsync(string? session = null, CancellationToken cancellationToken = default)

Parameters

session string

Optional CDP session override.

cancellationToken CancellationToken

A token to cancel the asynchronous operation.

Returns

Task<UndoResult>

A task representing the asynchronous operation, containing a UndoResult.