css
CSSComputedStyleProperty
dataclass
Source code in zendriver/cdp/css.py
name: str
instance-attribute
value: str
instance-attribute
__init__(name, value)
from_json(json)
classmethod
CSSContainerQuery
dataclass
CSS container query rule descriptor.
Source code in zendriver/cdp/css.py
logical_axes: typing.Optional[dom.LogicalAxes] = None
class-attribute
instance-attribute
name: typing.Optional[str] = None
class-attribute
instance-attribute
physical_axes: typing.Optional[dom.PhysicalAxes] = None
class-attribute
instance-attribute
queries_scroll_state: typing.Optional[bool] = None
class-attribute
instance-attribute
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
text: str
instance-attribute
__init__(text, range_=None, style_sheet_id=None, name=None, physical_axes=None, logical_axes=None, queries_scroll_state=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSFontPaletteValuesRule
dataclass
CSS font-palette-values rule representation.
Source code in zendriver/cdp/css.py
font_palette_name: Value
instance-attribute
origin: StyleSheetOrigin
instance-attribute
style: CSSStyle
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
__init__(origin, font_palette_name, style, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSKeyframeRule
dataclass
CSS keyframe rule representation.
Source code in zendriver/cdp/css.py
key_text: Value
instance-attribute
origin: StyleSheetOrigin
instance-attribute
style: CSSStyle
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
__init__(origin, key_text, style, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSKeyframesRule
dataclass
CSS keyframes rule representation.
Source code in zendriver/cdp/css.py
animation_name: Value
instance-attribute
keyframes: typing.List[CSSKeyframeRule]
instance-attribute
__init__(animation_name, keyframes)
from_json(json)
classmethod
CSSLayer
dataclass
CSS Layer at-rule descriptor.
Source code in zendriver/cdp/css.py
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
text: str
instance-attribute
__init__(text, range_=None, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSLayerData
dataclass
CSS Layer data.
Source code in zendriver/cdp/css.py
name: str
instance-attribute
order: float
instance-attribute
sub_layers: typing.Optional[typing.List[CSSLayerData]] = None
class-attribute
instance-attribute
__init__(name, order, sub_layers=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
CSSMedia
dataclass
CSS media rule descriptor.
Source code in zendriver/cdp/css.py
media_list: typing.Optional[typing.List[MediaQuery]] = None
class-attribute
instance-attribute
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
source: str
instance-attribute
source_url: typing.Optional[str] = None
class-attribute
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
text: str
instance-attribute
__init__(text, source, source_url=None, range_=None, style_sheet_id=None, media_list=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSPositionTryRule
dataclass
CSS @position-try rule representation.
Source code in zendriver/cdp/css.py
active: bool
instance-attribute
name: Value
instance-attribute
origin: StyleSheetOrigin
instance-attribute
style: CSSStyle
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
__init__(name, origin, style, active, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSProperty
dataclass
CSS property declaration data.
Source code in zendriver/cdp/css.py
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 770 771 772 773 774 775 776 777 |
|
disabled: typing.Optional[bool] = None
class-attribute
instance-attribute
implicit: typing.Optional[bool] = None
class-attribute
instance-attribute
important: typing.Optional[bool] = None
class-attribute
instance-attribute
longhand_properties: typing.Optional[typing.List[CSSProperty]] = None
class-attribute
instance-attribute
name: str
instance-attribute
parsed_ok: typing.Optional[bool] = None
class-attribute
instance-attribute
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
text: typing.Optional[str] = None
class-attribute
instance-attribute
value: str
instance-attribute
__init__(name, value, important=None, implicit=None, text=None, parsed_ok=None, disabled=None, range_=None, longhand_properties=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSPropertyRegistration
dataclass
Representation of a custom property registration through CSS.registerProperty
Source code in zendriver/cdp/css.py
inherits: bool
instance-attribute
initial_value: typing.Optional[Value] = None
class-attribute
instance-attribute
property_name: str
instance-attribute
syntax: str
instance-attribute
__init__(property_name, inherits, syntax, initial_value=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSPropertyRule
dataclass
CSS property at-rule representation.
Source code in zendriver/cdp/css.py
origin: StyleSheetOrigin
instance-attribute
property_name: Value
instance-attribute
style: CSSStyle
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
__init__(origin, property_name, style, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSRule
dataclass
CSS rule representation.
Source code in zendriver/cdp/css.py
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 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
container_queries: typing.Optional[typing.List[CSSContainerQuery]] = None
class-attribute
instance-attribute
layers: typing.Optional[typing.List[CSSLayer]] = None
class-attribute
instance-attribute
media: typing.Optional[typing.List[CSSMedia]] = None
class-attribute
instance-attribute
nesting_selectors: typing.Optional[typing.List[str]] = None
class-attribute
instance-attribute
origin: StyleSheetOrigin
instance-attribute
rule_types: typing.Optional[typing.List[CSSRuleType]] = None
class-attribute
instance-attribute
scopes: typing.Optional[typing.List[CSSScope]] = None
class-attribute
instance-attribute
selector_list: SelectorList
instance-attribute
starting_styles: typing.Optional[typing.List[CSSStartingStyle]] = None
class-attribute
instance-attribute
style: CSSStyle
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
supports: typing.Optional[typing.List[CSSSupports]] = None
class-attribute
instance-attribute
__init__(selector_list, origin, style, style_sheet_id=None, nesting_selectors=None, media=None, container_queries=None, supports=None, layers=None, scopes=None, rule_types=None, starting_styles=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSRuleType
Bases: Enum
Enum indicating the type of a CSS rule, used to represent the order of a style rule's ancestors. This list only contains rule types that are collected during the ancestor rule collection.
Source code in zendriver/cdp/css.py
CONTAINER_RULE = 'ContainerRule'
class-attribute
instance-attribute
LAYER_RULE = 'LayerRule'
class-attribute
instance-attribute
MEDIA_RULE = 'MediaRule'
class-attribute
instance-attribute
SCOPE_RULE = 'ScopeRule'
class-attribute
instance-attribute
STARTING_STYLE_RULE = 'StartingStyleRule'
class-attribute
instance-attribute
STYLE_RULE = 'StyleRule'
class-attribute
instance-attribute
SUPPORTS_RULE = 'SupportsRule'
class-attribute
instance-attribute
from_json(json)
classmethod
CSSScope
dataclass
CSS Scope at-rule descriptor.
Source code in zendriver/cdp/css.py
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
text: str
instance-attribute
__init__(text, range_=None, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSStartingStyle
dataclass
CSS Starting Style at-rule descriptor.
Source code in zendriver/cdp/css.py
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
__init__(range_=None, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
CSSStyle
dataclass
CSS style representation.
Source code in zendriver/cdp/css.py
css_properties: typing.List[CSSProperty]
instance-attribute
css_text: typing.Optional[str] = None
class-attribute
instance-attribute
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
shorthand_entries: typing.List[ShorthandEntry]
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
__init__(css_properties, shorthand_entries, style_sheet_id=None, css_text=None, range_=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSStyleSheetHeader
dataclass
CSS stylesheet metainformation.
Source code in zendriver/cdp/css.py
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 |
|
disabled: bool
instance-attribute
end_column: float
instance-attribute
end_line: float
instance-attribute
frame_id: page.FrameId
instance-attribute
has_source_url: typing.Optional[bool] = None
class-attribute
instance-attribute
is_constructed: bool
instance-attribute
is_inline: bool
instance-attribute
is_mutable: bool
instance-attribute
length: float
instance-attribute
loading_failed: typing.Optional[bool] = None
class-attribute
instance-attribute
origin: StyleSheetOrigin
instance-attribute
owner_node: typing.Optional[dom.BackendNodeId] = None
class-attribute
instance-attribute
source_map_url: typing.Optional[str] = None
class-attribute
instance-attribute
source_url: str
instance-attribute
start_column: float
instance-attribute
start_line: float
instance-attribute
style_sheet_id: StyleSheetId
instance-attribute
title: str
instance-attribute
__init__(style_sheet_id, frame_id, source_url, origin, title, disabled, is_inline, is_mutable, is_constructed, start_line, start_column, length, end_line, end_column, source_map_url=None, owner_node=None, has_source_url=None, loading_failed=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSSupports
dataclass
CSS Supports at-rule descriptor.
Source code in zendriver/cdp/css.py
active: bool
instance-attribute
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
text: str
instance-attribute
__init__(text, active, range_=None, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
CSSTryRule
dataclass
CSS try rule representation.
Source code in zendriver/cdp/css.py
origin: StyleSheetOrigin
instance-attribute
style: CSSStyle
instance-attribute
style_sheet_id: typing.Optional[StyleSheetId] = None
class-attribute
instance-attribute
__init__(origin, style, style_sheet_id=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
ComputedStyleUpdated
dataclass
EXPERIMENTAL
Source code in zendriver/cdp/css.py
FontFace
dataclass
Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions and additional information such as platformFontFamily and fontVariationAxes.
Source code in zendriver/cdp/css.py
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
|
font_display: str
instance-attribute
font_family: str
instance-attribute
font_stretch: str
instance-attribute
font_style: str
instance-attribute
font_variant: str
instance-attribute
font_variation_axes: typing.Optional[typing.List[FontVariationAxis]] = None
class-attribute
instance-attribute
font_weight: str
instance-attribute
platform_font_family: str
instance-attribute
src: str
instance-attribute
unicode_range: str
instance-attribute
__init__(font_family, font_style, font_variant, font_weight, font_stretch, font_display, unicode_range, src, platform_font_family, font_variation_axes=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
FontVariationAxis
dataclass
Information about font variation axes for variable fonts
Source code in zendriver/cdp/css.py
default_value: float
instance-attribute
max_value: float
instance-attribute
min_value: float
instance-attribute
name: str
instance-attribute
tag: str
instance-attribute
__init__(tag, name, min_value, max_value, default_value)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
FontsUpdated
dataclass
Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded web font.
Source code in zendriver/cdp/css.py
font: typing.Optional[FontFace]
instance-attribute
__init__(font)
InheritedPseudoElementMatches
dataclass
Inherited pseudo element matches from pseudos of an ancestor node.
Source code in zendriver/cdp/css.py
pseudo_elements: typing.List[PseudoElementMatches]
instance-attribute
__init__(pseudo_elements)
from_json(json)
classmethod
InheritedStyleEntry
dataclass
Inherited CSS rule collection from ancestor node.
Source code in zendriver/cdp/css.py
inline_style: typing.Optional[CSSStyle] = None
class-attribute
instance-attribute
matched_css_rules: typing.List[RuleMatch]
instance-attribute
__init__(matched_css_rules, inline_style=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
MediaQuery
dataclass
Media query descriptor.
Source code in zendriver/cdp/css.py
active: bool
instance-attribute
expressions: typing.List[MediaQueryExpression]
instance-attribute
__init__(expressions, active)
from_json(json)
classmethod
MediaQueryExpression
dataclass
Media query expression descriptor.
Source code in zendriver/cdp/css.py
computed_length: typing.Optional[float] = None
class-attribute
instance-attribute
feature: str
instance-attribute
unit: str
instance-attribute
value: float
instance-attribute
value_range: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
__init__(value, unit, feature, value_range=None, computed_length=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
MediaQueryResultChanged
dataclass
Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.
Source code in zendriver/cdp/css.py
PlatformFontUsage
dataclass
Information about amount of glyphs that were rendered with given font.
Source code in zendriver/cdp/css.py
family_name: str
instance-attribute
glyph_count: float
instance-attribute
is_custom_font: bool
instance-attribute
post_script_name: str
instance-attribute
__init__(family_name, post_script_name, is_custom_font, glyph_count)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
PseudoElementMatches
dataclass
CSS rule collection for a single pseudo style.
Source code in zendriver/cdp/css.py
matches: typing.List[RuleMatch]
instance-attribute
pseudo_identifier: typing.Optional[str] = None
class-attribute
instance-attribute
pseudo_type: dom.PseudoType
instance-attribute
__init__(pseudo_type, matches, pseudo_identifier=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
RuleMatch
dataclass
Match data for a CSS rule.
Source code in zendriver/cdp/css.py
matching_selectors: typing.List[int]
instance-attribute
rule: CSSRule
instance-attribute
__init__(rule, matching_selectors)
from_json(json)
classmethod
RuleUsage
dataclass
CSS coverage information.
Source code in zendriver/cdp/css.py
end_offset: float
instance-attribute
start_offset: float
instance-attribute
style_sheet_id: StyleSheetId
instance-attribute
used: bool
instance-attribute
__init__(style_sheet_id, start_offset, end_offset, used)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
SelectorList
dataclass
Selector list data.
Source code in zendriver/cdp/css.py
selectors: typing.List[Value]
instance-attribute
text: str
instance-attribute
__init__(selectors, text)
from_json(json)
classmethod
ShorthandEntry
dataclass
Source code in zendriver/cdp/css.py
important: typing.Optional[bool] = None
class-attribute
instance-attribute
name: str
instance-attribute
value: str
instance-attribute
__init__(name, value, important=None)
from_json(json)
classmethod
SourceRange
dataclass
Text range within a resource. All numbers are zero-based.
Source code in zendriver/cdp/css.py
end_column: int
instance-attribute
end_line: int
instance-attribute
start_column: int
instance-attribute
start_line: int
instance-attribute
__init__(start_line, start_column, end_line, end_column)
from_json(json)
classmethod
Specificity
dataclass
Specificity: https://drafts.csswg.org/selectors/#specificity-rules
Source code in zendriver/cdp/css.py
a: int
instance-attribute
b: int
instance-attribute
c: int
instance-attribute
__init__(a, b, c)
from_json(json)
classmethod
StyleDeclarationEdit
dataclass
A descriptor of operation to mutate style declaration text.
Source code in zendriver/cdp/css.py
range_: SourceRange
instance-attribute
style_sheet_id: StyleSheetId
instance-attribute
text: str
instance-attribute
__init__(style_sheet_id, range_, text)
from_json(json)
classmethod
StyleSheetAdded
dataclass
Fired whenever an active document stylesheet is added.
Source code in zendriver/cdp/css.py
StyleSheetChanged
dataclass
Fired whenever a stylesheet is changed as a result of the client operation.
Source code in zendriver/cdp/css.py
StyleSheetId
Bases: str
Source code in zendriver/cdp/css.py
__repr__()
from_json(json)
classmethod
StyleSheetOrigin
Bases: Enum
Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via inspector" rules), "regular" for regular stylesheets.
Source code in zendriver/cdp/css.py
INJECTED = 'injected'
class-attribute
instance-attribute
INSPECTOR = 'inspector'
class-attribute
instance-attribute
REGULAR = 'regular'
class-attribute
instance-attribute
USER_AGENT = 'user-agent'
class-attribute
instance-attribute
from_json(json)
classmethod
StyleSheetRemoved
dataclass
Fired whenever an active document stylesheet is removed.
Source code in zendriver/cdp/css.py
Value
dataclass
Data for a simple selector (these are delimited by commas in a selector list).
Source code in zendriver/cdp/css.py
range_: typing.Optional[SourceRange] = None
class-attribute
instance-attribute
specificity: typing.Optional[Specificity] = None
class-attribute
instance-attribute
text: str
instance-attribute
__init__(text, range_=None, specificity=None)
from_json(json)
classmethod
Source code in zendriver/cdp/css.py
to_json()
Source code in zendriver/cdp/css.py
add_rule(style_sheet_id, rule_text, location, node_for_property_syntax_validation=None)
Inserts a new rule with the given ruleText
in a stylesheet with given styleSheetId
, at the
position specified by location
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
The css style sheet identifier where a new rule should be inserted. |
required |
rule_text
|
str
|
The text of a new rule. |
required |
location
|
SourceRange
|
Text position of a new rule in the target style sheet. |
required |
node_for_property_syntax_validation
|
Optional[NodeId]
|
(EXPERIMENTAL) (Optional) NodeId for the DOM node in whose context custom property declarations for registered properties should be validated. If omitted, declarations in the new rule text can only be validated statically, which may produce incorrect results if the declaration contains a var() for example. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, CSSRule]
|
The newly created rule. |
Source code in zendriver/cdp/css.py
collect_class_names(style_sheet_id)
Returns all class names from specified stylesheet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[str]]
|
Class name list. |
Source code in zendriver/cdp/css.py
create_style_sheet(frame_id)
Creates a new special "via-inspector" stylesheet in the frame with given frameId
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame_id
|
FrameId
|
Identifier of the frame where "via-inspector" stylesheet should be created. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, StyleSheetId]
|
Identifier of the created "via-inspector" stylesheet. |
Source code in zendriver/cdp/css.py
disable()
Disables the CSS agent for the given page.
enable()
Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.
Source code in zendriver/cdp/css.py
force_pseudo_state(node_id, forced_pseudo_classes)
Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
The element id for which to force the pseudo state. |
required |
forced_pseudo_classes
|
List[str]
|
Element pseudo classes to force when computing the element's style. |
required |
Source code in zendriver/cdp/css.py
get_background_colors(node_id)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
Id of the node to get background colors for. |
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[Optional[List[str]], Optional[str], Optional[str]]]
|
A tuple with the following items: 0. backgroundColors - (Optional) The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load). 1. computedFontSize - (Optional) The computed font size for this node, as a CSS computed value string (e.g. '12px'). 2. computedFontWeight - (Optional) The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100'). |
Source code in zendriver/cdp/css.py
get_computed_style_for_node(node_id)
Returns the computed style for a DOM node identified by nodeId
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[CSSComputedStyleProperty]]
|
Computed style for the specified DOM node. |
Source code in zendriver/cdp/css.py
get_inline_styles_for_node(node_id)
Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
attributes) for a DOM node identified by nodeId
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[Optional[CSSStyle], Optional[CSSStyle]]]
|
A tuple with the following items: 0. inlineStyle - (Optional) Inline style for the specified DOM node. 1. attributesStyle - (Optional) Attribute-defined element style (e.g. resulting from "width=20 height=100%"). |
Source code in zendriver/cdp/css.py
get_layers_for_node(node_id)
Returns all layers parsed by the rendering engine for the tree scope of a node. Given a DOM element identified by nodeId, getLayersForNode returns the root layer for the nearest ancestor document or shadow root. The layer root contains the full layer tree for the tree scope and their ordering.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, CSSLayerData]
|
|
Source code in zendriver/cdp/css.py
get_location_for_selector(style_sheet_id, selector_text)
Given a CSS selector text and a style sheet ID, getLocationForSelector returns an array of locations of the CSS selector in the style sheet.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
selector_text
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[SourceRange]]
|
|
Source code in zendriver/cdp/css.py
get_matched_styles_for_node(node_id)
Returns requested styles for a DOM node identified by nodeId
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[Optional[CSSStyle], Optional[CSSStyle], Optional[List[RuleMatch]], Optional[List[PseudoElementMatches]], Optional[List[InheritedStyleEntry]], Optional[List[InheritedPseudoElementMatches]], Optional[List[CSSKeyframesRule]], Optional[List[CSSPositionTryRule]], Optional[int], Optional[List[CSSPropertyRule]], Optional[List[CSSPropertyRegistration]], Optional[CSSFontPaletteValuesRule], Optional[NodeId]]]
|
A tuple with the following items: 0. inlineStyle - (Optional) Inline style for the specified DOM node. 1. attributesStyle - (Optional) Attribute-defined element style (e.g. resulting from "width=20 height=100%"). 2. matchedCSSRules - (Optional) CSS rules matching this node, from all applicable stylesheets. 3. pseudoElements - (Optional) Pseudo style matches for this node. 4. inherited - (Optional) A chain of inherited styles (from the immediate node parent up to the DOM tree root). 5. inheritedPseudoElements - (Optional) A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root). 6. cssKeyframesRules - (Optional) A list of CSS keyframed animations matching this node. 7. cssPositionTryRules - (Optional) A list of CSS @position-try rules matching this node, based on the position-try-fallbacks property. 8. activePositionFallbackIndex - (Optional) Index of the active fallback in the applied position-try-fallback property, will not be set if there is no active position-try fallback. 9. cssPropertyRules - (Optional) A list of CSS at-property rules matching this node. 10. cssPropertyRegistrations - (Optional) A list of CSS property registrations matching this node. 11. cssFontPaletteValuesRule - (Optional) A font-palette-values rule matching this node. 12. parentLayoutNodeId - (Optional) Id of the first parent element that does not have display: contents. |
Source code in zendriver/cdp/css.py
1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 |
|
get_media_queries()
Returns all media queries parsed by the rendering engine.
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[CSSMedia]]
|
|
Source code in zendriver/cdp/css.py
get_platform_fonts_for_node(node_id)
Requests information about platform fonts which we used to render child TextNodes in the given node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[PlatformFontUsage]]
|
Usage statistics for every employed platform font. |
Source code in zendriver/cdp/css.py
get_style_sheet_text(style_sheet_id)
Returns the current textual content for a stylesheet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, str]
|
The stylesheet text. |
Source code in zendriver/cdp/css.py
set_container_query_text(style_sheet_id, range_, text)
Modifies the expression of a container query.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
range_
|
SourceRange
|
|
required |
text
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, CSSContainerQuery]
|
The resulting CSS container query rule after modification. |
Source code in zendriver/cdp/css.py
set_effective_property_value_for_node(node_id, property_name, value)
Find a rule with the given active property for the given node and set the new value for this property
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
NodeId
|
The element id for which to set property. |
required |
property_name
|
str
|
|
required |
value
|
str
|
|
required |
Source code in zendriver/cdp/css.py
set_keyframe_key(style_sheet_id, range_, key_text)
Modifies the keyframe rule key text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
range_
|
SourceRange
|
|
required |
key_text
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Value]
|
The resulting key text after modification. |
Source code in zendriver/cdp/css.py
set_local_fonts_enabled(enabled)
Enables/disables rendering of local CSS fonts (enabled by default).
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enabled
|
bool
|
Whether rendering of local fonts is enabled. |
required |
Source code in zendriver/cdp/css.py
set_media_text(style_sheet_id, range_, text)
Modifies the rule selector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
range_
|
SourceRange
|
|
required |
text
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, CSSMedia]
|
The resulting CSS media rule after modification. |
Source code in zendriver/cdp/css.py
set_property_rule_property_name(style_sheet_id, range_, property_name)
Modifies the property rule property name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
range_
|
SourceRange
|
|
required |
property_name
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Value]
|
The resulting key text after modification. |
Source code in zendriver/cdp/css.py
set_rule_selector(style_sheet_id, range_, selector)
Modifies the rule selector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
range_
|
SourceRange
|
|
required |
selector
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, SelectorList]
|
The resulting selector list after modification. |
Source code in zendriver/cdp/css.py
set_scope_text(style_sheet_id, range_, text)
Modifies the expression of a scope at-rule.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
range_
|
SourceRange
|
|
required |
text
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, CSSScope]
|
The resulting CSS Scope rule after modification. |
Source code in zendriver/cdp/css.py
set_style_sheet_text(style_sheet_id, text)
Sets the new stylesheet text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
text
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Optional[str]]
|
(Optional) URL of source map associated with script (if any). |
Source code in zendriver/cdp/css.py
set_style_texts(edits, node_for_property_syntax_validation=None)
Applies specified style edits one after another in the given order.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edits
|
List[StyleDeclarationEdit]
|
|
required |
node_for_property_syntax_validation
|
Optional[NodeId]
|
(EXPERIMENTAL) (Optional) NodeId for the DOM node in whose context custom property declarations for registered properties should be validated. If omitted, declarations in the new rule text can only be validated statically, which may produce incorrect results if the declaration contains a var() for example. |
None
|
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[CSSStyle]]
|
The resulting styles after modification. |
Source code in zendriver/cdp/css.py
set_supports_text(style_sheet_id, range_, text)
Modifies the expression of a supports at-rule.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_sheet_id
|
StyleSheetId
|
|
required |
range_
|
SourceRange
|
|
required |
text
|
str
|
|
required |
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, CSSSupports]
|
The resulting CSS Supports rule after modification. |
Source code in zendriver/cdp/css.py
start_rule_usage_tracking()
Enables the selector recording.
stop_rule_usage_tracking()
Stop tracking rule usage and return the list of rules that were used since last call to
takeCoverageDelta
(or since start of coverage instrumentation).
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[RuleUsage]]
|
|
Source code in zendriver/cdp/css.py
take_computed_style_updates()
Polls the next batch of computed style updates.
EXPERIMENTAL
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[NodeId]]
|
The list of node Ids that have their tracked computed styles updated. |
Source code in zendriver/cdp/css.py
take_coverage_delta()
Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation).
Returns:
Type | Description |
---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[List[RuleUsage], float]]
|
A tuple with the following items: 0. coverage - 1. timestamp - Monotonically increasing time, in seconds. |
Source code in zendriver/cdp/css.py
track_computed_style_updates(properties_to_track)
Starts tracking the given computed styles for updates. The specified array of properties replaces the one previously specified. Pass empty array to disable tracking. Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified. The changes to computed style properties are only tracked for nodes pushed to the front-end by the DOM agent. If no changes to the tracked properties occur after the node has been pushed to the front-end, no updates will be issued for the node.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
properties_to_track
|
List[CSSComputedStyleProperty]
|
|
required |
Source code in zendriver/cdp/css.py
track_computed_style_updates_for_node(node_id=None)
Starts tracking the given node for the computed style updates
and whenever the computed style is updated for node, it queues
a computedStyleUpdated
event with throttling.
There can only be 1 node tracked for computed style updates
so passing a new node id removes tracking from the previous node.
Pass undefined
to disable tracking.
EXPERIMENTAL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
Optional[NodeId]
|
(Optional) |
None
|