Skip to main content

DOMClient

Struct DOMClient 

Source
pub struct DOMClient { /* private fields */ }
Expand description

Client for DOM domain commands.

Implementations§

Source§

impl DOMClient

Source

pub async fn collect_class_names_from_subtree( &self, params: CollectClassNamesFromSubtreeParams, session_id: Option<&str>, ) -> Result<CollectClassNamesFromSubtreeReturns, CdpError>

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

Source

pub async fn copy_to( &self, params: CopyToParams, session_id: Option<&str>, ) -> Result<CopyToReturns, CdpError>

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

Source

pub async fn describe_node( &self, params: DescribeNodeParams, session_id: Option<&str>, ) -> Result<DescribeNodeReturns, CdpError>

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

Source

pub async fn scroll_into_view_if_needed( &self, params: ScrollIntoViewIfNeededParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

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.

Source

pub async fn disable(&self, session_id: Option<&str>) -> Result<Value, CdpError>

Disables DOM agent for the given page.

Source

pub async fn discard_search_results( &self, params: DiscardSearchResultsParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

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

Source

pub async fn enable( &self, params: EnableParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Enables DOM agent for the given page.

Source

pub async fn focus( &self, params: FocusParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Focuses the given element.

Source

pub async fn get_attributes( &self, params: GetAttributesParams, session_id: Option<&str>, ) -> Result<GetAttributesReturns, CdpError>

Returns attributes for the specified node.

Source

pub async fn get_box_model( &self, params: GetBoxModelParams, session_id: Option<&str>, ) -> Result<GetBoxModelReturns, CdpError>

Returns boxes for the given node.

Source

pub async fn get_content_quads( &self, params: GetContentQuadsParams, session_id: Option<&str>, ) -> Result<GetContentQuadsReturns, CdpError>

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

Source

pub async fn get_document( &self, params: GetDocumentParams, session_id: Option<&str>, ) -> Result<GetDocumentReturns, CdpError>

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

Source

pub async fn get_flattened_document( &self, params: GetFlattenedDocumentParams, session_id: Option<&str>, ) -> Result<GetFlattenedDocumentReturns, CdpError>

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.

Source

pub async fn get_nodes_for_subtree_by_style( &self, params: GetNodesForSubtreeByStyleParams, session_id: Option<&str>, ) -> Result<GetNodesForSubtreeByStyleReturns, CdpError>

Finds nodes with a given computed style in a subtree.

Source

pub async fn get_node_for_location( &self, params: GetNodeForLocationParams, session_id: Option<&str>, ) -> Result<GetNodeForLocationReturns, CdpError>

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

Source

pub async fn get_outer_html( &self, params: GetOuterHtmlParams, session_id: Option<&str>, ) -> Result<GetOuterHtmlReturns, CdpError>

Returns node’s HTML markup.

Source

pub async fn get_relayout_boundary( &self, params: GetRelayoutBoundaryParams, session_id: Option<&str>, ) -> Result<GetRelayoutBoundaryReturns, CdpError>

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

Source

pub async fn get_search_results( &self, params: GetSearchResultsParams, session_id: Option<&str>, ) -> Result<GetSearchResultsReturns, CdpError>

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

Source

pub async fn hide_highlight( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>

Hides any highlight.

Source

pub async fn highlight_node( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>

Highlights DOM node.

Source

pub async fn highlight_rect( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>

Highlights given rectangle.

Source

pub async fn mark_undoable_state( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>

Marks last undoable state.

Source

pub async fn move_to( &self, params: MoveToParams, session_id: Option<&str>, ) -> Result<MoveToReturns, CdpError>

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

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

Source

pub async fn push_node_by_path_to_frontend( &self, params: PushNodeByPathToFrontendParams, session_id: Option<&str>, ) -> Result<PushNodeByPathToFrontendReturns, CdpError>

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

Source

pub async fn push_nodes_by_backend_ids_to_frontend( &self, params: PushNodesByBackendIdsToFrontendParams, session_id: Option<&str>, ) -> Result<PushNodesByBackendIdsToFrontendReturns, CdpError>

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

Source

pub async fn query_selector( &self, params: QuerySelectorParams, session_id: Option<&str>, ) -> Result<QuerySelectorReturns, CdpError>

Executes querySelector on a given node.

Source

pub async fn query_selector_all( &self, params: QuerySelectorAllParams, session_id: Option<&str>, ) -> Result<QuerySelectorAllReturns, CdpError>

Executes querySelectorAll on a given node.

Source

pub async fn get_top_layer_elements( &self, session_id: Option<&str>, ) -> Result<GetTopLayerElementsReturns, CdpError>

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.

Source

pub async fn get_element_by_relation( &self, params: GetElementByRelationParams, session_id: Option<&str>, ) -> Result<GetElementByRelationReturns, CdpError>

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

Source

pub async fn redo(&self, session_id: Option<&str>) -> Result<Value, CdpError>

Re-does the last undone action.

Source

pub async fn remove_attribute( &self, params: RemoveAttributeParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

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

Source

pub async fn remove_node( &self, params: RemoveNodeParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Removes node with given id.

Source

pub async fn request_child_nodes( &self, params: RequestChildNodesParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

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.

Source

pub async fn request_node( &self, params: RequestNodeParams, session_id: Option<&str>, ) -> Result<RequestNodeReturns, CdpError>

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.

Source

pub async fn resolve_node( &self, params: ResolveNodeParams, session_id: Option<&str>, ) -> Result<ResolveNodeReturns, CdpError>

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

Source

pub async fn set_attribute_value( &self, params: SetAttributeValueParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Sets attribute for an element with given id.

Source

pub async fn set_attributes_as_text( &self, params: SetAttributesAsTextParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

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.

Source

pub async fn set_file_input_files( &self, params: SetFileInputFilesParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Sets files for the given file input element.

Source

pub async fn set_node_stack_traces_enabled( &self, params: SetNodeStackTracesEnabledParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

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

Source

pub async fn get_node_stack_traces( &self, params: GetNodeStackTracesParams, session_id: Option<&str>, ) -> Result<GetNodeStackTracesReturns, CdpError>

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

Source

pub async fn get_file_info( &self, params: GetFileInfoParams, session_id: Option<&str>, ) -> Result<GetFileInfoReturns, CdpError>

Returns file information for the given File wrapper.

Source

pub async fn get_detached_dom_nodes( &self, session_id: Option<&str>, ) -> Result<GetDetachedDomNodesReturns, CdpError>

Returns list of detached nodes

Source

pub async fn set_inspected_node( &self, params: SetInspectedNodeParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

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

Source

pub async fn set_node_name( &self, params: SetNodeNameParams, session_id: Option<&str>, ) -> Result<SetNodeNameReturns, CdpError>

Sets node name for a node with given id.

Source

pub async fn set_node_value( &self, params: SetNodeValueParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Sets node value for a node with given id.

Source

pub async fn set_outer_html( &self, params: SetOuterHtmlParams, session_id: Option<&str>, ) -> Result<Value, CdpError>

Sets node HTML markup, returns new node id.

Source

pub async fn undo(&self, session_id: Option<&str>) -> Result<Value, CdpError>

Undoes the last performed action.

Source

pub async fn get_frame_owner( &self, params: GetFrameOwnerParams, session_id: Option<&str>, ) -> Result<GetFrameOwnerReturns, CdpError>

Returns iframe node that owns iframe with the given domain.

Source

pub async fn get_container_for_node( &self, params: GetContainerForNodeParams, session_id: Option<&str>, ) -> Result<GetContainerForNodeReturns, CdpError>

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.

Source

pub async fn get_querying_descendants_for_container( &self, params: GetQueryingDescendantsForContainerParams, session_id: Option<&str>, ) -> Result<GetQueryingDescendantsForContainerReturns, CdpError>

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

Source

pub async fn get_anchor_element( &self, params: GetAnchorElementParams, session_id: Option<&str>, ) -> Result<GetAnchorElementReturns, CdpError>

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

Source

pub async fn force_show_popover( &self, params: ForceShowPopoverParams, session_id: Option<&str>, ) -> Result<ForceShowPopoverReturns, CdpError>

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more