// Copyright © 2020 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp.DevTools.DOM { using System.Linq; /// /// 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 partial class DOM : DevToolsDomainBase { private CefSharp.DevTools.IDevToolsClient _client; public DOM(CefSharp.DevTools.IDevToolsClient client) { _client = (client); } partial void ValidateCollectClassNamesFromSubtree(int nodeId); /// /// Collects class names for the node with given id and all of it's child nodes. /// /// Id of the node to collect class names. /// returns System.Threading.Tasks.Task<CollectClassNamesFromSubtreeResponse> public async System.Threading.Tasks.Task CollectClassNamesFromSubtreeAsync(int nodeId) { ValidateCollectClassNamesFromSubtree(nodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.collectClassNamesFromSubtree", dict); return methodResult.DeserializeJson(); } partial void ValidateCopyTo(int nodeId, int targetNodeId, int? insertBeforeNodeId = null); /// /// Creates a deep copy of the specified node and places it into the target container before the /// given anchor. /// /// Id of the node to copy. /// Id of the element to drop the copy into. /// Drop the copy before this node (if absent, the copy becomes the last child of`targetNodeId`). /// returns System.Threading.Tasks.Task<CopyToResponse> public async System.Threading.Tasks.Task CopyToAsync(int nodeId, int targetNodeId, int? insertBeforeNodeId = null) { ValidateCopyTo(nodeId, targetNodeId, insertBeforeNodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("targetNodeId", targetNodeId); if (insertBeforeNodeId.HasValue) { dict.Add("insertBeforeNodeId", insertBeforeNodeId.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.copyTo", dict); return methodResult.DeserializeJson(); } partial void ValidateDescribeNode(int? nodeId = null, int? backendNodeId = null, string objectId = null, int? depth = null, bool? pierce = null); /// /// Describes node given its id, does not require domain to be enabled. Does not start tracking any /// objects, can be used for automation. /// /// Identifier of the node. /// Identifier of the backend node. /// JavaScript object id of the node wrapper. /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for theentire subtree or provide an integer larger than 0. /// Whether or not iframes and shadow roots should be traversed when returning the subtree(default is false). /// returns System.Threading.Tasks.Task<DescribeNodeResponse> public async System.Threading.Tasks.Task DescribeNodeAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null, int? depth = null, bool? pierce = null) { ValidateDescribeNode(nodeId, backendNodeId, objectId, depth, pierce); var dict = new System.Collections.Generic.Dictionary(); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectId))) { dict.Add("objectId", objectId); } if (depth.HasValue) { dict.Add("depth", depth.Value); } if (pierce.HasValue) { dict.Add("pierce", pierce.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.describeNode", dict); return methodResult.DeserializeJson(); } partial void ValidateScrollIntoViewIfNeeded(int? nodeId = null, int? backendNodeId = null, string objectId = null, CefSharp.DevTools.DOM.Rect rect = null); /// /// 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. /// /// Identifier of the node. /// Identifier of the backend node. /// JavaScript object id of the node wrapper. /// 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. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task ScrollIntoViewIfNeededAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null, CefSharp.DevTools.DOM.Rect rect = null) { ValidateScrollIntoViewIfNeeded(nodeId, backendNodeId, objectId, rect); var dict = new System.Collections.Generic.Dictionary(); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectId))) { dict.Add("objectId", objectId); } if ((rect) != (null)) { dict.Add("rect", rect.ToDictionary()); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.scrollIntoViewIfNeeded", dict); return methodResult; } /// /// Disables DOM agent for the given page. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task DisableAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.disable", dict); return methodResult; } partial void ValidateDiscardSearchResults(string searchId); /// /// Discards search results from the session with the given id. `getSearchResults` should no longer /// be called for that search. /// /// Unique search session identifier. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task DiscardSearchResultsAsync(string searchId) { ValidateDiscardSearchResults(searchId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("searchId", searchId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.discardSearchResults", dict); return methodResult; } /// /// Enables DOM agent for the given page. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task EnableAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.enable", dict); return methodResult; } partial void ValidateFocus(int? nodeId = null, int? backendNodeId = null, string objectId = null); /// /// Focuses the given element. /// /// Identifier of the node. /// Identifier of the backend node. /// JavaScript object id of the node wrapper. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task FocusAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) { ValidateFocus(nodeId, backendNodeId, objectId); var dict = new System.Collections.Generic.Dictionary(); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectId))) { dict.Add("objectId", objectId); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.focus", dict); return methodResult; } partial void ValidateGetAttributes(int nodeId); /// /// Returns attributes for the specified node. /// /// Id of the node to retrieve attibutes for. /// returns System.Threading.Tasks.Task<GetAttributesResponse> public async System.Threading.Tasks.Task GetAttributesAsync(int nodeId) { ValidateGetAttributes(nodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getAttributes", dict); return methodResult.DeserializeJson(); } partial void ValidateGetBoxModel(int? nodeId = null, int? backendNodeId = null, string objectId = null); /// /// Returns boxes for the given node. /// /// Identifier of the node. /// Identifier of the backend node. /// JavaScript object id of the node wrapper. /// returns System.Threading.Tasks.Task<GetBoxModelResponse> public async System.Threading.Tasks.Task GetBoxModelAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) { ValidateGetBoxModel(nodeId, backendNodeId, objectId); var dict = new System.Collections.Generic.Dictionary(); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectId))) { dict.Add("objectId", objectId); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getBoxModel", dict); return methodResult.DeserializeJson(); } partial void ValidateGetContentQuads(int? nodeId = null, int? backendNodeId = null, string objectId = null); /// /// Returns quads that describe node position on the page. This method /// might return multiple quads for inline nodes. /// /// Identifier of the node. /// Identifier of the backend node. /// JavaScript object id of the node wrapper. /// returns System.Threading.Tasks.Task<GetContentQuadsResponse> public async System.Threading.Tasks.Task GetContentQuadsAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) { ValidateGetContentQuads(nodeId, backendNodeId, objectId); var dict = new System.Collections.Generic.Dictionary(); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectId))) { dict.Add("objectId", objectId); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getContentQuads", dict); return methodResult.DeserializeJson(); } partial void ValidateGetDocument(int? depth = null, bool? pierce = null); /// /// Returns the root DOM node (and optionally the subtree) to the caller. /// /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for theentire subtree or provide an integer larger than 0. /// Whether or not iframes and shadow roots should be traversed when returning the subtree(default is false). /// returns System.Threading.Tasks.Task<GetDocumentResponse> public async System.Threading.Tasks.Task GetDocumentAsync(int? depth = null, bool? pierce = null) { ValidateGetDocument(depth, pierce); var dict = new System.Collections.Generic.Dictionary(); if (depth.HasValue) { dict.Add("depth", depth.Value); } if (pierce.HasValue) { dict.Add("pierce", pierce.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getDocument", dict); return methodResult.DeserializeJson(); } partial void ValidateGetFlattenedDocument(int? depth = null, bool? pierce = null); /// /// Returns the root DOM node (and optionally the subtree) to the caller. /// /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for theentire subtree or provide an integer larger than 0. /// Whether or not iframes and shadow roots should be traversed when returning the subtree(default is false). /// returns System.Threading.Tasks.Task<GetFlattenedDocumentResponse> public async System.Threading.Tasks.Task GetFlattenedDocumentAsync(int? depth = null, bool? pierce = null) { ValidateGetFlattenedDocument(depth, pierce); var dict = new System.Collections.Generic.Dictionary(); if (depth.HasValue) { dict.Add("depth", depth.Value); } if (pierce.HasValue) { dict.Add("pierce", pierce.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getFlattenedDocument", dict); return methodResult.DeserializeJson(); } partial void ValidateGetNodeForLocation(int x, int y, bool? includeUserAgentShadowDOM = null, bool? ignorePointerEventsNone = null); /// /// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is /// either returned or not. /// /// X coordinate. /// Y coordinate. /// False to skip to the nearest non-UA shadow root ancestor (default: false). /// Whether to ignore pointer-events: none on elements and hit test them. /// returns System.Threading.Tasks.Task<GetNodeForLocationResponse> public async System.Threading.Tasks.Task GetNodeForLocationAsync(int x, int y, bool? includeUserAgentShadowDOM = null, bool? ignorePointerEventsNone = null) { ValidateGetNodeForLocation(x, y, includeUserAgentShadowDOM, ignorePointerEventsNone); var dict = new System.Collections.Generic.Dictionary(); dict.Add("x", x); dict.Add("y", y); if (includeUserAgentShadowDOM.HasValue) { dict.Add("includeUserAgentShadowDOM", includeUserAgentShadowDOM.Value); } if (ignorePointerEventsNone.HasValue) { dict.Add("ignorePointerEventsNone", ignorePointerEventsNone.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getNodeForLocation", dict); return methodResult.DeserializeJson(); } partial void ValidateGetOuterHTML(int? nodeId = null, int? backendNodeId = null, string objectId = null); /// /// Returns node's HTML markup. /// /// Identifier of the node. /// Identifier of the backend node. /// JavaScript object id of the node wrapper. /// returns System.Threading.Tasks.Task<GetOuterHTMLResponse> public async System.Threading.Tasks.Task GetOuterHTMLAsync(int? nodeId = null, int? backendNodeId = null, string objectId = null) { ValidateGetOuterHTML(nodeId, backendNodeId, objectId); var dict = new System.Collections.Generic.Dictionary(); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectId))) { dict.Add("objectId", objectId); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getOuterHTML", dict); return methodResult.DeserializeJson(); } partial void ValidateGetRelayoutBoundary(int nodeId); /// /// Returns the id of the nearest ancestor that is a relayout boundary. /// /// Id of the node. /// returns System.Threading.Tasks.Task<GetRelayoutBoundaryResponse> public async System.Threading.Tasks.Task GetRelayoutBoundaryAsync(int nodeId) { ValidateGetRelayoutBoundary(nodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getRelayoutBoundary", dict); return methodResult.DeserializeJson(); } partial void ValidateGetSearchResults(string searchId, int fromIndex, int toIndex); /// /// Returns search results from given `fromIndex` to given `toIndex` from the search with the given /// identifier. /// /// Unique search session identifier. /// Start index of the search result to be returned. /// End index of the search result to be returned. /// returns System.Threading.Tasks.Task<GetSearchResultsResponse> public async System.Threading.Tasks.Task GetSearchResultsAsync(string searchId, int fromIndex, int toIndex) { ValidateGetSearchResults(searchId, fromIndex, toIndex); var dict = new System.Collections.Generic.Dictionary(); dict.Add("searchId", searchId); dict.Add("fromIndex", fromIndex); dict.Add("toIndex", toIndex); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getSearchResults", dict); return methodResult.DeserializeJson(); } /// /// Hides any highlight. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task HideHighlightAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.hideHighlight", dict); return methodResult; } /// /// Highlights DOM node. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task HighlightNodeAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.highlightNode", dict); return methodResult; } /// /// Highlights given rectangle. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task HighlightRectAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.highlightRect", dict); return methodResult; } /// /// Marks last undoable state. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task MarkUndoableStateAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.markUndoableState", dict); return methodResult; } partial void ValidateMoveTo(int nodeId, int targetNodeId, int? insertBeforeNodeId = null); /// /// Moves node into the new container, places it before the given anchor. /// /// Id of the node to move. /// Id of the element to drop the moved node into. /// Drop node before this one (if absent, the moved node becomes the last child of`targetNodeId`). /// returns System.Threading.Tasks.Task<MoveToResponse> public async System.Threading.Tasks.Task MoveToAsync(int nodeId, int targetNodeId, int? insertBeforeNodeId = null) { ValidateMoveTo(nodeId, targetNodeId, insertBeforeNodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("targetNodeId", targetNodeId); if (insertBeforeNodeId.HasValue) { dict.Add("insertBeforeNodeId", insertBeforeNodeId.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.moveTo", dict); return methodResult.DeserializeJson(); } partial void ValidatePerformSearch(string query, bool? includeUserAgentShadowDOM = null); /// /// Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or /// `cancelSearch` to end this search session. /// /// Plain text or query selector or XPath search query. /// True to search in user agent shadow DOM. /// returns System.Threading.Tasks.Task<PerformSearchResponse> public async System.Threading.Tasks.Task PerformSearchAsync(string query, bool? includeUserAgentShadowDOM = null) { ValidatePerformSearch(query, includeUserAgentShadowDOM); var dict = new System.Collections.Generic.Dictionary(); dict.Add("query", query); if (includeUserAgentShadowDOM.HasValue) { dict.Add("includeUserAgentShadowDOM", includeUserAgentShadowDOM.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.performSearch", dict); return methodResult.DeserializeJson(); } partial void ValidatePushNodeByPathToFrontend(string path); /// /// Requests that the node is sent to the caller given its path. // FIXME, use XPath /// /// Path to node in the proprietary format. /// returns System.Threading.Tasks.Task<PushNodeByPathToFrontendResponse> public async System.Threading.Tasks.Task PushNodeByPathToFrontendAsync(string path) { ValidatePushNodeByPathToFrontend(path); var dict = new System.Collections.Generic.Dictionary(); dict.Add("path", path); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.pushNodeByPathToFrontend", dict); return methodResult.DeserializeJson(); } partial void ValidatePushNodesByBackendIdsToFrontend(int[] backendNodeIds); /// /// Requests that a batch of nodes is sent to the caller given their backend node ids. /// /// The array of backend node ids. /// returns System.Threading.Tasks.Task<PushNodesByBackendIdsToFrontendResponse> public async System.Threading.Tasks.Task PushNodesByBackendIdsToFrontendAsync(int[] backendNodeIds) { ValidatePushNodesByBackendIdsToFrontend(backendNodeIds); var dict = new System.Collections.Generic.Dictionary(); dict.Add("backendNodeIds", backendNodeIds); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.pushNodesByBackendIdsToFrontend", dict); return methodResult.DeserializeJson(); } partial void ValidateQuerySelector(int nodeId, string selector); /// /// Executes `querySelector` on a given node. /// /// Id of the node to query upon. /// Selector string. /// returns System.Threading.Tasks.Task<QuerySelectorResponse> public async System.Threading.Tasks.Task QuerySelectorAsync(int nodeId, string selector) { ValidateQuerySelector(nodeId, selector); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("selector", selector); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.querySelector", dict); return methodResult.DeserializeJson(); } partial void ValidateQuerySelectorAll(int nodeId, string selector); /// /// Executes `querySelectorAll` on a given node. /// /// Id of the node to query upon. /// Selector string. /// returns System.Threading.Tasks.Task<QuerySelectorAllResponse> public async System.Threading.Tasks.Task QuerySelectorAllAsync(int nodeId, string selector) { ValidateQuerySelectorAll(nodeId, selector); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("selector", selector); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.querySelectorAll", dict); return methodResult.DeserializeJson(); } /// /// Re-does the last undone action. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task RedoAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.redo", dict); return methodResult; } partial void ValidateRemoveAttribute(int nodeId, string name); /// /// Removes attribute with given name from an element with given id. /// /// Id of the element to remove attribute from. /// Name of the attribute to remove. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task RemoveAttributeAsync(int nodeId, string name) { ValidateRemoveAttribute(nodeId, name); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("name", name); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.removeAttribute", dict); return methodResult; } partial void ValidateRemoveNode(int nodeId); /// /// Removes node with given id. /// /// Id of the node to remove. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task RemoveNodeAsync(int nodeId) { ValidateRemoveNode(nodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.removeNode", dict); return methodResult; } partial void ValidateRequestChildNodes(int nodeId, int? depth = null, bool? pierce = null); /// /// 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. /// /// Id of the node to get children for. /// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for theentire subtree or provide an integer larger than 0. /// Whether or not iframes and shadow roots should be traversed when returning the sub-tree(default is false). /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task RequestChildNodesAsync(int nodeId, int? depth = null, bool? pierce = null) { ValidateRequestChildNodes(nodeId, depth, pierce); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); if (depth.HasValue) { dict.Add("depth", depth.Value); } if (pierce.HasValue) { dict.Add("pierce", pierce.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.requestChildNodes", dict); return methodResult; } partial void ValidateRequestNode(string objectId); /// /// 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. /// /// JavaScript object id to convert into node. /// returns System.Threading.Tasks.Task<RequestNodeResponse> public async System.Threading.Tasks.Task RequestNodeAsync(string objectId) { ValidateRequestNode(objectId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("objectId", objectId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.requestNode", dict); return methodResult.DeserializeJson(); } partial void ValidateResolveNode(int? nodeId = null, int? backendNodeId = null, string objectGroup = null, int? executionContextId = null); /// /// Resolves the JavaScript node object for a given NodeId or BackendNodeId. /// /// Id of the node to resolve. /// Backend identifier of the node to resolve. /// Symbolic group name that can be used to release multiple objects. /// Execution context in which to resolve the node. /// returns System.Threading.Tasks.Task<ResolveNodeResponse> public async System.Threading.Tasks.Task ResolveNodeAsync(int? nodeId = null, int? backendNodeId = null, string objectGroup = null, int? executionContextId = null) { ValidateResolveNode(nodeId, backendNodeId, objectGroup, executionContextId); var dict = new System.Collections.Generic.Dictionary(); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectGroup))) { dict.Add("objectGroup", objectGroup); } if (executionContextId.HasValue) { dict.Add("executionContextId", executionContextId.Value); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.resolveNode", dict); return methodResult.DeserializeJson(); } partial void ValidateSetAttributeValue(int nodeId, string name, string value); /// /// Sets attribute for an element with given id. /// /// Id of the element to set attribute for. /// Attribute name. /// Attribute value. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetAttributeValueAsync(int nodeId, string name, string value) { ValidateSetAttributeValue(nodeId, name, value); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("name", name); dict.Add("value", value); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setAttributeValue", dict); return methodResult; } partial void ValidateSetAttributesAsText(int nodeId, string text, string name = null); /// /// 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. /// /// Id of the element to set attributes for. /// Text with a number of attributes. Will parse this text using HTML parser. /// Attribute name to replace with new attributes derived from text in case text parsedsuccessfully. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetAttributesAsTextAsync(int nodeId, string text, string name = null) { ValidateSetAttributesAsText(nodeId, text, name); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("text", text); if (!(string.IsNullOrEmpty(name))) { dict.Add("name", name); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setAttributesAsText", dict); return methodResult; } partial void ValidateSetFileInputFiles(string[] files, int? nodeId = null, int? backendNodeId = null, string objectId = null); /// /// Sets files for the given file input element. /// /// Array of file paths to set. /// Identifier of the node. /// Identifier of the backend node. /// JavaScript object id of the node wrapper. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetFileInputFilesAsync(string[] files, int? nodeId = null, int? backendNodeId = null, string objectId = null) { ValidateSetFileInputFiles(files, nodeId, backendNodeId, objectId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("files", files); if (nodeId.HasValue) { dict.Add("nodeId", nodeId.Value); } if (backendNodeId.HasValue) { dict.Add("backendNodeId", backendNodeId.Value); } if (!(string.IsNullOrEmpty(objectId))) { dict.Add("objectId", objectId); } var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setFileInputFiles", dict); return methodResult; } partial void ValidateSetNodeStackTracesEnabled(bool enable); /// /// Sets if stack traces should be captured for Nodes. See `Node.getNodeStackTraces`. Default is disabled. /// /// Enable or disable. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetNodeStackTracesEnabledAsync(bool enable) { ValidateSetNodeStackTracesEnabled(enable); var dict = new System.Collections.Generic.Dictionary(); dict.Add("enable", enable); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setNodeStackTracesEnabled", dict); return methodResult; } partial void ValidateGetNodeStackTraces(int nodeId); /// /// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation. /// /// Id of the node to get stack traces for. /// returns System.Threading.Tasks.Task<GetNodeStackTracesResponse> public async System.Threading.Tasks.Task GetNodeStackTracesAsync(int nodeId) { ValidateGetNodeStackTraces(nodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getNodeStackTraces", dict); return methodResult.DeserializeJson(); } partial void ValidateGetFileInfo(string objectId); /// /// Returns file information for the given /// File wrapper. /// /// JavaScript object id of the node wrapper. /// returns System.Threading.Tasks.Task<GetFileInfoResponse> public async System.Threading.Tasks.Task GetFileInfoAsync(string objectId) { ValidateGetFileInfo(objectId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("objectId", objectId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getFileInfo", dict); return methodResult.DeserializeJson(); } partial void ValidateSetInspectedNode(int nodeId); /// /// Enables console to refer to the node with given id via $x (see Command Line API for more details /// $x functions). /// /// DOM node id to be accessible by means of $x command line API. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetInspectedNodeAsync(int nodeId) { ValidateSetInspectedNode(nodeId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setInspectedNode", dict); return methodResult; } partial void ValidateSetNodeName(int nodeId, string name); /// /// Sets node name for a node with given id. /// /// Id of the node to set name for. /// New node's name. /// returns System.Threading.Tasks.Task<SetNodeNameResponse> public async System.Threading.Tasks.Task SetNodeNameAsync(int nodeId, string name) { ValidateSetNodeName(nodeId, name); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("name", name); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setNodeName", dict); return methodResult.DeserializeJson(); } partial void ValidateSetNodeValue(int nodeId, string value); /// /// Sets node value for a node with given id. /// /// Id of the node to set value for. /// New node's value. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetNodeValueAsync(int nodeId, string value) { ValidateSetNodeValue(nodeId, value); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("value", value); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setNodeValue", dict); return methodResult; } partial void ValidateSetOuterHTML(int nodeId, string outerHTML); /// /// Sets node HTML markup, returns new node id. /// /// Id of the node to set markup for. /// Outer HTML markup to set. /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task SetOuterHTMLAsync(int nodeId, string outerHTML) { ValidateSetOuterHTML(nodeId, outerHTML); var dict = new System.Collections.Generic.Dictionary(); dict.Add("nodeId", nodeId); dict.Add("outerHTML", outerHTML); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.setOuterHTML", dict); return methodResult; } /// /// Undoes the last performed action. /// /// returns System.Threading.Tasks.Task<DevToolsMethodResponse> public async System.Threading.Tasks.Task UndoAsync() { System.Collections.Generic.Dictionary dict = null; var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.undo", dict); return methodResult; } partial void ValidateGetFrameOwner(string frameId); /// /// Returns iframe node that owns iframe with the given domain. /// /// frameId /// returns System.Threading.Tasks.Task<GetFrameOwnerResponse> public async System.Threading.Tasks.Task GetFrameOwnerAsync(string frameId) { ValidateGetFrameOwner(frameId); var dict = new System.Collections.Generic.Dictionary(); dict.Add("frameId", frameId); var methodResult = await _client.ExecuteDevToolsMethodAsync("DOM.getFrameOwner", dict); return methodResult.DeserializeJson(); } } }