Overlay#
This domain provides various functionality related to drawing atop the inspected page.
This CDP domain is experimental.
Types#
Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.
- class SourceOrderConfig(parent_outline_color, child_outline_color)[source]#
Configuration data for drawing the source order of an elements children.
- class GridHighlightConfig(show_grid_extension_lines=None, show_positive_line_numbers=None, show_negative_line_numbers=None, show_area_names=None, show_line_names=None, show_track_sizes=None, grid_border_color=None, cell_border_color=None, row_line_color=None, column_line_color=None, grid_border_dash=None, cell_border_dash=None, row_line_dash=None, column_line_dash=None, row_gap_color=None, row_hatch_color=None, column_gap_color=None, column_hatch_color=None, area_border_color=None, grid_background_color=None)[source]#
Configuration data for the highlighting of Grid elements.
-
show_grid_extension_lines:
Optional[bool] = None# false).
- Type:
Whether the extension lines from grid cells to the rulers should be shown (default
-
show_positive_line_numbers:
Optional[bool] = None# false).
- Type:
Show Positive line number labels (default
-
show_negative_line_numbers:
Optional[bool] = None# false).
- Type:
Show Negative line number labels (default
-
grid_border_color:
Optional[RGBA] = None# transparent).
- Type:
The grid container border highlight color (default
-
cell_border_color:
Optional[RGBA] = None# transparent). Deprecated, please use rowLineColor and columnLineColor instead.
- Type:
The cell border color (default
-
cell_border_dash:
Optional[bool] = None# false). Deprecated, please us rowLineDash and columnLineDash instead.
- Type:
Whether the cell border is dashed (default
-
row_hatch_color:
Optional[RGBA] = None# transparent).
- Type:
The row gap hatching fill color (default
-
column_gap_color:
Optional[RGBA] = None# transparent).
- Type:
The column gap highlight fill color (default
-
column_hatch_color:
Optional[RGBA] = None# transparent).
- Type:
The column gap hatching fill color (default
-
show_grid_extension_lines:
- class FlexContainerHighlightConfig(container_border=None, line_separator=None, item_separator=None, main_distributed_space=None, cross_distributed_space=None, row_gap_space=None, column_gap_space=None, cross_alignment=None)[source]#
Configuration data for the highlighting of Flex container elements.
-
main_distributed_space:
Optional[BoxStyle] = None# Style of content-distribution space on the main axis (justify-content).
-
cross_distributed_space:
Optional[BoxStyle] = None# Style of content-distribution space on the cross axis (align-content).
-
main_distributed_space:
- class FlexItemHighlightConfig(base_size_box=None, base_size_border=None, flexibility_arrow=None)[source]#
Configuration data for the highlighting of Flex item elements.
- class ContrastAlgorithm(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
- AA = 'aa'#
- AAA = 'aaa'#
- APCA = 'apca'#
- class HighlightConfig(show_info=None, show_styles=None, show_rulers=None, show_accessibility_info=None, show_extension_lines=None, content_color=None, padding_color=None, border_color=None, margin_color=None, event_target_color=None, shape_color=None, shape_margin_color=None, css_grid_color=None, color_format=None, grid_highlight_config=None, flex_container_highlight_config=None, flex_item_highlight_config=None, contrast_algorithm=None, container_query_container_highlight_config=None)[source]#
Configuration data for the highlighting of page elements.
-
show_info:
Optional[bool] = None# false).
- Type:
Whether the node info tooltip should be shown (default
-
show_accessibility_info:
Optional[bool] = None# true).
- Type:
Whether the a11y info should be shown (default
-
show_extension_lines:
Optional[bool] = None# false).
- Type:
Whether the extension lines from node to the rulers should be shown (default
-
content_color:
Optional[RGBA] = None# transparent).
- Type:
The content box highlight fill color (default
-
event_target_color:
Optional[RGBA] = None# transparent).
- Type:
The event target element highlight fill color (default
-
color_format:
Optional[ColorFormat] = None# hex).
- Type:
The color format used to format color styles (default
-
grid_highlight_config:
Optional[GridHighlightConfig] = None# all transparent).
- Type:
The grid layout highlight configuration (default
-
flex_container_highlight_config:
Optional[FlexContainerHighlightConfig] = None# all transparent).
- Type:
The flex container highlight configuration (default
-
flex_item_highlight_config:
Optional[FlexItemHighlightConfig] = None# all transparent).
- Type:
The flex item highlight configuration (default
-
contrast_algorithm:
Optional[ContrastAlgorithm] = None# aa).
- Type:
The contrast algorithm to use for the contrast ratio (default
-
container_query_container_highlight_config:
Optional[ContainerQueryContainerHighlightConfig] = None# all transparent).
- Type:
The container query container highlight configuration (default
-
show_info:
- class ColorFormat(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
- RGB = 'rgb'#
- HSL = 'hsl'#
- HWB = 'hwb'#
- HEX_ = 'hex'#
- class GridNodeHighlightConfig(grid_highlight_config, node_id)[source]#
Configurations for Persistent Grid Highlight
-
grid_highlight_config:
GridHighlightConfig# A descriptor for the highlight appearance.
-
grid_highlight_config:
- class FlexNodeHighlightConfig(flex_container_highlight_config, node_id)[source]#
-
flex_container_highlight_config:
FlexContainerHighlightConfig# A descriptor for the highlight appearance of flex containers.
-
flex_container_highlight_config:
- class ScrollSnapContainerHighlightConfig(snapport_border=None, snap_area_border=None, scroll_margin_color=None, scroll_padding_color=None)[source]#
-
snapport_border:
Optional[LineStyle] = None# transparent)
- Type:
The style of the snapport border (default
-
snap_area_border:
Optional[LineStyle] = None# transparent)
- Type:
The style of the snap area border (default
-
snapport_border:
- class ScrollSnapHighlightConfig(scroll_snap_container_highlight_config, node_id)[source]#
-
scroll_snap_container_highlight_config:
ScrollSnapContainerHighlightConfig# A descriptor for the highlight appearance of scroll snap containers.
-
scroll_snap_container_highlight_config:
- class HingeConfig(rect, content_color=None, outline_color=None)[source]#
Configuration for dual screen hinge
- class WindowControlsOverlayConfig(show_css, selected_platform, theme_color)[source]#
Configuration for Window Controls Overlay
- class ContainerQueryHighlightConfig(container_query_container_highlight_config, node_id)[source]#
-
container_query_container_highlight_config:
ContainerQueryContainerHighlightConfig# A descriptor for the highlight appearance of container query containers.
-
container_query_container_highlight_config:
- class ContainerQueryContainerHighlightConfig(container_border=None, descendant_border=None)[source]#
- class IsolatedElementHighlightConfig(isolation_mode_highlight_config, node_id)[source]#
-
isolation_mode_highlight_config:
IsolationModeHighlightConfig# A descriptor for the highlight appearance of an element in isolation mode.
-
isolation_mode_highlight_config:
Commands#
Each command is a generator function. The return
type Generator[x, y, z] indicates that the generator
yields arguments of type x, it must be resumed with
an argument of type y, and it returns type z. In
this library, types x and y are the same for all
commands, and z is the return type you should pay attention
to. For more information, see
Getting Started: Commands.
- get_highlight_object_for_test(node_id, include_distance=None, include_style=None, color_format=None, show_accessibility_info=None)[source]#
For testing.
- Parameters:
node_id (
NodeId) – Id of the node to get highlight object for.include_distance (
Optional[bool]) – (Optional) Whether to include distance info.include_style (
Optional[bool]) – (Optional) Whether to include style info.color_format (
Optional[ColorFormat]) – (Optional) The color format to get config with (default: hex).show_accessibility_info (
Optional[bool]) – (Optional) Whether to show accessibility info (default: true).
- Return type:
- Returns:
Highlight data for the node.
- highlight_frame(frame_id, content_color=None, content_outline_color=None)[source]#
Highlights owner element of the frame with given id. Deprecated: Doesn’t work reliably and cannot be fixed due to process separation (the owner node might be in a different process). Determine the owner node in the client and use highlightNode.
Deprecated since version 1.3.
- Parameters:
- Return type:
Deprecated since version 1.3.
- highlight_node(highlight_config, node_id=None, backend_node_id=None, object_id=None, selector=None)[source]#
Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified.
- Parameters:
highlight_config (
HighlightConfig) – A descriptor for the highlight appearance.node_id (
Optional[NodeId]) – (Optional) Identifier of the node to highlight.backend_node_id (
Optional[BackendNodeId]) – (Optional) Identifier of the backend node to highlight.object_id (
Optional[RemoteObjectId]) – (Optional) JavaScript object id of the node to be highlighted.selector (
Optional[str]) – (Optional) Selectors to highlight relevant nodes.
- Return type:
- highlight_quad(quad, color=None, outline_color=None)[source]#
Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
- highlight_rect(x, y, width, height, color=None, outline_color=None)[source]#
Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. Issue: the method does not handle device pixel ratio (DPR) correctly. The coordinates currently have to be adjusted by the client if DPR is not 1 (see crbug.com/437807128).
- Parameters:
- Return type:
- highlight_source_order(source_order_config, node_id=None, backend_node_id=None, object_id=None)[source]#
Highlights the source order of the children of the DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified.
- Parameters:
source_order_config (
SourceOrderConfig) – A descriptor for the appearance of the overlay drawing.node_id (
Optional[NodeId]) – (Optional) Identifier of the node to highlight.backend_node_id (
Optional[BackendNodeId]) – (Optional) Identifier of the backend node to highlight.object_id (
Optional[RemoteObjectId]) – (Optional) JavaScript object id of the node to be highlighted.
- Return type:
- set_inspect_mode(mode, highlight_config=None)[source]#
Enters the ‘inspect’ mode. In this mode, elements that user is hovering over are highlighted. Backend then generates ‘inspectNodeRequested’ event upon element selection.
- set_show_grid_overlays(grid_node_highlight_configs)[source]#
Highlight multiple elements with the CSS Grid overlay.
- set_show_hit_test_borders(show)[source]#
Deprecated, no longer has any effect.
Deprecated since version 1.3.
- Parameters:
show (
bool) – True for showing hit-test borders- Return type:
Deprecated since version 1.3.
- set_show_isolated_elements(isolated_element_highlight_configs)[source]#
Show elements in isolation mode with overlays.
- set_show_web_vitals(show)[source]#
Deprecated, no longer has any effect.
Deprecated since version 1.3.
Deprecated since version 1.3.
Events#
Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.
- class InspectNodeRequested(backend_node_id)[source]#
Fired when the node should be inspected. This happens after call to
setInspectModeor when user manually inspects an element.-
backend_node_id:
BackendNodeId# Id of the node to inspect.
-
backend_node_id:
- class NodeHighlightRequested(node_id)[source]#
Fired when the node should be highlighted. This happens after call to
setInspectMode.