dom
AttributeModified
dataclass
Fired when Element
's attribute is modified.
Source code in zendriver/cdp/dom.py
name: str
instance-attribute
node_id: NodeId
instance-attribute
value: str
instance-attribute
__init__(node_id, name, value)
AttributeRemoved
dataclass
Fired when Element
's attribute is removed.
Source code in zendriver/cdp/dom.py
name: str
instance-attribute
node_id: NodeId
instance-attribute
__init__(node_id, name)
BackendNode
dataclass
Backend node with a friendly name.
Source code in zendriver/cdp/dom.py
backend_node_id: BackendNodeId
instance-attribute
node_name: str
instance-attribute
node_type: int
instance-attribute
__init__(node_type, node_name, backend_node_id)
from_json(json)
classmethod
BackendNodeId
Bases: int
Unique DOM node identifier used to reference a node that may not have been pushed to the front-end.
Source code in zendriver/cdp/dom.py
__repr__()
from_json(json)
classmethod
BoxModel
dataclass
Box model.
Source code in zendriver/cdp/dom.py
border: Quad
instance-attribute
content: Quad
instance-attribute
height: int
instance-attribute
margin: Quad
instance-attribute
padding: Quad
instance-attribute
shape_outside: typing.Optional[ShapeOutsideInfo] = None
class-attribute
instance-attribute
width: int
instance-attribute
__init__(content, padding, border, margin, width, height, shape_outside=None)
from_json(json)
classmethod
Source code in zendriver/cdp/dom.py
to_json()
Source code in zendriver/cdp/dom.py
CSSComputedStyleProperty
dataclass
Source code in zendriver/cdp/dom.py
name: str
instance-attribute
value: str
instance-attribute
__init__(name, value)
from_json(json)
classmethod
CharacterDataModified
dataclass
Mirrors DOMCharacterDataModified
event.
Source code in zendriver/cdp/dom.py
character_data: str
instance-attribute
node_id: NodeId
instance-attribute
__init__(node_id, character_data)
ChildNodeCountUpdated
dataclass
Fired when Container
's child node count has changed.
Source code in zendriver/cdp/dom.py
child_node_count: int
instance-attribute
node_id: NodeId
instance-attribute
__init__(node_id, child_node_count)
ChildNodeInserted
dataclass
Mirrors DOMNodeInserted
event.
Source code in zendriver/cdp/dom.py
node: Node
instance-attribute
parent_node_id: NodeId
instance-attribute
previous_node_id: NodeId
instance-attribute
__init__(parent_node_id, previous_node_id, node)
from_json(json)
classmethod
Source code in zendriver/cdp/dom.py
ChildNodeRemoved
dataclass
Mirrors DOMNodeRemoved
event.
Source code in zendriver/cdp/dom.py
node_id: NodeId
instance-attribute
parent_node_id: NodeId
instance-attribute
__init__(parent_node_id, node_id)
CompatibilityMode
Bases: Enum
Document compatibility mode.
Source code in zendriver/cdp/dom.py
LIMITED_QUIRKS_MODE = 'LimitedQuirksMode'
class-attribute
instance-attribute
NO_QUIRKS_MODE = 'NoQuirksMode'
class-attribute
instance-attribute
QUIRKS_MODE = 'QuirksMode'
class-attribute
instance-attribute
from_json(json)
classmethod
DetachedElementInfo
dataclass
A structure to hold the top-level node of a detached tree and an array of its retained descendants.
Source code in zendriver/cdp/dom.py
retained_node_ids: typing.List[NodeId]
instance-attribute
tree_node: Node
instance-attribute
__init__(tree_node, retained_node_ids)
from_json(json)
classmethod
DistributedNodesUpdated
dataclass
EXPERIMENTAL
Called when distribution is changed.
Source code in zendriver/cdp/dom.py
distributed_nodes: typing.List[BackendNode]
instance-attribute
insertion_point_id: NodeId
instance-attribute
__init__(insertion_point_id, distributed_nodes)
from_json(json)
classmethod
Source code in zendriver/cdp/dom.py
DocumentUpdated
dataclass
Fired when Document
has been totally updated. Node ids are no longer valid.
Source code in zendriver/cdp/dom.py
InlineStyleInvalidated
dataclass
EXPERIMENTAL
Fired when Element
's inline style is modified via a CSS property modification.
Source code in zendriver/cdp/dom.py
LogicalAxes
Bases: Enum
ContainerSelector logical axes
Source code in zendriver/cdp/dom.py
BLOCK = 'Block'
class-attribute
instance-attribute
BOTH = 'Both'
class-attribute
instance-attribute
INLINE = 'Inline'
class-attribute
instance-attribute
from_json(json)
classmethod
Node
dataclass
DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.
Source code in zendriver/cdp/dom.py
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 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
|
assigned_slot: typing.Optional[BackendNode] = None
class-attribute
instance-attribute
attributes: typing.Optional[typing.List[str]] = None
class-attribute
instance-attribute
backend_node_id: BackendNodeId
instance-attribute
base_url: typing.Optional[str] = None
class-attribute
instance-attribute
child_node_count: typing.Optional[int] = None
class-attribute
instance-attribute
children: typing.Optional[typing.List[Node]] = None
class-attribute
instance-attribute
compatibility_mode: typing.Optional[CompatibilityMode] = None
class-attribute
instance-attribute
content_document: typing.Optional[Node] = None
class-attribute
instance-attribute
distributed_nodes: typing.Optional[typing.List[BackendNode]] = None
class-attribute
instance-attribute
document_url: typing.Optional[str] = None
class-attribute
instance-attribute
frame_id: typing.Optional[page.FrameId] = None
class-attribute
instance-attribute
imported_document: typing.Optional[Node] = None
class-attribute
instance-attribute
internal_subset: typing.Optional[str] = None
class-attribute
instance-attribute
is_scrollable: typing.Optional[bool] = None
class-attribute
instance-attribute
is_svg: typing.Optional[bool] = None
class-attribute
instance-attribute
local_name: str
instance-attribute
name: typing.Optional[str] = None
class-attribute
instance-attribute
node_id: NodeId
instance-attribute
node_name: str
instance-attribute
node_type: int
instance-attribute
node_value: str
instance-attribute
parent_id: typing.Optional[NodeId] = None
class-attribute
instance-attribute
pseudo_elements: typing.Optional[typing.List[Node]] = None
class-attribute
instance-attribute
pseudo_identifier: typing.Optional[str] = None
class-attribute
instance-attribute
pseudo_type: typing.Optional[PseudoType] = None
class-attribute
instance-attribute
public_id: typing.Optional[str] = None
class-attribute
instance-attribute
shadow_root_type: typing.Optional[ShadowRootType] = None
class-attribute
instance-attribute
shadow_roots: typing.Optional[typing.List[Node]] = None
class-attribute
instance-attribute
system_id: typing.Optional[str] = None
class-attribute
instance-attribute
template_content: typing.Optional[Node] = None
class-attribute
instance-attribute
value: typing.Optional[str] = None
class-attribute
instance-attribute
xml_version: typing.Optional[str] = None
class-attribute
instance-attribute
__init__(node_id, backend_node_id, node_type, node_name, local_name, node_value, parent_id=None, child_node_count=None, children=None, attributes=None, document_url=None, base_url=None, public_id=None, system_id=None, internal_subset=None, xml_version=None, name=None, value=None, pseudo_type=None, pseudo_identifier=None, shadow_root_type=None, frame_id=None, content_document=None, shadow_roots=None, template_content=None, pseudo_elements=None, imported_document=None, distributed_nodes=None, is_svg=None, compatibility_mode=None, assigned_slot=None, is_scrollable=None)
from_json(json)
classmethod
Source code in zendriver/cdp/dom.py
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
|
to_json()
Source code in zendriver/cdp/dom.py
NodeId
Bases: int
Unique DOM node identifier.
Source code in zendriver/cdp/dom.py
__repr__()
from_json(json)
classmethod
PhysicalAxes
Bases: Enum
ContainerSelector physical axes
Source code in zendriver/cdp/dom.py
BOTH = 'Both'
class-attribute
instance-attribute
HORIZONTAL = 'Horizontal'
class-attribute
instance-attribute
VERTICAL = 'Vertical'
class-attribute
instance-attribute
from_json(json)
classmethod
PseudoElementAdded
dataclass
EXPERIMENTAL
Called when a pseudo element is added to an element.
Source code in zendriver/cdp/dom.py
parent_id: NodeId
instance-attribute
pseudo_element: Node
instance-attribute
__init__(parent_id, pseudo_element)
PseudoElementRemoved
dataclass
EXPERIMENTAL
Called when a pseudo element is removed from an element.
Source code in zendriver/cdp/dom.py
parent_id: NodeId
instance-attribute
pseudo_element_id: NodeId
instance-attribute
__init__(parent_id, pseudo_element_id)
PseudoType
Bases: Enum
Pseudo element type.
Source code in zendriver/cdp/dom.py
AFTER = 'after'
class-attribute
instance-attribute
BACKDROP = 'backdrop'
class-attribute
instance-attribute
BEFORE = 'before'
class-attribute
instance-attribute
CHECK = 'check'
class-attribute
instance-attribute
COLUMN = 'column'
class-attribute
instance-attribute
DETAILS_CONTENT = 'details-content'
class-attribute
instance-attribute
FILE_SELECTOR_BUTTON = 'file-selector-button'
class-attribute
instance-attribute
FIRST_LETTER = 'first-letter'
class-attribute
instance-attribute
FIRST_LINE = 'first-line'
class-attribute
instance-attribute
FIRST_LINE_INHERITED = 'first-line-inherited'
class-attribute
instance-attribute
GRAMMAR_ERROR = 'grammar-error'
class-attribute
instance-attribute
HIGHLIGHT = 'highlight'
class-attribute
instance-attribute
INPUT_LIST_BUTTON = 'input-list-button'
class-attribute
instance-attribute
MARKER = 'marker'
class-attribute
instance-attribute
PICKER = 'picker'
class-attribute
instance-attribute
PLACEHOLDER = 'placeholder'
class-attribute
instance-attribute
RESIZER = 'resizer'
class-attribute
instance-attribute
SCROLLBAR = 'scrollbar'
class-attribute
instance-attribute
SCROLLBAR_BUTTON = 'scrollbar-button'
class-attribute
instance-attribute
SCROLLBAR_CORNER = 'scrollbar-corner'
class-attribute
instance-attribute
SCROLLBAR_THUMB = 'scrollbar-thumb'
class-attribute
instance-attribute
SCROLLBAR_TRACK = 'scrollbar-track'
class-attribute
instance-attribute
SCROLLBAR_TRACK_PIECE = 'scrollbar-track-piece'
class-attribute
instance-attribute
SCROLL_MARKER = 'scroll-marker'
class-attribute
instance-attribute
SCROLL_MARKER_GROUP = 'scroll-marker-group'
class-attribute
instance-attribute
SCROLL_NEXT_BUTTON = 'scroll-next-button'
class-attribute
instance-attribute
SCROLL_PREV_BUTTON = 'scroll-prev-button'
class-attribute
instance-attribute
SEARCH_TEXT = 'search-text'
class-attribute
instance-attribute
SELECTION = 'selection'
class-attribute
instance-attribute
SELECT_ARROW = 'select-arrow'
class-attribute
instance-attribute
SPELLING_ERROR = 'spelling-error'
class-attribute
instance-attribute
TARGET_TEXT = 'target-text'
class-attribute
instance-attribute
VIEW_TRANSITION = 'view-transition'
class-attribute
instance-attribute
VIEW_TRANSITION_GROUP = 'view-transition-group'
class-attribute
instance-attribute
VIEW_TRANSITION_IMAGE_PAIR = 'view-transition-image-pair'
class-attribute
instance-attribute
VIEW_TRANSITION_NEW = 'view-transition-new'
class-attribute
instance-attribute
VIEW_TRANSITION_OLD = 'view-transition-old'
class-attribute
instance-attribute
from_json(json)
classmethod
Quad
Bases: list
An array of quad vertices, x immediately followed by y for each point, points clock-wise.
Source code in zendriver/cdp/dom.py
__repr__()
from_json(json)
classmethod
RGBA
dataclass
A structure holding an RGBA color.
Source code in zendriver/cdp/dom.py
a: typing.Optional[float] = None
class-attribute
instance-attribute
b: int
instance-attribute
g: int
instance-attribute
r: int
instance-attribute
__init__(r, g, b, a=None)
from_json(json)
classmethod
Rect
dataclass
Rectangle.
Source code in zendriver/cdp/dom.py
height: float
instance-attribute
width: float
instance-attribute
x: float
instance-attribute
y: float
instance-attribute
__init__(x, y, width, height)
from_json(json)
classmethod
ScrollOrientation
Bases: Enum
Physical scroll orientation
Source code in zendriver/cdp/dom.py
HORIZONTAL = 'horizontal'
class-attribute
instance-attribute
VERTICAL = 'vertical'
class-attribute
instance-attribute
from_json(json)
classmethod
ScrollableFlagUpdated
dataclass
EXPERIMENTAL
Fired when a node's scrollability state changes.
Source code in zendriver/cdp/dom.py
is_scrollable: bool
instance-attribute
node_id: NodeId
instance-attribute
__init__(node_id, is_scrollable)
SetChildNodes
dataclass
Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids.
Source code in zendriver/cdp/dom.py
nodes: typing.List[Node]
instance-attribute
parent_id: NodeId
instance-attribute
__init__(parent_id, nodes)
ShadowRootPopped
dataclass
EXPERIMENTAL
Called when shadow root is popped from the element.
Source code in zendriver/cdp/dom.py
host_id: NodeId
instance-attribute
root_id: NodeId
instance-attribute
__init__(host_id, root_id)
ShadowRootPushed
dataclass
EXPERIMENTAL
Called when shadow root is pushed into the element.
Source code in zendriver/cdp/dom.py
host_id: NodeId
instance-attribute
root: Node
instance-attribute
__init__(host_id, root)
ShadowRootType
Bases: Enum
Shadow root type.
Source code in zendriver/cdp/dom.py
CLOSED = 'closed'
class-attribute
instance-attribute
OPEN_ = 'open'
class-attribute
instance-attribute
USER_AGENT = 'user-agent'
class-attribute
instance-attribute
from_json(json)
classmethod
ShapeOutsideInfo
dataclass
CSS Shape Outside details.
Source code in zendriver/cdp/dom.py
bounds: Quad
instance-attribute
margin_shape: typing.List[typing.Any]
instance-attribute
shape: typing.List[typing.Any]
instance-attribute
__init__(bounds, shape, margin_shape)
from_json(json)
classmethod
TopLayerElementsUpdated
dataclass
EXPERIMENTAL
Called when top layer elements are changed.
Source code in zendriver/cdp/dom.py
collect_class_names_from_subtree(node_id)
Collects class names for the node with given id and all of it's child nodes.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to collect class names. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[str]]
|
Class name list. |
Source code in zendriver/cdp/dom.py
copy_to(node_id, target_node_id, insert_before_node_id=None)
Creates a deep copy of the specified node and places it into the target container before the given anchor.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to copy. |
required |
target_node_id
|
NodeId
|
Id of the element to drop the copy into. |
required |
insert_before_node_id
|
Optional[NodeId]
|
(Optional) Drop the copy before this node (if absent, the copy becomes the last child of |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
Id of the node clone. |
Source code in zendriver/cdp/dom.py
describe_node(node_id=None, backend_node_id=None, object_id=None, depth=None, pierce=None)
Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) Identifier of the node. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Identifier of the backend node. |
None
|
object_id
|
Optional[RemoteObjectId]
|
(Optional) JavaScript object id of the node wrapper. |
None
|
depth
|
Optional[int]
|
(Optional) The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0. |
None
|
pierce
|
Optional[bool]
|
(Optional) Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Node]
|
Node description. |
Source code in zendriver/cdp/dom.py
disable()
discard_search_results(search_id)
Discards search results from the session with the given id. getSearchResults
should no longer
be called for that search.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_id
|
str
|
Unique search session identifier. |
required |
Source code in zendriver/cdp/dom.py
enable(include_whitespace=None)
Enables DOM agent for the given page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include_whitespace
|
Optional[str]
|
(EXPERIMENTAL) (Optional) Whether to include whitespaces in the children array of returned Nodes. |
None
|
Source code in zendriver/cdp/dom.py
focus(node_id=None, backend_node_id=None, object_id=None)
Focuses the given element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) Identifier of the node. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Identifier of the backend node. |
None
|
object_id
|
Optional[RemoteObjectId]
|
(Optional) JavaScript object id of the node wrapper. |
None
|
Source code in zendriver/cdp/dom.py
get_anchor_element(node_id, anchor_specifier=None)
Returns the target anchor element of the given anchor query according to https://www.w3.org/TR/css-anchor-position-1/#target.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the positioned element from which to find the anchor. |
required |
anchor_specifier
|
Optional[str]
|
(Optional) An optional anchor specifier, as defined in https://www.w3.org/TR/css-anchor-position-1/#anchor-specifier. If not provided, it will return the implicit anchor element for the given positioned element. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
The anchor element of the given anchor query. |
Source code in zendriver/cdp/dom.py
get_attributes(node_id)
Returns attributes for the specified node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to retrieve attributes for. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[str]]
|
An interleaved array of node attribute names and values. |
Source code in zendriver/cdp/dom.py
get_box_model(node_id=None, backend_node_id=None, object_id=None)
Returns boxes for the given node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) Identifier of the node. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Identifier of the backend node. |
None
|
object_id
|
Optional[RemoteObjectId]
|
(Optional) JavaScript object id of the node wrapper. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, BoxModel]
|
Box model for the node. |
Source code in zendriver/cdp/dom.py
get_container_for_node(node_id, container_name=None, physical_axes=None, logical_axes=None, queries_scroll_state=None)
Returns the query container of the given node based on container query conditions: containerName, physical and logical axes, and whether it queries scroll-state. 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.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
|
required |
container_name
|
Optional[str]
|
(Optional) |
None
|
physical_axes
|
Optional[PhysicalAxes]
|
(Optional) |
None
|
logical_axes
|
Optional[LogicalAxes]
|
(Optional) |
None
|
queries_scroll_state
|
Optional[bool]
|
(Optional) |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Optional[NodeId]]
|
(Optional) The container node for the given node, or null if not found. |
Source code in zendriver/cdp/dom.py
get_content_quads(node_id=None, backend_node_id=None, object_id=None)
Returns quads that describe node position on the page. This method might return multiple quads for inline nodes.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) Identifier of the node. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Identifier of the backend node. |
None
|
object_id
|
Optional[RemoteObjectId]
|
(Optional) JavaScript object id of the node wrapper. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[Quad]]
|
Quads that describe node layout relative to viewport. |
Source code in zendriver/cdp/dom.py
get_detached_dom_nodes()
Returns list of detached nodes
EXPERIMENTAL
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[DetachedElementInfo]]
|
The list of detached nodes |
Source code in zendriver/cdp/dom.py
get_document(depth=None, pierce=None)
Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depth
|
Optional[int]
|
(Optional) The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0. |
None
|
pierce
|
Optional[bool]
|
(Optional) Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Node]
|
Resulting node. |
Source code in zendriver/cdp/dom.py
get_element_by_relation(node_id, relation)
Returns the NodeId of the matched element according to certain relations.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node from which to query the relation. |
required |
relation
|
str
|
Type of relation to get. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
NodeId of the element matching the queried relation. |
Source code in zendriver/cdp/dom.py
get_file_info(object_id)
Returns file information for the given File wrapper.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_id
|
RemoteObjectId
|
JavaScript object id of the node wrapper. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, str]
|
|
Source code in zendriver/cdp/dom.py
get_flattened_document(depth=None, pierce=None)
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.
.. deprecated:: 1.3
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depth
|
Optional[int]
|
(Optional) The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0. |
None
|
pierce
|
Optional[bool]
|
(Optional) Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[Node]]
|
Resulting node. |
Source code in zendriver/cdp/dom.py
get_frame_owner(frame_id)
Returns iframe node that owns iframe with the given domain.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame_id
|
FrameId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[BackendNodeId, Optional[NodeId]]]
|
A tuple with the following items: 0. backendNodeId - Resulting node. 1. nodeId - (Optional) Id of the node at given coordinates, only when enabled and requested document. |
Source code in zendriver/cdp/dom.py
get_node_for_location(x, y, include_user_agent_shadow_dom=None, ignore_pointer_events_none=None)
Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
int
|
X coordinate. |
required |
y
|
int
|
Y coordinate. |
required |
include_user_agent_shadow_dom
|
Optional[bool]
|
(Optional) False to skip to the nearest non-UA shadow root ancestor (default: false). |
None
|
ignore_pointer_events_none
|
Optional[bool]
|
(Optional) Whether to ignore pointer-events: none on elements and hit test them. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[BackendNodeId, FrameId, Optional[NodeId]]]
|
A tuple with the following items: 0. backendNodeId - Resulting node. 1. frameId - Frame this node belongs to. 2. nodeId - (Optional) Id of the node at given coordinates, only when enabled and requested document. |
Source code in zendriver/cdp/dom.py
get_node_stack_traces(node_id)
Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to get stack traces for. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Optional[StackTrace]]
|
(Optional) Creation stack trace, if available. |
Source code in zendriver/cdp/dom.py
get_nodes_for_subtree_by_style(node_id, computed_styles, pierce=None)
Finds nodes with a given computed style in a subtree.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Node ID pointing to the root of a subtree. |
required |
computed_styles
|
List[CSSComputedStyleProperty]
|
The style to filter nodes by (includes nodes if any of properties matches). |
required |
pierce
|
Optional[bool]
|
(Optional) Whether or not iframes and shadow roots in the same target should be traversed when returning the results (default is false). |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[NodeId]]
|
Resulting nodes. |
Source code in zendriver/cdp/dom.py
get_outer_html(node_id=None, backend_node_id=None, object_id=None)
Returns node's HTML markup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) Identifier of the node. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Identifier of the backend node. |
None
|
object_id
|
Optional[RemoteObjectId]
|
(Optional) JavaScript object id of the node wrapper. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, str]
|
Outer HTML markup. |
Source code in zendriver/cdp/dom.py
get_querying_descendants_for_container(node_id)
Returns the descendants of a container query container that have container queries against this container.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the container node to find querying descendants from. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[NodeId]]
|
Descendant nodes with container queries against the given container. |
Source code in zendriver/cdp/dom.py
get_relayout_boundary(node_id)
Returns the id of the nearest ancestor that is a relayout boundary.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
Relayout boundary node id for the given node. |
Source code in zendriver/cdp/dom.py
get_search_results(search_id, from_index, to_index)
Returns search results from given fromIndex
to given toIndex
from the search with the given
identifier.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_id
|
str
|
Unique search session identifier. |
required |
from_index
|
int
|
Start index of the search result to be returned. |
required |
to_index
|
int
|
End index of the search result to be returned. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[NodeId]]
|
Ids of the search result nodes. |
Source code in zendriver/cdp/dom.py
get_top_layer_elements()
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.
EXPERIMENTAL
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[NodeId]]
|
NodeIds of top layer elements |
Source code in zendriver/cdp/dom.py
hide_highlight()
highlight_node()
highlight_rect()
mark_undoable_state()
Marks last undoable state.
EXPERIMENTAL
Source code in zendriver/cdp/dom.py
move_to(node_id, target_node_id, insert_before_node_id=None)
Moves node into the new container, places it before the given anchor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to move. |
required |
target_node_id
|
NodeId
|
Id of the element to drop the moved node into. |
required |
insert_before_node_id
|
Optional[NodeId]
|
(Optional) Drop node before this one (if absent, the moved node becomes the last child of |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
New id of the moved node. |
Source code in zendriver/cdp/dom.py
perform_search(query, include_user_agent_shadow_dom=None)
Searches for a given string in the DOM tree. Use getSearchResults
to access search results or
cancelSearch
to end this search session.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
Plain text or query selector or XPath search query. |
required |
include_user_agent_shadow_dom
|
Optional[bool]
|
(Optional) True to search in user agent shadow DOM. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[str, int]]
|
A tuple with the following items: 0. searchId - Unique search session identifier. 1. resultCount - Number of search results. |
Source code in zendriver/cdp/dom.py
push_node_by_path_to_frontend(path)
Requests that the node is sent to the caller given its path. // FIXME, use XPath
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path to node in the proprietary format. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
Id of the node for given path. |
Source code in zendriver/cdp/dom.py
push_nodes_by_backend_ids_to_frontend(backend_node_ids)
Requests that a batch of nodes is sent to the caller given their backend node ids.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
backend_node_ids
|
List[BackendNodeId]
|
The array of backend node ids. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[NodeId]]
|
The array of ids of pushed nodes that correspond to the backend ids specified in backendNodeIds. |
Source code in zendriver/cdp/dom.py
query_selector(node_id, selector)
Executes querySelector
on a given node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to query upon. |
required |
selector
|
str
|
Selector string. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
Query selector result. |
Source code in zendriver/cdp/dom.py
query_selector_all(node_id, selector)
Executes querySelectorAll
on a given node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to query upon. |
required |
selector
|
str
|
Selector string. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[NodeId]]
|
Query selector result. |
Source code in zendriver/cdp/dom.py
redo()
Re-does the last undone action.
EXPERIMENTAL
remove_attribute(node_id, name)
Removes attribute with given name from an element with given id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the element to remove attribute from. |
required |
name
|
str
|
Name of the attribute to remove. |
required |
Source code in zendriver/cdp/dom.py
remove_node(node_id)
Removes node with given id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to remove. |
required |
Source code in zendriver/cdp/dom.py
request_child_nodes(node_id, depth=None, pierce=None)
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to get children for. |
required |
depth
|
Optional[int]
|
(Optional) The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0. |
None
|
pierce
|
Optional[bool]
|
(Optional) Whether or not iframes and shadow roots should be traversed when returning the sub-tree (default is false). |
None
|
Source code in zendriver/cdp/dom.py
request_node(object_id)
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_id
|
RemoteObjectId
|
JavaScript object id to convert into node. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
Node id for given object. |
Source code in zendriver/cdp/dom.py
resolve_node(node_id=None, backend_node_id=None, object_group=None, execution_context_id=None)
Resolves the JavaScript node object for a given NodeId or BackendNodeId.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) Id of the node to resolve. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Backend identifier of the node to resolve. |
None
|
object_group
|
Optional[str]
|
(Optional) Symbolic group name that can be used to release multiple objects. |
None
|
execution_context_id
|
Optional[ExecutionContextId]
|
(Optional) Execution context in which to resolve the node. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, RemoteObject]
|
JavaScript object wrapper for given node. |
Source code in zendriver/cdp/dom.py
scroll_into_view_if_needed(node_id=None, backend_node_id=None, object_id=None, rect=None)
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) Identifier of the node. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Identifier of the backend node. |
None
|
object_id
|
Optional[RemoteObjectId]
|
(Optional) JavaScript object id of the node wrapper. |
None
|
rect
|
Optional[Rect]
|
(Optional) 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. |
None
|
Source code in zendriver/cdp/dom.py
set_attribute_value(node_id, name, value)
Sets attribute for an element with given id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the element to set attribute for. |
required |
name
|
str
|
Attribute name. |
required |
value
|
str
|
Attribute value. |
required |
Source code in zendriver/cdp/dom.py
set_attributes_as_text(node_id, text, name=None)
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the element to set attributes for. |
required |
text
|
str
|
Text with a number of attributes. Will parse this text using HTML parser. |
required |
name
|
Optional[str]
|
(Optional) Attribute name to replace with new attributes derived from text in case text parsed successfully. |
None
|
Source code in zendriver/cdp/dom.py
set_file_input_files(files, node_id=None, backend_node_id=None, object_id=None)
Sets files for the given file input element.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files
|
List[str]
|
Array of file paths to set. |
required |
node_id
|
Optional[NodeId]
|
(Optional) Identifier of the node. |
None
|
backend_node_id
|
Optional[BackendNodeId]
|
(Optional) Identifier of the backend node. |
None
|
object_id
|
Optional[RemoteObjectId]
|
(Optional) JavaScript object id of the node wrapper. |
None
|
Source code in zendriver/cdp/dom.py
set_inspected_node(node_id)
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
DOM node id to be accessible by means of $x command line API. |
required |
Source code in zendriver/cdp/dom.py
set_node_name(node_id, name)
Sets node name for a node with given id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to set name for. |
required |
name
|
str
|
New node's name. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, NodeId]
|
New node's id. |
Source code in zendriver/cdp/dom.py
set_node_stack_traces_enabled(enable)
Sets if stack traces should be captured for Nodes. See Node.getNodeStackTraces
. Default is disabled.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enable
|
bool
|
Enable or disable. |
required |
Source code in zendriver/cdp/dom.py
set_node_value(node_id, value)
Sets node value for a node with given id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to set value for. |
required |
value
|
str
|
New node's value. |
required |
Source code in zendriver/cdp/dom.py
set_outer_html(node_id, outer_html)
Sets node HTML markup, returns new node id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to set markup for. |
required |
outer_html
|
str
|
Outer HTML markup to set. |
required |
Source code in zendriver/cdp/dom.py
undo()
Undoes the last performed action.
EXPERIMENTAL