该域公开了DOM的读写操作。每个DOM节点都通过其镜像对象表示,该对象具有一个id。此id可用于获取节点的附加信息,将其解析为JavaScript对象包装器等。客户端仅接收已知节点的DOM事件至关重要。后端会跟踪已发送给客户端的节点,并且永远不会重复发送同一节点。客户端有责任收集已发送给客户端的节点信息。请注意,iframe所有者元素将返回相应的文档元素作为其子节点。
EN
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.
✅️️ Methods
🔨DOM.describeNode
描述给定其ID的节点,不需要启用域。不开始跟踪任何对象,可用于自动化。
EN
Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | | | NodeId | 节点的标识符。 | ENIdentifier of the node. |
| backendNodeId | | | BackendNodeId | 后端节点的标识符。 | ENIdentifier of the backend node. |
| objectId | | | Runtime.RemoteObjectId | 节点包装器的JavaScript对象标识符。 | ENJavaScript object id of the node wrapper. |
| depth | | | integer | 获取子节点的最大深度,默认为1。使用-1表示整个子树,或提供大于0的整数。 | ENThe 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 | | | boolean | 是否在返回子树时遍历 iframe 和 shadow root(默认为 false)。 | ENWhether or not iframes and shadow roots should be traversed when returning the subtree (default is false). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| node | Node | 节点描述。 | ENNode description. |
🔨DOM.disable
为给定页面禁用DOM代理。
EN
Disables DOM agent for the given page.
🔨DOM.enable
为给定页面启用DOM代理。
EN
Enables DOM agent for the given page.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| includeWhitespace | | 🧪 | string | 是否在返回节点的子节点数组中包含空白字符。 允许的值:none, all | ENWhether to include whitespaces in the children array of returned Nodes. Allowed Values: none, all |
🔨DOM.focus
聚焦给定的元素。
EN
Focuses the given element.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | | | NodeId | 节点的标识符。 | ENIdentifier of the node. |
| backendNodeId | | | BackendNodeId | 后端节点的标识符。 | ENIdentifier of the backend node. |
| objectId | | | Runtime.RemoteObjectId | 节点包装器的JavaScript对象标识符。 | ENJavaScript object id of the node wrapper. |
🔨DOM.getAttributes
返回指定节点的属性。
EN
Returns attributes for the specified node.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要检索属性的节点ID。 | ENId of the node to retrieve attributes for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| attributes | array[string] | 一个交错排列的节点属性名称和值的数组。 | ENAn interleaved array of node attribute names and values. |
🔨DOM.getBoxModel
返回给定节点的''boxes''。
EN
Returns boxes for the given node.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | | | NodeId | 节点的标识符。 | ENIdentifier of the node. |
| backendNodeId | | | BackendNodeId | 后端节点的标识符。 | ENIdentifier of the backend node. |
| objectId | | | Runtime.RemoteObjectId | 节点包装器的JavaScript对象标识符。 | ENJavaScript object id of the node wrapper. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| model | BoxModel | 节点的盒模型。 | ENBox model for the node. |
🔨DOM.getDocument
返回根DOM节点(以及可选的子树)给调用者。隐式地为当前目标启用DOM域事件。
EN
Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| depth | | | integer | 获取子节点的最大深度,默认为1。使用-1表示整个子树,或提供大于0的整数。 | ENThe 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 | | | boolean | 在返回子树时是否应遍历iframe和shadow root(默认为false)。 | ENWhether or not iframes and shadow roots should be traversed when returning the subtree (default is false). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| root | Node | 结果节点。 | ENResulting node. |
🔨DOM.getNodeForLocation
返回给定位置的节点ID。根据DOM域是否启用,nodeId可能会被返回或不返回。
EN
Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| x | ✔️ | | integer | X 坐标。 | ENX coordinate. |
| y | ✔️ | | integer | Y 坐标。 | ENY coordinate. |
| includeUserAgentShadowDOM | | | boolean | 设置为 false 以跳过至最近的非用户代理阴影根祖先(默认值:false)。 | ENFalse to skip to the nearest non-UA shadow root ancestor (default: false). |
| ignorePointerEventsNone | | | boolean | 是否忽略元素上的pointer-events: none并对其进行命中测试。 | ENWhether to ignore pointer-events: none on elements and hit test them. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| backendNodeId | BackendNodeId | 生成的节点。 | ENResulting node. |
| frameId | Page.FrameId | 此节点所属的框架。 | ENFrame this node belongs to. |
| nodeId | NodeId | 节点在给定坐标处的标识符,仅当启用并请求文档时。 | ENId of the node at given coordinates, only when enabled and requested document. |
🔨DOM.getOuterHTML
返回节点的HTML标记。
EN
Returns node's HTML markup.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | | | NodeId | 节点的标识符。 | ENIdentifier of the node. |
| backendNodeId | | | BackendNodeId | 后端节点的标识符。 | ENIdentifier of the backend node. |
| objectId | | | Runtime.RemoteObjectId | 节点包装器的 JavaScript 对象标识符。 | ENJavaScript object id of the node wrapper. |
| includeShadowDOM | | 🧪 | boolean | 包含所有影子根。如果未指定,则默认为 false。 | ENInclude all shadow roots. Equals to false if not specified. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| outerHTML | string | 外部 HTML 标记。 | ENOuter HTML markup. |
🔨DOM.hideHighlight
隐藏任何高亮。
EN
🔨DOM.highlightNode
高亮显示DOM节点。
EN
🔨DOM.highlightRect
高亮显示给定的矩形。
EN
Highlights given rectangle.
🔨DOM.moveTo
将节点移动到新的容器中,并将其放置在给定锚点之前。
EN
Moves node into the new container, places it before the given anchor.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要移动的节点的Id。 | ENId of the node to move. |
| targetNodeId | ✔️ | | NodeId | 要移动的节点将被放置到的元素ID。 | ENId of the element to drop the moved node into. |
| insertBeforeNodeId | | | NodeId | 将节点移至此节点之前(如果缺失,被移动的节点将成为 targetNodeId 的最后一个子节点)。 | ENDrop node before this one (if absent, the moved node becomes the last child of targetNodeId). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 移动后节点的新ID。 | ENNew id of the moved node. |
🔨DOM.querySelector
在给定节点上执行 querySelector。
EN
Executes querySelector on a given node.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要查询的节点的''Id''。 | ENId of the node to query upon. |
| selector | ✔️ | | string | 选择器字符串。 | ENSelector string. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 查询选择器结果。 | ENQuery selector result. |
🔨DOM.querySelectorAll
在指定节点上执行 querySelectorAll。
EN
Executes querySelectorAll on a given node.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要查询的节点的''Id''。 | ENId of the node to query upon. |
| selector | ✔️ | | string | 选择器字符串。 | ENSelector string. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeIds | array[NodeId] | 查询选择器结果。 | ENQuery selector result. |
🔨DOM.removeAttribute
从具有指定id的元素中移除具有指定名称的属性。
EN
Removes attribute with given name from an element with given id.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要从其移除属性的元素ID。 | ENId of the element to remove attribute from. |
| name | ✔️ | | string | 要移除的属性的名称。 | ENName of the attribute to remove. |
🔨DOM.removeNode
删除具有给定 id 的节点。
EN
Removes node with given id.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要移除的节点的Id。 | ENId of the node to remove. |
🔨DOM.requestChildNodes
请求以setChildNodes事件的形式返回给定ID节点的子节点给调用者,其中不仅检索直接子节点,还包括指定深度内的所有子节点。
EN
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.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 获取子节点的节点ID。 | ENId of the node to get children for. |
| depth | | | integer | 获取子节点的最大深度,默认为1。使用-1表示整个子树,或提供一个大于0的整数。 | ENThe 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 | | | boolean | 在返回子树时是否应遍历iframe和shadow root(默认为false)。 | ENWhether or not iframes and shadow roots should be traversed when returning the sub-tree (default is false). |
🔨DOM.requestNode
请求将节点发送给调用者 ,前提是提供了JavaScript节点对象引用。从该节点到根节点路径上的所有节点也会以一系列setChildNodes通知的形式发送给客户端。
EN
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.
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 给定对象的节点ID。 | ENNode id for given object. |
🔨DOM.resolveNode
为给定的 NodeId 或 BackendNodeId 解析对应的 JavaScript 节点对象。
EN
Resolves the JavaScript node object for a given NodeId or BackendNodeId.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | | | NodeId | 要解析的节点的Id。 | ENId of the node to resolve. |
| backendNodeId | | | DOM.BackendNodeId | 要解析的节点的后端标识符。 | ENBackend identifier of the node to resolve. |
| objectGroup | | | string | 可用于释放多个对象的符号化组名。 | ENSymbolic group name that can be used to release multiple objects. |
| executionContextId | | | Runtime.ExecutionContextId | 解析节点所在的执行上下文。 | ENExecution context in which to resolve the node. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| object | Runtime.RemoteObject | 给定节点的JavaScript对象包装器。 | ENJavaScript object wrapper for given node. |
如果指定节点的矩形区域当前不可见,则将其滚动至视图中。注意:应传入 nodeId、backendNodeId 和 objectId 中的任意一个参数来标识节点。
EN
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.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | | | NodeId | 节点的标识符。 | ENIdentifier of the node. |
| backendNodeId | | | BackendNodeId | 后端节点的标识符。 | ENIdentifier of the backend node. |
| objectId | | | Runtime.RemoteObjectId | 节点包装器的JavaScript对象标识符。 | ENJavaScript object id of the node wrapper. |
| rect | | | Rect | 要滚动到视口内的矩形区域,相对于节点的边框盒,以CSS像素为单位。如果省略,则使用节点的中心,类似于Element.scrollIntoView的行为。 | ENThe 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. |
🔨DOM.setAttributesAsText
设置具有给定id的元素的属性。当用户编辑某些现有属性值并输入多个属性名称/值对时,此方法非常有用。
EN
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.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 为元素设置属性的ID。 | ENId of the element to set attributes for. |
| text | ✔️ | | string | 包含多个属性的文本。将使用HTML解析器解析此文本。 | ENText with a number of attributes. Will parse this text using HTML parser. |
| name | | | string | 属性名称,在文本解析成功的情况下,将替换为从文本派生出的新属性。 | ENAttribute name to replace with new attributes derived from text in case text parsed successfully. |
🔨DOM.setAttributeValue
为具有给定 id 的元素设置属性。
EN
Sets attribute for an element with given id.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要设置属性的元素ID。 | ENId of the element to set attribute for. |
| name | ✔️ | | string | 属性名称。 | ENAttribute name. |
| value | ✔️ | | string | 属性值。 | ENAttribute value. |
为给定的文件输入元素设置文件。
EN
Sets files for the given file input element.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| files | ✔️ | | array[string] | 要设置的文件路径数组。 | ENArray of file paths to set. |
| nodeId | | | NodeId | 节点的标识符。 | ENIdentifier of the node. |
| backendNodeId | | | BackendNodeId | 后端节点的标识符。 | ENIdentifier of the backend node. |
| objectId | | | Runtime.RemoteObjectId | 节点包装器的JavaScript对象标识符。 | ENJavaScript object id of the node wrapper. |
🔨DOM.setNodeName
为具有给定id的节点设置节点名称。
EN
Sets node name for a node with given id.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 为节点设置名称的Id。 | ENId of the node to set name for. |
| name | ✔️ | | string | 新节点的名称。 | ENNew node's name. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 新节点的ID。 | ENNew node's id. |
🔨DOM.setNodeValue
为具有给定id的节点设置节点值。
EN
Sets node value for a node with given id.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 为节点设置值的ID。 | ENId of the node to set value for. |
| value | ✔️ | | string | 新节点的值。 | ENNew node's value. |
🔨DOM.setOuterHTML
设置节点HTML标记,返回新节点ID。
EN
Sets node HTML markup, returns new node id.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 为节点设置标记的ID。 | ENId of the node to set markup for. |
| outerHTML | ✔️ | | string | 设置外部HTML标记。 | ENOuter HTML markup to set. |
🔨DOM.getFlattenedDocument❌️
返回根DOM节点(以及可选的子树)给调用者。已弃用,因为它并未设计为与DOM代理的其他部分良好协作。请改用DOMSnapshot.captureSnapshot。
EN
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.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| depth | | | integer | 获取子节点的最大深度,默认为1。使用 -1 表示整个子树,或提供大于0的整 数。 | ENThe 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 | | | boolean | 是否在返回子树时遍历 iframe 和 shadow root(默认为 false)。 | ENWhether or not iframes and shadow roots should be traversed when returning the subtree (default is false). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodes | array[Node] | 结果节点。 | ENResulting node. |
🔨DOM.collectClassNamesFromSubtree🧪
收集具有给定ID的节点及其所有子节点的类名。
EN
Collects class names for the node with given id and all of it's child nodes.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要收集类名的节点ID。 | ENId of the node to collect class names. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| classNames | array[string] | 类名列表。 | ENClass name list. |
🔨DOM.copyTo🧪
创建指定节点的深度副本,并将其放置在目标容器中给定锚点之前。
EN
Creates a deep copy of the specified node and places it into the target container before the given anchor.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 要复制的节点的ID。 | ENId of the node to copy. |
| targetNodeId | ✔️ | | NodeId | 将副本拖入的元素的Id。 | ENId of the element to drop the copy into. |
| insertBeforeNodeId | | | NodeId | 在此节点之前放置副本(如果不存在,则副本将成为 targetNodeId 的最后一个子节点)。 | ENDrop the copy before this node (if absent, the copy becomes the last child of targetNodeId). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 节点克隆的ID。 | ENId of the node clone. |
🔨DOM.discardSearchResults🧪
丢弃具有给定ID的会话中的搜索结果。对于该搜索,不应再调用getSearchResults。
EN
Discards search results from the session with the given id. getSearchResults should no longer be called for that search.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| searchId | ✔️ | | string | 唯一的搜索会话标识符。 | ENUnique search session identifier. |
🔨DOM.forceShowPopover🧪
启用时,此API会强制打开由nodeId标识的弹出层,并在禁用前保持其开启状态。
EN
When enabling, this API force-opens the popover identified by nodeId and keeps it open until disabled.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 弹出式HTML元素的Id | ENId of the popover HTMLElement |
| enable | ✔️ | | boolean | 如果为真,则打开弹出窗口并保持其打开状态。如果为假,则关闭之前被强制打开的弹出窗口。 | ENIf true, opens the popover and keeps it open. If false, closes the popover if it was previously force-opened. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeIds | array[NodeId] | 根据弹出层堆叠顺序而关闭 的弹出层列表。 | ENList of popovers that were closed in order to respect popover stacking order. |
🔨DOM.getAnchorElement🧪
根据https://www.w3.org/TR/css-anchor-position-1/#target规范,返回给定锚点查询对应的目标锚点元素。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 给定锚点查询的锚点元素。 | ENThe anchor element of the given anchor query. |
🔨DOM.getContainerForNode🧪
返回给定节点基于容器查询条件的查询容器:容器名称、物理和逻辑轴,以及是否查询滚动状态或锚定元素。如果未提供轴且queriesScrollState为false,则返回样式容器,即直接父节点或具有匹配容器名称的最近元素。
EN
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.
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 给定节点的容器节点,如果未找到则为null。 | ENThe container node for the given node, or null if not found. |
🔨DOM.getContentQuads🧪
返回描述节点在页面上位置的四边形。此方法可能为内联节点返回多个四边形。
EN
Returns quads that describe node position on the page. This method might return multiple quads for inline nodes.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | | | NodeId | 节点的标识符。 | ENIdentifier of the node. |
| backendNodeId | | | BackendNodeId | 后端节点的标识符。 | ENIdentifier of the backend node. |
| objectId | | | Runtime.RemoteObjectId | 节点包装器的 JavaScript 对象标识符。 | ENJavaScript object id of the node wrapper. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| quads | array[Quad] | 描述节点相对于视 口布局的四边形。 | ENQuads that describe node layout relative to viewport. |
🔨DOM.getDetachedDomNodes🧪
返回分离节点列表
EN
Returns list of detached nodes
🔨DOM.getElementByRelation🧪
根据特定关系返回匹配元素的NodeId。
EN
Returns the NodeId of the matched element according to certain relations.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 查询关系的节点标识。 | ENId of the node from which to query the relation. |
| relation | ✔️ | | string | 要获取的关系类型。 允许的值:PopoverTarget、InterestTarget、CommandFor | ENType of relation to get. Allowed Values: PopoverTarget, InterestTarget, CommandFor |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 匹配查询关系的元素的NodeId。 | ENNodeId of the element matching the queried relation. |
🔨DOM.getFileInfo🧪
返回给定File包装器的文件信息。
EN
Returns file information for the given File wrapper.
🔨DOM.getFrameOwner🧪
返回拥有指定域名的iframe的iframe节点。
EN
Returns iframe node that owns iframe with the given domain.
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| backendNodeId | BackendNodeId | 结果节点。 | ENResulting node. |
| nodeId | NodeId | 在启用并请求文档的情况下,仅返回给定坐标处的节点ID。 | ENId of the node at given coordinates, only when enabled and requested document. |
🔨DOM.getNodesForSubtreeByStyle🧪
在子树中查找具有指定计算样式的节点。
EN
Finds nodes with a given computed style in a subtree.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 指向子树根的节点ID。 | ENNode ID pointing to the root of a subtree. |
| computedStyles | ✔️ | | array[CSSComputedStyleProperty] | 用于筛选节点的样式(如果任何属性匹配,则包含节点)。 | ENThe style to filter nodes by (includes nodes if any of properties matches). |
| pierce | | | boolean | 是否在返回结果时 遍历同一目标中的 iframe 和 shadow root(默认为 false)。 | ENWhether or not iframes and shadow roots in the same target should be traversed when returning the results (default is false). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeIds | array[NodeId] | 结果节点。 | ENResulting nodes. |
🔨DOM.getNodeStackTraces🧪
获取与节点关联的堆栈跟踪。截至目前,仅提供节点创建时的堆栈跟踪。
EN
Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 获取堆栈跟踪的节点ID。 | ENId of the node to get stack traces for. |
🔨DOM.getQueryingDescendantsForContainer🧪
返回一个容器查询容器的后代元素,这些后代元素针对该容器设置了容器查询。
EN
Returns the descendants of a container query container that have container queries against this container.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 从其中查找查询后代的容器节点ID。 | ENId of the container node to find querying descendants from. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeIds | array[NodeId] | 针对给定容器的具有容器查询的后代节点。 | ENDescendant nodes with container queries against the given container. |
🔨DOM.getRelayoutBoundary🧪
返回最近祖先的id,该祖先是一个重新布局边界。
EN
Returns the id of the nearest ancestor that is a relayout boundary.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 节点的ID。 | ENId of the node. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 给定节点的重排边界节点ID。 | ENRelayout boundary node id for the given node. |
🔨DOM.getSearchResults🧪
从给定标识符的搜索结果中,返回从指定fromIndex到toIndex的搜索结果。
EN
Returns search results from given fromIndex to given toIndex from the search with the given identifier.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| searchId | ✔️ | | string | 唯一的搜索会话标识符。 | ENUnique search session identifier. |
| fromIndex | ✔️ | | integer | 要返回的搜索结果的起始索引。 | ENStart index of the search result to be returned. |
| toIndex | ✔️ | | integer | 要返回的搜索结果的结束索引。 | ENEnd index of the search result to be returned. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeIds | array[NodeId] | 搜索结果节点的ID。 | ENIds of the search result nodes. |
🔨DOM.getTopLayerElements🧪
返回当前顶层元素的NodeId。顶层元素在视口内渲染得最靠近用户,因此其元素始终显示在所有其他内容之上。
EN
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.
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeIds | array[NodeId] | 顶层元素的节点ID | ENNodeIds of top layer elements |
🔨DOM.markUndoableState🧪
标记最后一个可撤销状态。
EN
Marks last undoable state.
在DOM树中搜索给定的字符串。使用getSearchResults访问搜索结果,或使用cancelSearch结束此搜索会话。
EN
Searches for a given string in the DOM tree. Use getSearchResults to access search results or cancelSearch to end this search session.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| query | ✔️ | | string | 纯文本或查询选择器或XPath搜索查询。 | ENPlain text or query selector or XPath search query. |
| includeUserAgentShadowDOM | | | boolean | 在用户代理影子DOM中搜索。 | ENTrue to search in user agent shadow DOM. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| searchId | string | 唯一搜索会话标识符。 | ENUnique search session identifier. |
| resultCount | integer | 搜索结果数量。 | ENNumber of search results. |
🔨DOM.pushNodeByPathToFrontend🧪
根据其路径将节点发送给调用者的请求。 // FIXME,使用XPath
EN
Requests that the node is sent to the caller given its path. // FIXME, use XPath
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| path | ✔️ | | string | 专有格式中的节点路径。 | ENPath to node in the proprietary format. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeId | NodeId | 给定路径的节点Id。 | ENId of the node for given path. |
🔨DOM.pushNodesByBackendIdsToFrontend🧪
根据其后端节点ID,请求将一批节点发送给调用者。
EN
Requests that a batch of nodes is sent to the caller given their backend node ids.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| backendNodeIds | ✔️ | | array[BackendNodeId] | 后端节点ID的数组。 | ENThe array of backend node ids. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|
| nodeIds | array[NodeId] | 与backendNodeIds中指定的后端节点ID相对应的已推送节点ID数组。 | ENThe array of ids of pushed nodes that correspond to the backend ids specified in backendNodeIds. |
🔨DOM.redo🧪
重做上一个已撤销的操作。
EN
Re-does the last undone action.
🔨DOM.setInspectedNode🧪
启用控制台通过$x引用具有给定ID的节点(有关$x函数的更多详细信息,请参阅命令行API)。
EN
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | DOM节点ID,可通过$x命令行API访问。 | ENDOM node id to be accessible by means of $x command line API. |
🔨DOM.setNodeStackTracesEnabled🧪
设置是否应为节点捕获堆栈跟踪。参见 Node.getNodeStackTraces。默认情况下为禁用。
EN
Sets if stack traces should be captured for Nodes. See Node.getNodeStackTraces. Default is disabled.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| enable | ✔️ | | boolean | 启用或禁用。 | ENEnable or disable. |
🔨DOM.undo🧪
撤销上次执行的操作。
EN
Undoes the last performed action.
✅️️ Events
👋DOM.attributeModified
当Element的属性被修改时触发。
EN
Fired when Element's attribute is modified.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|
| nodeId | ✔️ | | NodeId | 已更改节点的Id。 | ENId of the node that has changed. |
| name | ✔️ | | string | 属性名称。 | ENAttribute name. |
| value | |