dom_snapshot
ArrayOfStrings
Bases: list
Index of the string in the strings table.
Source code in zendriver/cdp/dom_snapshot.py
__repr__()
from_json(json)
classmethod
ComputedStyle
dataclass
A subset of the full ComputedStyle as defined by the request whitelist.
Source code in zendriver/cdp/dom_snapshot.py
properties: typing.List[NameValue]
instance-attribute
__init__(properties)
from_json(json)
classmethod
DOMNode
dataclass
A Node in the DOM tree.
Source code in zendriver/cdp/dom_snapshot.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
attributes: typing.Optional[typing.List[NameValue]] = None
class-attribute
instance-attribute
backend_node_id: dom.BackendNodeId
instance-attribute
base_url: typing.Optional[str] = None
class-attribute
instance-attribute
child_node_indexes: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
content_document_index: typing.Optional[int] = None
class-attribute
instance-attribute
content_language: typing.Optional[str] = None
class-attribute
instance-attribute
current_source_url: typing.Optional[str] = None
class-attribute
instance-attribute
document_encoding: typing.Optional[str] = None
class-attribute
instance-attribute
document_url: typing.Optional[str] = None
class-attribute
instance-attribute
event_listeners: typing.Optional[typing.List[dom_debugger.EventListener]] = None
class-attribute
instance-attribute
frame_id: typing.Optional[page.FrameId] = None
class-attribute
instance-attribute
input_checked: typing.Optional[bool] = None
class-attribute
instance-attribute
input_value: typing.Optional[str] = None
class-attribute
instance-attribute
is_clickable: typing.Optional[bool] = None
class-attribute
instance-attribute
layout_node_index: typing.Optional[int] = None
class-attribute
instance-attribute
node_name: str
instance-attribute
node_type: int
instance-attribute
node_value: str
instance-attribute
option_selected: typing.Optional[bool] = None
class-attribute
instance-attribute
origin_url: typing.Optional[str] = None
class-attribute
instance-attribute
pseudo_element_indexes: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
pseudo_type: typing.Optional[dom.PseudoType] = None
class-attribute
instance-attribute
public_id: typing.Optional[str] = None
class-attribute
instance-attribute
scroll_offset_x: typing.Optional[float] = None
class-attribute
instance-attribute
scroll_offset_y: typing.Optional[float] = None
class-attribute
instance-attribute
shadow_root_type: typing.Optional[dom.ShadowRootType] = None
class-attribute
instance-attribute
system_id: typing.Optional[str] = None
class-attribute
instance-attribute
text_value: typing.Optional[str] = None
class-attribute
instance-attribute
__init__(node_type, node_name, node_value, backend_node_id, text_value=None, input_value=None, input_checked=None, option_selected=None, child_node_indexes=None, attributes=None, pseudo_element_indexes=None, layout_node_index=None, document_url=None, base_url=None, content_language=None, document_encoding=None, public_id=None, system_id=None, frame_id=None, content_document_index=None, pseudo_type=None, shadow_root_type=None, is_clickable=None, event_listeners=None, current_source_url=None, origin_url=None, scroll_offset_x=None, scroll_offset_y=None)
from_json(json)
classmethod
Source code in zendriver/cdp/dom_snapshot.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
to_json()
Source code in zendriver/cdp/dom_snapshot.py
DocumentSnapshot
dataclass
Document snapshot.
Source code in zendriver/cdp/dom_snapshot.py
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
|
base_url: StringIndex
instance-attribute
content_height: typing.Optional[float] = None
class-attribute
instance-attribute
content_language: StringIndex
instance-attribute
content_width: typing.Optional[float] = None
class-attribute
instance-attribute
document_url: StringIndex
instance-attribute
encoding_name: StringIndex
instance-attribute
frame_id: StringIndex
instance-attribute
layout: LayoutTreeSnapshot
instance-attribute
nodes: NodeTreeSnapshot
instance-attribute
public_id: StringIndex
instance-attribute
scroll_offset_x: typing.Optional[float] = None
class-attribute
instance-attribute
scroll_offset_y: typing.Optional[float] = None
class-attribute
instance-attribute
system_id: StringIndex
instance-attribute
text_boxes: TextBoxSnapshot
instance-attribute
title: StringIndex
instance-attribute
__init__(document_url, title, base_url, content_language, encoding_name, public_id, system_id, frame_id, nodes, layout, text_boxes, scroll_offset_x=None, scroll_offset_y=None, content_width=None, content_height=None)
from_json(json)
classmethod
Source code in zendriver/cdp/dom_snapshot.py
to_json()
Source code in zendriver/cdp/dom_snapshot.py
InlineTextBox
dataclass
Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.
Source code in zendriver/cdp/dom_snapshot.py
bounding_box: dom.Rect
instance-attribute
num_characters: int
instance-attribute
start_character_index: int
instance-attribute
__init__(bounding_box, start_character_index, num_characters)
from_json(json)
classmethod
Source code in zendriver/cdp/dom_snapshot.py
to_json()
LayoutTreeNode
dataclass
Details of an element in the DOM tree with a LayoutObject.
Source code in zendriver/cdp/dom_snapshot.py
bounding_box: dom.Rect
instance-attribute
dom_node_index: int
instance-attribute
inline_text_nodes: typing.Optional[typing.List[InlineTextBox]] = None
class-attribute
instance-attribute
is_stacking_context: typing.Optional[bool] = None
class-attribute
instance-attribute
layout_text: typing.Optional[str] = None
class-attribute
instance-attribute
paint_order: typing.Optional[int] = None
class-attribute
instance-attribute
style_index: typing.Optional[int] = None
class-attribute
instance-attribute
__init__(dom_node_index, bounding_box, layout_text=None, inline_text_nodes=None, style_index=None, paint_order=None, is_stacking_context=None)
from_json(json)
classmethod
Source code in zendriver/cdp/dom_snapshot.py
to_json()
Source code in zendriver/cdp/dom_snapshot.py
LayoutTreeSnapshot
dataclass
Table of details of an element in the DOM tree with a LayoutObject.
Source code in zendriver/cdp/dom_snapshot.py
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 |
|
blended_background_colors: typing.Optional[typing.List[StringIndex]] = None
class-attribute
instance-attribute
bounds: typing.List[Rectangle]
instance-attribute
client_rects: typing.Optional[typing.List[Rectangle]] = None
class-attribute
instance-attribute
node_index: typing.List[int]
instance-attribute
offset_rects: typing.Optional[typing.List[Rectangle]] = None
class-attribute
instance-attribute
paint_orders: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
scroll_rects: typing.Optional[typing.List[Rectangle]] = None
class-attribute
instance-attribute
stacking_contexts: RareBooleanData
instance-attribute
styles: typing.List[ArrayOfStrings]
instance-attribute
text: typing.List[StringIndex]
instance-attribute
text_color_opacities: typing.Optional[typing.List[float]] = None
class-attribute
instance-attribute
__init__(node_index, styles, bounds, text, stacking_contexts, paint_orders=None, offset_rects=None, scroll_rects=None, client_rects=None, blended_background_colors=None, text_color_opacities=None)
from_json(json)
classmethod
Source code in zendriver/cdp/dom_snapshot.py
to_json()
Source code in zendriver/cdp/dom_snapshot.py
NameValue
dataclass
A name/value pair.
Source code in zendriver/cdp/dom_snapshot.py
name: str
instance-attribute
value: str
instance-attribute
__init__(name, value)
from_json(json)
classmethod
NodeTreeSnapshot
dataclass
Table containing nodes.
Source code in zendriver/cdp/dom_snapshot.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 |
|
attributes: typing.Optional[typing.List[ArrayOfStrings]] = None
class-attribute
instance-attribute
backend_node_id: typing.Optional[typing.List[dom.BackendNodeId]] = None
class-attribute
instance-attribute
content_document_index: typing.Optional[RareIntegerData] = None
class-attribute
instance-attribute
current_source_url: typing.Optional[RareStringData] = None
class-attribute
instance-attribute
input_checked: typing.Optional[RareBooleanData] = None
class-attribute
instance-attribute
input_value: typing.Optional[RareStringData] = None
class-attribute
instance-attribute
is_clickable: typing.Optional[RareBooleanData] = None
class-attribute
instance-attribute
node_name: typing.Optional[typing.List[StringIndex]] = None
class-attribute
instance-attribute
node_type: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
node_value: typing.Optional[typing.List[StringIndex]] = None
class-attribute
instance-attribute
option_selected: typing.Optional[RareBooleanData] = None
class-attribute
instance-attribute
origin_url: typing.Optional[RareStringData] = None
class-attribute
instance-attribute
parent_index: typing.Optional[typing.List[int]] = None
class-attribute
instance-attribute
pseudo_identifier: typing.Optional[RareStringData] = None
class-attribute
instance-attribute
pseudo_type: typing.Optional[RareStringData] = None
class-attribute
instance-attribute
shadow_root_type: typing.Optional[RareStringData] = None
class-attribute
instance-attribute
text_value: typing.Optional[RareStringData] = None
class-attribute
instance-attribute
__init__(parent_index=None, node_type=None, shadow_root_type=None, node_name=None, node_value=None, backend_node_id=None, attributes=None, text_value=None, input_value=None, input_checked=None, option_selected=None, content_document_index=None, pseudo_type=None, pseudo_identifier=None, is_clickable=None, current_source_url=None, origin_url=None)
from_json(json)
classmethod
Source code in zendriver/cdp/dom_snapshot.py
to_json()
Source code in zendriver/cdp/dom_snapshot.py
RareBooleanData
dataclass
Source code in zendriver/cdp/dom_snapshot.py
index: typing.List[int]
instance-attribute
__init__(index)
from_json(json)
classmethod
RareIntegerData
dataclass
Source code in zendriver/cdp/dom_snapshot.py
index: typing.List[int]
instance-attribute
value: typing.List[int]
instance-attribute
__init__(index, value)
from_json(json)
classmethod
RareStringData
dataclass
Data that is only present on rare nodes.
Source code in zendriver/cdp/dom_snapshot.py
index: typing.List[int]
instance-attribute
value: typing.List[StringIndex]
instance-attribute
__init__(index, value)
from_json(json)
classmethod
Rectangle
Bases: list
Source code in zendriver/cdp/dom_snapshot.py
__repr__()
from_json(json)
classmethod
StringIndex
Bases: int
Index of the string in the strings table.
Source code in zendriver/cdp/dom_snapshot.py
__repr__()
from_json(json)
classmethod
TextBoxSnapshot
dataclass
Table of details of the post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions.
Source code in zendriver/cdp/dom_snapshot.py
bounds: typing.List[Rectangle]
instance-attribute
layout_index: typing.List[int]
instance-attribute
length: typing.List[int]
instance-attribute
start: typing.List[int]
instance-attribute
__init__(layout_index, bounds, start, length)
from_json(json)
classmethod
Source code in zendriver/cdp/dom_snapshot.py
to_json()
Source code in zendriver/cdp/dom_snapshot.py
capture_snapshot(computed_styles, include_paint_order=None, include_dom_rects=None, include_blended_background_colors=None, include_text_color_opacities=None)
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
computed_styles
|
List[str]
|
Whitelist of computed styles to return. |
required |
include_paint_order
|
Optional[bool]
|
(Optional) Whether to include layout object paint orders into the snapshot. |
None
|
include_dom_rects
|
Optional[bool]
|
(Optional) Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot |
None
|
include_blended_background_colors
|
Optional[bool]
|
(EXPERIMENTAL) (Optional) Whether 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. |
None
|
include_text_color_opacities
|
Optional[bool]
|
(EXPERIMENTAL) (Optional) Whether 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. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[List[DocumentSnapshot], List[str]]]
|
A tuple with the following items: 0. documents - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. 1. strings - Shared string table that all string properties refer to with indexes. |
Source code in zendriver/cdp/dom_snapshot.py
disable()
Disables DOM snapshot agent for the given page.
enable()
Enables DOM snapshot agent for the given page.
get_snapshot(computed_style_whitelist, include_event_listeners=None, include_paint_order=None, include_user_agent_shadow_tree=None)
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.
.. deprecated:: 1.3
Parameters:
Name | Type | Description | Default |
---|---|---|---|
computed_style_whitelist
|
List[str]
|
Whitelist of computed styles to return. |
required |
include_event_listeners
|
Optional[bool]
|
(Optional) Whether or not to retrieve details of DOM listeners (default false). |
None
|
include_paint_order
|
Optional[bool]
|
(Optional) Whether to determine and include the paint order index of LayoutTreeNodes (default false). |
None
|
include_user_agent_shadow_tree
|
Optional[bool]
|
(Optional) Whether to include UA shadow tree in the snapshot (default false). |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[List[DOMNode], List[LayoutTreeNode], List[ComputedStyle]]]
|
A tuple with the following items: 0. domNodes - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. 1. layoutTreeNodes - The nodes in the layout tree. 2. computedStyles - Whitelisted ComputedStyle properties for each node in the layout tree. |