DOMSnapshot🧪
此领域便于获取包含DOM、布局及样式信息的文档快照。
EN
This domain facilitates obtaining document snapshots with DOM, layout, and style information.
✅️️ Methods
🔨DOMSnapshot.captureSnapshot
返回一个文档快照,其中包含根节点(包括iframe、模板内容和导入文档)的完整DOM树(以扁平化数组形式呈现),以及节点的布局和允许列表内的计算样式信息。返回的DOM树中的Shadow DOM已被扁平化处理。
EN
Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents) in a flattened array, as well as layout and white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is flattened.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| computedStyles | ✔️ | array[string] | 要返回的计算样式白名单。 | ENWhitelist of computed styles to return. | |
| includePaintOrder | boolean | 是否将布局对象的绘制顺序包含到快照中。 | ENWhether to include layout object paint orders into the snapshot. | ||
| includeDOMRects | boolean | 是否将DOM矩形(offsetRects、clientRects、scrollRects)包含到快照中 | ENWhether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot | ||
| includeBlendedBackgroundColors | 🧪 | boolean | 是否在快照中包含混合背景颜色(默认:false)。混合背景颜色是通过混合与当前元素重叠的所有元素的背景颜色来实现的。 | ENWhether to include blended background colors in the snapshot (default: false). Blended background color is achieved by blending background colors of all elements that overlap with the current element. | |
| includeTextColorOpacities | 🧪 | boolean | 是否在快照中包含文本颜色透明度(默认值:false)。元素可能设置了影响其文本颜色的透明度属性。最终文本颜色透明度将根据所有重叠元素的透明度计算得出。 | ENWhether to include text color opacity in the snapshot (default: false). An element might have the opacity property set that affects the text color of the element. The final text color opacity is computed based on the opacity of all overlapping elements. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| documents | array[DocumentSnapshot] | DOM树中的节点。索引0处的DOMNode对应于根文档。 | ENThe nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. |
| strings | array[string] | 所有字符串属性通过索引引用的共享字符串表。 | ENShared string table that all string properties refer to with indexes. |
🔨DOMSnapshot.disable
为给定页面禁用DOM快照代理。
EN
Disables DOM snapshot agent for the given page.
🔨DOMSnapshot.enable
为给定页面启用DOM快照代理。
EN
Enables DOM snapshot agent for the given page.