diff --git a/cdp/__init__.py b/cdp/__init__.py index de3a091..5ae05c7 100644 --- a/cdp/__init__.py +++ b/cdp/__init__.py @@ -7,7 +7,6 @@ import cdp.accessibility import cdp.animation -import cdp.application_cache import cdp.audits import cdp.background_service import cdp.browser @@ -23,6 +22,7 @@ import cdp.debugger import cdp.device_orientation import cdp.emulation +import cdp.event_breakpoints import cdp.fetch import cdp.headless_experimental import cdp.heap_profiler @@ -32,11 +32,13 @@ import cdp.inspector import cdp.layer_tree import cdp.log +import cdp.media import cdp.memory import cdp.network import cdp.overlay import cdp.page import cdp.performance +import cdp.performance_timeline import cdp.profiler import cdp.runtime import cdp.schema diff --git a/cdp/accessibility.py b/cdp/accessibility.py index f355f85..ea0310a 100644 --- a/cdp/accessibility.py +++ b/cdp/accessibility.py @@ -12,11 +12,12 @@ import typing from . import dom +from . import page from . import runtime class AXNodeId(str): - ''' + r''' Unique accessibility node identifier. ''' def to_json(self) -> str: @@ -31,7 +32,7 @@ def __repr__(self): class AXValueType(enum.Enum): - ''' + r''' Enum of possible property types. ''' BOOLEAN = "boolean" @@ -61,7 +62,7 @@ def from_json(cls, json: str) -> AXValueType: class AXValueSourceType(enum.Enum): - ''' + r''' Enum of possible property sources. ''' ATTRIBUTE = "attribute" @@ -80,14 +81,16 @@ def from_json(cls, json: str) -> AXValueSourceType: class AXValueNativeSourceType(enum.Enum): - ''' + r''' Enum of possible native property sources (as a subtype of a particular AXValueSourceType). ''' + DESCRIPTION = "description" FIGCAPTION = "figcaption" LABEL = "label" LABELFOR = "labelfor" LABELWRAPPED = "labelwrapped" LEGEND = "legend" + RUBYANNOTATION = "rubyannotation" TABLECAPTION = "tablecaption" TITLE = "title" OTHER = "other" @@ -102,7 +105,7 @@ def from_json(cls, json: str) -> AXValueNativeSourceType: @dataclass class AXValueSource: - ''' + r''' A single source for a computed AX property. ''' #: What type of source this is. @@ -221,7 +224,7 @@ def from_json(cls, json: T_JSON_DICT) -> AXProperty: @dataclass class AXValue: - ''' + r''' A single computed AX property. ''' #: The type of this value. @@ -258,7 +261,7 @@ def from_json(cls, json: T_JSON_DICT) -> AXValue: class AXPropertyName(enum.Enum): - ''' + r''' Values of AXProperty name: - from 'busy' to 'roledescription': states which apply to every AX node - from 'live' to 'root': attributes which apply to nodes in live regions @@ -316,7 +319,7 @@ def from_json(cls, json: str) -> AXPropertyName: @dataclass class AXNode: - ''' + r''' A node in the accessibility tree. ''' #: Unique identifier for this node. @@ -343,12 +346,18 @@ class AXNode: #: All other properties properties: typing.Optional[typing.List[AXProperty]] = None + #: ID for this node's parent. + parent_id: typing.Optional[AXNodeId] = None + #: IDs for each of this node's child nodes. child_ids: typing.Optional[typing.List[AXNodeId]] = None #: The backend ID for the associated DOM node, if any. backend_dom_node_id: typing.Optional[dom.BackendNodeId] = None + #: The frame ID for the frame associated with this nodes document. + frame_id: typing.Optional[page.FrameId] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['nodeId'] = self.node_id.to_json() @@ -365,10 +374,14 @@ def to_json(self) -> T_JSON_DICT: json['value'] = self.value.to_json() if self.properties is not None: json['properties'] = [i.to_json() for i in self.properties] + if self.parent_id is not None: + json['parentId'] = self.parent_id.to_json() if self.child_ids is not None: json['childIds'] = [i.to_json() for i in self.child_ids] if self.backend_dom_node_id is not None: json['backendDOMNodeId'] = self.backend_dom_node_id.to_json() + if self.frame_id is not None: + json['frameId'] = self.frame_id.to_json() return json @classmethod @@ -382,13 +395,15 @@ def from_json(cls, json: T_JSON_DICT) -> AXNode: description=AXValue.from_json(json['description']) if 'description' in json else None, value=AXValue.from_json(json['value']) if 'value' in json else None, properties=[AXProperty.from_json(i) for i in json['properties']] if 'properties' in json else None, + parent_id=AXNodeId.from_json(json['parentId']) if 'parentId' in json else None, child_ids=[AXNodeId.from_json(i) for i in json['childIds']] if 'childIds' in json else None, backend_dom_node_id=dom.BackendNodeId.from_json(json['backendDOMNodeId']) if 'backendDOMNodeId' in json else None, + frame_id=page.FrameId.from_json(json['frameId']) if 'frameId' in json else None, ) def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables the accessibility domain. ''' cmd_dict: T_JSON_DICT = { @@ -398,7 +413,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables the accessibility domain which causes ``AXNodeId``'s to remain consistent between method calls. This turns on accessibility for the page, which can impact performance until accessibility is disabled. ''' @@ -414,7 +429,7 @@ def get_partial_ax_tree( object_id: typing.Optional[runtime.RemoteObjectId] = None, fetch_relatives: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]: - ''' + r''' Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists. **EXPERIMENTAL** @@ -442,16 +457,190 @@ def get_partial_ax_tree( return [AXNode.from_json(i) for i in json['nodes']] -def get_full_ax_tree() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]: - ''' - Fetches the entire accessibility tree +def get_full_ax_tree( + depth: typing.Optional[int] = None, + max_depth: typing.Optional[int] = None, + frame_id: typing.Optional[page.FrameId] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]: + r''' + Fetches the entire accessibility tree for the root Document **EXPERIMENTAL** + :param depth: *(Optional)* The maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned. + :param max_depth: **(DEPRECATED)** *(Optional)* Deprecated. This parameter has been renamed to ```depth```. If depth is not provided, max_depth will be used. + :param frame_id: *(Optional)* The frame for whose document the AX tree should be retrieved. If omited, the root frame is used. :returns: ''' + params: T_JSON_DICT = dict() + if depth is not None: + params['depth'] = depth + if max_depth is not None: + params['max_depth'] = max_depth + if frame_id is not None: + params['frameId'] = frame_id.to_json() cmd_dict: T_JSON_DICT = { 'method': 'Accessibility.getFullAXTree', + 'params': params, + } + json = yield cmd_dict + return [AXNode.from_json(i) for i in json['nodes']] + + +def get_root_ax_node( + frame_id: typing.Optional[page.FrameId] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,AXNode]: + r''' + Fetches the root node. + Requires ``enable()`` to have been called previously. + + **EXPERIMENTAL** + + :param frame_id: *(Optional)* The frame in whose document the node resides. If omitted, the root frame is used. + :returns: + ''' + params: T_JSON_DICT = dict() + if frame_id is not None: + params['frameId'] = frame_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Accessibility.getRootAXNode', + 'params': params, + } + json = yield cmd_dict + return AXNode.from_json(json['node']) + + +def get_ax_node_and_ancestors( + node_id: typing.Optional[dom.NodeId] = None, + backend_node_id: typing.Optional[dom.BackendNodeId] = None, + object_id: typing.Optional[runtime.RemoteObjectId] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]: + r''' + Fetches a node and all ancestors up to and including the root. + Requires ``enable()`` to have been called previously. + + **EXPERIMENTAL** + + :param node_id: *(Optional)* Identifier of the node to get. + :param backend_node_id: *(Optional)* Identifier of the backend node to get. + :param object_id: *(Optional)* JavaScript object id of the node wrapper to get. + :returns: + ''' + params: T_JSON_DICT = dict() + if node_id is not None: + params['nodeId'] = node_id.to_json() + if backend_node_id is not None: + params['backendNodeId'] = backend_node_id.to_json() + if object_id is not None: + params['objectId'] = object_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Accessibility.getAXNodeAndAncestors', + 'params': params, } json = yield cmd_dict return [AXNode.from_json(i) for i in json['nodes']] + + +def get_child_ax_nodes( + id_: AXNodeId, + frame_id: typing.Optional[page.FrameId] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]: + r''' + Fetches a particular accessibility node by AXNodeId. + Requires ``enable()`` to have been called previously. + + **EXPERIMENTAL** + + :param id_: + :param frame_id: *(Optional)* The frame in whose document the node resides. If omitted, the root frame is used. + :returns: + ''' + params: T_JSON_DICT = dict() + params['id'] = id_.to_json() + if frame_id is not None: + params['frameId'] = frame_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Accessibility.getChildAXNodes', + 'params': params, + } + json = yield cmd_dict + return [AXNode.from_json(i) for i in json['nodes']] + + +def query_ax_tree( + node_id: typing.Optional[dom.NodeId] = None, + backend_node_id: typing.Optional[dom.BackendNodeId] = None, + object_id: typing.Optional[runtime.RemoteObjectId] = None, + accessible_name: typing.Optional[str] = None, + role: typing.Optional[str] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]: + r''' + Query a DOM node's accessibility subtree for accessible name and role. + This command computes the name and role for all nodes in the subtree, including those that are + ignored for accessibility, and returns those that mactch the specified name and role. If no DOM + node is specified, or the DOM node does not exist, the command returns an error. If neither + ``accessibleName`` or ``role`` is specified, it returns all the accessibility nodes in the subtree. + + **EXPERIMENTAL** + + :param node_id: *(Optional)* Identifier of the node for the root to query. + :param backend_node_id: *(Optional)* Identifier of the backend node for the root to query. + :param object_id: *(Optional)* JavaScript object id of the node wrapper for the root to query. + :param accessible_name: *(Optional)* Find nodes with this computed name. + :param role: *(Optional)* Find nodes with this computed role. + :returns: A list of ``Accessibility.AXNode`` matching the specified attributes, including nodes that are ignored for accessibility. + ''' + params: T_JSON_DICT = dict() + if node_id is not None: + params['nodeId'] = node_id.to_json() + if backend_node_id is not None: + params['backendNodeId'] = backend_node_id.to_json() + if object_id is not None: + params['objectId'] = object_id.to_json() + if accessible_name is not None: + params['accessibleName'] = accessible_name + if role is not None: + params['role'] = role + cmd_dict: T_JSON_DICT = { + 'method': 'Accessibility.queryAXTree', + 'params': params, + } + json = yield cmd_dict + return [AXNode.from_json(i) for i in json['nodes']] + + +@event_class('Accessibility.loadComplete') +@dataclass +class LoadComplete: + r''' + **EXPERIMENTAL** + + The loadComplete event mirrors the load complete event sent by the browser to assistive + technology when the web page has finished loading. + ''' + #: New document root node. + root: AXNode + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LoadComplete: + return cls( + root=AXNode.from_json(json['root']) + ) + + +@event_class('Accessibility.nodesUpdated') +@dataclass +class NodesUpdated: + r''' + **EXPERIMENTAL** + + The nodesUpdated event is sent every time a previously requested node has changed the in tree. + ''' + #: Updated node data. + nodes: typing.List[AXNode] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> NodesUpdated: + return cls( + nodes=[AXNode.from_json(i) for i in json['nodes']] + ) diff --git a/cdp/animation.py b/cdp/animation.py index e47b0e4..02654bd 100644 --- a/cdp/animation.py +++ b/cdp/animation.py @@ -17,7 +17,7 @@ @dataclass class Animation: - ''' + r''' Animation instance. ''' #: ``Animation``'s id. @@ -85,7 +85,7 @@ def from_json(cls, json: T_JSON_DICT) -> Animation: @dataclass class AnimationEffect: - ''' + r''' AnimationEffect instance ''' #: ``AnimationEffect``'s delay. @@ -152,7 +152,7 @@ def from_json(cls, json: T_JSON_DICT) -> AnimationEffect: @dataclass class KeyframesRule: - ''' + r''' Keyframes Rule ''' #: List of animation keyframes. @@ -178,7 +178,7 @@ def from_json(cls, json: T_JSON_DICT) -> KeyframesRule: @dataclass class KeyframeStyle: - ''' + r''' Keyframe Style ''' #: Keyframe's time offset. @@ -202,7 +202,7 @@ def from_json(cls, json: T_JSON_DICT) -> KeyframeStyle: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables animation domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -212,7 +212,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables animation domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -224,7 +224,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_current_time( id_: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]: - ''' + r''' Returns the current time of the an animation. :param id_: Id of animation. @@ -241,7 +241,7 @@ def get_current_time( def get_playback_rate() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]: - ''' + r''' Gets the playback rate of the document timeline. :returns: Playback rate for animations on page. @@ -256,7 +256,7 @@ def get_playback_rate() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]: def release_animations( animations: typing.List[str] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Releases a set of animations to no longer be manipulated. :param animations: List of animation ids to seek. @@ -273,7 +273,7 @@ def release_animations( def resolve_animation( animation_id: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.RemoteObject]: - ''' + r''' Gets the remote object of the Animation. :param animation_id: Animation id. @@ -293,7 +293,7 @@ def seek_animations( animations: typing.List[str], current_time: float ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Seek a set of animations to a particular time within each animation. :param animations: List of animation ids to seek. @@ -313,7 +313,7 @@ def set_paused( animations: typing.List[str], paused: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets the paused state of a set of animations. :param animations: Animations to set the pause state of. @@ -332,7 +332,7 @@ def set_paused( def set_playback_rate( playback_rate: float ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets the playback rate of the document timeline. :param playback_rate: Playback rate for animations on page @@ -351,7 +351,7 @@ def set_timing( duration: float, delay: float ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets the timing of an animation node. :param animation_id: Animation id. @@ -372,7 +372,7 @@ def set_timing( @event_class('Animation.animationCanceled') @dataclass class AnimationCanceled: - ''' + r''' Event for when an animation has been cancelled. ''' #: Id of the animation that was cancelled. @@ -388,7 +388,7 @@ def from_json(cls, json: T_JSON_DICT) -> AnimationCanceled: @event_class('Animation.animationCreated') @dataclass class AnimationCreated: - ''' + r''' Event for each animation that has been created. ''' #: Id of the animation that was created. @@ -404,7 +404,7 @@ def from_json(cls, json: T_JSON_DICT) -> AnimationCreated: @event_class('Animation.animationStarted') @dataclass class AnimationStarted: - ''' + r''' Event for animation that has been started. ''' #: Animation that was started. diff --git a/cdp/application_cache.py b/cdp/application_cache.py deleted file mode 100644 index 9ae01b4..0000000 --- a/cdp/application_cache.py +++ /dev/null @@ -1,207 +0,0 @@ -# DO NOT EDIT THIS FILE! -# -# This file is generated from the CDP specification. If you need to make -# changes, edit the generator and regenerate all of the modules. -# -# CDP domain: ApplicationCache (experimental) - -from __future__ import annotations -from cdp.util import event_class, T_JSON_DICT -from dataclasses import dataclass -import enum -import typing - -from . import page - - -@dataclass -class ApplicationCacheResource: - ''' - Detailed application cache resource information. - ''' - #: Resource url. - url: str - - #: Resource size. - size: int - - #: Resource type. - type_: str - - def to_json(self) -> T_JSON_DICT: - json: T_JSON_DICT = dict() - json['url'] = self.url - json['size'] = self.size - json['type'] = self.type_ - return json - - @classmethod - def from_json(cls, json: T_JSON_DICT) -> ApplicationCacheResource: - return cls( - url=str(json['url']), - size=int(json['size']), - type_=str(json['type']), - ) - - -@dataclass -class ApplicationCache: - ''' - Detailed application cache information. - ''' - #: Manifest URL. - manifest_url: str - - #: Application cache size. - size: float - - #: Application cache creation time. - creation_time: float - - #: Application cache update time. - update_time: float - - #: Application cache resources. - resources: typing.List[ApplicationCacheResource] - - def to_json(self) -> T_JSON_DICT: - json: T_JSON_DICT = dict() - json['manifestURL'] = self.manifest_url - json['size'] = self.size - json['creationTime'] = self.creation_time - json['updateTime'] = self.update_time - json['resources'] = [i.to_json() for i in self.resources] - return json - - @classmethod - def from_json(cls, json: T_JSON_DICT) -> ApplicationCache: - return cls( - manifest_url=str(json['manifestURL']), - size=float(json['size']), - creation_time=float(json['creationTime']), - update_time=float(json['updateTime']), - resources=[ApplicationCacheResource.from_json(i) for i in json['resources']], - ) - - -@dataclass -class FrameWithManifest: - ''' - Frame identifier - manifest URL pair. - ''' - #: Frame identifier. - frame_id: page.FrameId - - #: Manifest URL. - manifest_url: str - - #: Application cache status. - status: int - - def to_json(self) -> T_JSON_DICT: - json: T_JSON_DICT = dict() - json['frameId'] = self.frame_id.to_json() - json['manifestURL'] = self.manifest_url - json['status'] = self.status - return json - - @classmethod - def from_json(cls, json: T_JSON_DICT) -> FrameWithManifest: - return cls( - frame_id=page.FrameId.from_json(json['frameId']), - manifest_url=str(json['manifestURL']), - status=int(json['status']), - ) - - -def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Enables application cache domain notifications. - ''' - cmd_dict: T_JSON_DICT = { - 'method': 'ApplicationCache.enable', - } - json = yield cmd_dict - - -def get_application_cache_for_frame( - frame_id: page.FrameId - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,ApplicationCache]: - ''' - Returns relevant application cache data for the document in given frame. - - :param frame_id: Identifier of the frame containing document whose application cache is retrieved. - :returns: Relevant application cache data for the document in given frame. - ''' - params: T_JSON_DICT = dict() - params['frameId'] = frame_id.to_json() - cmd_dict: T_JSON_DICT = { - 'method': 'ApplicationCache.getApplicationCacheForFrame', - 'params': params, - } - json = yield cmd_dict - return ApplicationCache.from_json(json['applicationCache']) - - -def get_frames_with_manifests() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[FrameWithManifest]]: - ''' - Returns array of frame identifiers with manifest urls for each frame containing a document - associated with some application cache. - - :returns: Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache. - ''' - cmd_dict: T_JSON_DICT = { - 'method': 'ApplicationCache.getFramesWithManifests', - } - json = yield cmd_dict - return [FrameWithManifest.from_json(i) for i in json['frameIds']] - - -def get_manifest_for_frame( - frame_id: page.FrameId - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' - Returns manifest URL for document in the given frame. - - :param frame_id: Identifier of the frame containing document whose manifest is retrieved. - :returns: Manifest URL for document in the given frame. - ''' - params: T_JSON_DICT = dict() - params['frameId'] = frame_id.to_json() - cmd_dict: T_JSON_DICT = { - 'method': 'ApplicationCache.getManifestForFrame', - 'params': params, - } - json = yield cmd_dict - return str(json['manifestURL']) - - -@event_class('ApplicationCache.applicationCacheStatusUpdated') -@dataclass -class ApplicationCacheStatusUpdated: - #: Identifier of the frame containing document whose application cache updated status. - frame_id: page.FrameId - #: Manifest URL. - manifest_url: str - #: Updated application cache status. - status: int - - @classmethod - def from_json(cls, json: T_JSON_DICT) -> ApplicationCacheStatusUpdated: - return cls( - frame_id=page.FrameId.from_json(json['frameId']), - manifest_url=str(json['manifestURL']), - status=int(json['status']) - ) - - -@event_class('ApplicationCache.networkStateUpdated') -@dataclass -class NetworkStateUpdated: - is_now_online: bool - - @classmethod - def from_json(cls, json: T_JSON_DICT) -> NetworkStateUpdated: - return cls( - is_now_online=bool(json['isNowOnline']) - ) diff --git a/cdp/audits.py b/cdp/audits.py index 67c4dde..297a3fd 100644 --- a/cdp/audits.py +++ b/cdp/audits.py @@ -11,7 +11,1097 @@ import enum import typing +from . import dom from . import network +from . import page +from . import runtime + + +@dataclass +class AffectedCookie: + r''' + Information about a cookie that is affected by an inspector issue. + ''' + #: The following three properties uniquely identify a cookie + name: str + + path: str + + domain: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + json['path'] = self.path + json['domain'] = self.domain + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AffectedCookie: + return cls( + name=str(json['name']), + path=str(json['path']), + domain=str(json['domain']), + ) + + +@dataclass +class AffectedRequest: + r''' + Information about a request that is affected by an inspector issue. + ''' + #: The unique request id. + request_id: network.RequestId + + url: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['requestId'] = self.request_id.to_json() + if self.url is not None: + json['url'] = self.url + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AffectedRequest: + return cls( + request_id=network.RequestId.from_json(json['requestId']), + url=str(json['url']) if 'url' in json else None, + ) + + +@dataclass +class AffectedFrame: + r''' + Information about the frame affected by an inspector issue. + ''' + frame_id: page.FrameId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['frameId'] = self.frame_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AffectedFrame: + return cls( + frame_id=page.FrameId.from_json(json['frameId']), + ) + + +class SameSiteCookieExclusionReason(enum.Enum): + EXCLUDE_SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "ExcludeSameSiteUnspecifiedTreatedAsLax" + EXCLUDE_SAME_SITE_NONE_INSECURE = "ExcludeSameSiteNoneInsecure" + EXCLUDE_SAME_SITE_LAX = "ExcludeSameSiteLax" + EXCLUDE_SAME_SITE_STRICT = "ExcludeSameSiteStrict" + EXCLUDE_INVALID_SAME_PARTY = "ExcludeInvalidSameParty" + EXCLUDE_SAME_PARTY_CROSS_PARTY_CONTEXT = "ExcludeSamePartyCrossPartyContext" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> SameSiteCookieExclusionReason: + return cls(json) + + +class SameSiteCookieWarningReason(enum.Enum): + WARN_SAME_SITE_UNSPECIFIED_CROSS_SITE_CONTEXT = "WarnSameSiteUnspecifiedCrossSiteContext" + WARN_SAME_SITE_NONE_INSECURE = "WarnSameSiteNoneInsecure" + WARN_SAME_SITE_UNSPECIFIED_LAX_ALLOW_UNSAFE = "WarnSameSiteUnspecifiedLaxAllowUnsafe" + WARN_SAME_SITE_STRICT_LAX_DOWNGRADE_STRICT = "WarnSameSiteStrictLaxDowngradeStrict" + WARN_SAME_SITE_STRICT_CROSS_DOWNGRADE_STRICT = "WarnSameSiteStrictCrossDowngradeStrict" + WARN_SAME_SITE_STRICT_CROSS_DOWNGRADE_LAX = "WarnSameSiteStrictCrossDowngradeLax" + WARN_SAME_SITE_LAX_CROSS_DOWNGRADE_STRICT = "WarnSameSiteLaxCrossDowngradeStrict" + WARN_SAME_SITE_LAX_CROSS_DOWNGRADE_LAX = "WarnSameSiteLaxCrossDowngradeLax" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> SameSiteCookieWarningReason: + return cls(json) + + +class SameSiteCookieOperation(enum.Enum): + SET_COOKIE = "SetCookie" + READ_COOKIE = "ReadCookie" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> SameSiteCookieOperation: + return cls(json) + + +@dataclass +class SameSiteCookieIssueDetails: + r''' + This information is currently necessary, as the front-end has a difficult + time finding a specific cookie. With this, we can convey specific error + information without the cookie. + ''' + cookie_warning_reasons: typing.List[SameSiteCookieWarningReason] + + cookie_exclusion_reasons: typing.List[SameSiteCookieExclusionReason] + + #: Optionally identifies the site-for-cookies and the cookie url, which + #: may be used by the front-end as additional context. + operation: SameSiteCookieOperation + + #: If AffectedCookie is not set then rawCookieLine contains the raw + #: Set-Cookie header string. This hints at a problem where the + #: cookie line is syntactically or semantically malformed in a way + #: that no valid cookie could be created. + cookie: typing.Optional[AffectedCookie] = None + + raw_cookie_line: typing.Optional[str] = None + + site_for_cookies: typing.Optional[str] = None + + cookie_url: typing.Optional[str] = None + + request: typing.Optional[AffectedRequest] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['cookieWarningReasons'] = [i.to_json() for i in self.cookie_warning_reasons] + json['cookieExclusionReasons'] = [i.to_json() for i in self.cookie_exclusion_reasons] + json['operation'] = self.operation.to_json() + if self.cookie is not None: + json['cookie'] = self.cookie.to_json() + if self.raw_cookie_line is not None: + json['rawCookieLine'] = self.raw_cookie_line + if self.site_for_cookies is not None: + json['siteForCookies'] = self.site_for_cookies + if self.cookie_url is not None: + json['cookieUrl'] = self.cookie_url + if self.request is not None: + json['request'] = self.request.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SameSiteCookieIssueDetails: + return cls( + cookie_warning_reasons=[SameSiteCookieWarningReason.from_json(i) for i in json['cookieWarningReasons']], + cookie_exclusion_reasons=[SameSiteCookieExclusionReason.from_json(i) for i in json['cookieExclusionReasons']], + operation=SameSiteCookieOperation.from_json(json['operation']), + cookie=AffectedCookie.from_json(json['cookie']) if 'cookie' in json else None, + raw_cookie_line=str(json['rawCookieLine']) if 'rawCookieLine' in json else None, + site_for_cookies=str(json['siteForCookies']) if 'siteForCookies' in json else None, + cookie_url=str(json['cookieUrl']) if 'cookieUrl' in json else None, + request=AffectedRequest.from_json(json['request']) if 'request' in json else None, + ) + + +class MixedContentResolutionStatus(enum.Enum): + MIXED_CONTENT_BLOCKED = "MixedContentBlocked" + MIXED_CONTENT_AUTOMATICALLY_UPGRADED = "MixedContentAutomaticallyUpgraded" + MIXED_CONTENT_WARNING = "MixedContentWarning" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> MixedContentResolutionStatus: + return cls(json) + + +class MixedContentResourceType(enum.Enum): + AUDIO = "Audio" + BEACON = "Beacon" + CSP_REPORT = "CSPReport" + DOWNLOAD = "Download" + EVENT_SOURCE = "EventSource" + FAVICON = "Favicon" + FONT = "Font" + FORM = "Form" + FRAME = "Frame" + IMAGE = "Image" + IMPORT = "Import" + MANIFEST = "Manifest" + PING = "Ping" + PLUGIN_DATA = "PluginData" + PLUGIN_RESOURCE = "PluginResource" + PREFETCH = "Prefetch" + RESOURCE = "Resource" + SCRIPT = "Script" + SERVICE_WORKER = "ServiceWorker" + SHARED_WORKER = "SharedWorker" + STYLESHEET = "Stylesheet" + TRACK = "Track" + VIDEO = "Video" + WORKER = "Worker" + XML_HTTP_REQUEST = "XMLHttpRequest" + XSLT = "XSLT" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> MixedContentResourceType: + return cls(json) + + +@dataclass +class MixedContentIssueDetails: + #: The way the mixed content issue is being resolved. + resolution_status: MixedContentResolutionStatus + + #: The unsafe http url causing the mixed content issue. + insecure_url: str + + #: The url responsible for the call to an unsafe url. + main_resource_url: str + + #: The type of resource causing the mixed content issue (css, js, iframe, + #: form,...). Marked as optional because it is mapped to from + #: blink::mojom::RequestContextType, which will be replaced + #: by network::mojom::RequestDestination + resource_type: typing.Optional[MixedContentResourceType] = None + + #: The mixed content request. + #: Does not always exist (e.g. for unsafe form submission urls). + request: typing.Optional[AffectedRequest] = None + + #: Optional because not every mixed content issue is necessarily linked to a frame. + frame: typing.Optional[AffectedFrame] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['resolutionStatus'] = self.resolution_status.to_json() + json['insecureURL'] = self.insecure_url + json['mainResourceURL'] = self.main_resource_url + if self.resource_type is not None: + json['resourceType'] = self.resource_type.to_json() + if self.request is not None: + json['request'] = self.request.to_json() + if self.frame is not None: + json['frame'] = self.frame.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> MixedContentIssueDetails: + return cls( + resolution_status=MixedContentResolutionStatus.from_json(json['resolutionStatus']), + insecure_url=str(json['insecureURL']), + main_resource_url=str(json['mainResourceURL']), + resource_type=MixedContentResourceType.from_json(json['resourceType']) if 'resourceType' in json else None, + request=AffectedRequest.from_json(json['request']) if 'request' in json else None, + frame=AffectedFrame.from_json(json['frame']) if 'frame' in json else None, + ) + + +class BlockedByResponseReason(enum.Enum): + r''' + Enum indicating the reason a response has been blocked. These reasons are + refinements of the net error BLOCKED_BY_RESPONSE. + ''' + COEP_FRAME_RESOURCE_NEEDS_COEP_HEADER = "CoepFrameResourceNeedsCoepHeader" + COOP_SANDBOXED_I_FRAME_CANNOT_NAVIGATE_TO_COOP_PAGE = "CoopSandboxedIFrameCannotNavigateToCoopPage" + CORP_NOT_SAME_ORIGIN = "CorpNotSameOrigin" + CORP_NOT_SAME_ORIGIN_AFTER_DEFAULTED_TO_SAME_ORIGIN_BY_COEP = "CorpNotSameOriginAfterDefaultedToSameOriginByCoep" + CORP_NOT_SAME_SITE = "CorpNotSameSite" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> BlockedByResponseReason: + return cls(json) + + +@dataclass +class BlockedByResponseIssueDetails: + r''' + Details for a request that has been blocked with the BLOCKED_BY_RESPONSE + code. Currently only used for COEP/COOP, but may be extended to include + some CSP errors in the future. + ''' + request: AffectedRequest + + reason: BlockedByResponseReason + + parent_frame: typing.Optional[AffectedFrame] = None + + blocked_frame: typing.Optional[AffectedFrame] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['request'] = self.request.to_json() + json['reason'] = self.reason.to_json() + if self.parent_frame is not None: + json['parentFrame'] = self.parent_frame.to_json() + if self.blocked_frame is not None: + json['blockedFrame'] = self.blocked_frame.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> BlockedByResponseIssueDetails: + return cls( + request=AffectedRequest.from_json(json['request']), + reason=BlockedByResponseReason.from_json(json['reason']), + parent_frame=AffectedFrame.from_json(json['parentFrame']) if 'parentFrame' in json else None, + blocked_frame=AffectedFrame.from_json(json['blockedFrame']) if 'blockedFrame' in json else None, + ) + + +class HeavyAdResolutionStatus(enum.Enum): + HEAVY_AD_BLOCKED = "HeavyAdBlocked" + HEAVY_AD_WARNING = "HeavyAdWarning" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> HeavyAdResolutionStatus: + return cls(json) + + +class HeavyAdReason(enum.Enum): + NETWORK_TOTAL_LIMIT = "NetworkTotalLimit" + CPU_TOTAL_LIMIT = "CpuTotalLimit" + CPU_PEAK_LIMIT = "CpuPeakLimit" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> HeavyAdReason: + return cls(json) + + +@dataclass +class HeavyAdIssueDetails: + #: The resolution status, either blocking the content or warning. + resolution: HeavyAdResolutionStatus + + #: The reason the ad was blocked, total network or cpu or peak cpu. + reason: HeavyAdReason + + #: The frame that was blocked. + frame: AffectedFrame + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['resolution'] = self.resolution.to_json() + json['reason'] = self.reason.to_json() + json['frame'] = self.frame.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> HeavyAdIssueDetails: + return cls( + resolution=HeavyAdResolutionStatus.from_json(json['resolution']), + reason=HeavyAdReason.from_json(json['reason']), + frame=AffectedFrame.from_json(json['frame']), + ) + + +class ContentSecurityPolicyViolationType(enum.Enum): + K_INLINE_VIOLATION = "kInlineViolation" + K_EVAL_VIOLATION = "kEvalViolation" + K_URL_VIOLATION = "kURLViolation" + K_TRUSTED_TYPES_SINK_VIOLATION = "kTrustedTypesSinkViolation" + K_TRUSTED_TYPES_POLICY_VIOLATION = "kTrustedTypesPolicyViolation" + K_WASM_EVAL_VIOLATION = "kWasmEvalViolation" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ContentSecurityPolicyViolationType: + return cls(json) + + +@dataclass +class SourceCodeLocation: + url: str + + line_number: int + + column_number: int + + script_id: typing.Optional[runtime.ScriptId] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['url'] = self.url + json['lineNumber'] = self.line_number + json['columnNumber'] = self.column_number + if self.script_id is not None: + json['scriptId'] = self.script_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SourceCodeLocation: + return cls( + url=str(json['url']), + line_number=int(json['lineNumber']), + column_number=int(json['columnNumber']), + script_id=runtime.ScriptId.from_json(json['scriptId']) if 'scriptId' in json else None, + ) + + +@dataclass +class ContentSecurityPolicyIssueDetails: + #: Specific directive that is violated, causing the CSP issue. + violated_directive: str + + is_report_only: bool + + content_security_policy_violation_type: ContentSecurityPolicyViolationType + + #: The url not included in allowed sources. + blocked_url: typing.Optional[str] = None + + frame_ancestor: typing.Optional[AffectedFrame] = None + + source_code_location: typing.Optional[SourceCodeLocation] = None + + violating_node_id: typing.Optional[dom.BackendNodeId] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['violatedDirective'] = self.violated_directive + json['isReportOnly'] = self.is_report_only + json['contentSecurityPolicyViolationType'] = self.content_security_policy_violation_type.to_json() + if self.blocked_url is not None: + json['blockedURL'] = self.blocked_url + if self.frame_ancestor is not None: + json['frameAncestor'] = self.frame_ancestor.to_json() + if self.source_code_location is not None: + json['sourceCodeLocation'] = self.source_code_location.to_json() + if self.violating_node_id is not None: + json['violatingNodeId'] = self.violating_node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ContentSecurityPolicyIssueDetails: + return cls( + violated_directive=str(json['violatedDirective']), + is_report_only=bool(json['isReportOnly']), + content_security_policy_violation_type=ContentSecurityPolicyViolationType.from_json(json['contentSecurityPolicyViolationType']), + blocked_url=str(json['blockedURL']) if 'blockedURL' in json else None, + frame_ancestor=AffectedFrame.from_json(json['frameAncestor']) if 'frameAncestor' in json else None, + source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']) if 'sourceCodeLocation' in json else None, + violating_node_id=dom.BackendNodeId.from_json(json['violatingNodeId']) if 'violatingNodeId' in json else None, + ) + + +class SharedArrayBufferIssueType(enum.Enum): + TRANSFER_ISSUE = "TransferIssue" + CREATION_ISSUE = "CreationIssue" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> SharedArrayBufferIssueType: + return cls(json) + + +@dataclass +class SharedArrayBufferIssueDetails: + r''' + Details for a issue arising from an SAB being instantiated in, or + transferred to a context that is not cross-origin isolated. + ''' + source_code_location: SourceCodeLocation + + is_warning: bool + + type_: SharedArrayBufferIssueType + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['sourceCodeLocation'] = self.source_code_location.to_json() + json['isWarning'] = self.is_warning + json['type'] = self.type_.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SharedArrayBufferIssueDetails: + return cls( + source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']), + is_warning=bool(json['isWarning']), + type_=SharedArrayBufferIssueType.from_json(json['type']), + ) + + +class TwaQualityEnforcementViolationType(enum.Enum): + K_HTTP_ERROR = "kHttpError" + K_UNAVAILABLE_OFFLINE = "kUnavailableOffline" + K_DIGITAL_ASSET_LINKS = "kDigitalAssetLinks" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> TwaQualityEnforcementViolationType: + return cls(json) + + +@dataclass +class TrustedWebActivityIssueDetails: + #: The url that triggers the violation. + url: str + + violation_type: TwaQualityEnforcementViolationType + + http_status_code: typing.Optional[int] = None + + #: The package name of the Trusted Web Activity client app. This field is + #: only used when violation type is kDigitalAssetLinks. + package_name: typing.Optional[str] = None + + #: The signature of the Trusted Web Activity client app. This field is only + #: used when violation type is kDigitalAssetLinks. + signature: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['url'] = self.url + json['violationType'] = self.violation_type.to_json() + if self.http_status_code is not None: + json['httpStatusCode'] = self.http_status_code + if self.package_name is not None: + json['packageName'] = self.package_name + if self.signature is not None: + json['signature'] = self.signature + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> TrustedWebActivityIssueDetails: + return cls( + url=str(json['url']), + violation_type=TwaQualityEnforcementViolationType.from_json(json['violationType']), + http_status_code=int(json['httpStatusCode']) if 'httpStatusCode' in json else None, + package_name=str(json['packageName']) if 'packageName' in json else None, + signature=str(json['signature']) if 'signature' in json else None, + ) + + +@dataclass +class LowTextContrastIssueDetails: + violating_node_id: dom.BackendNodeId + + violating_node_selector: str + + contrast_ratio: float + + threshold_aa: float + + threshold_aaa: float + + font_size: str + + font_weight: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['violatingNodeId'] = self.violating_node_id.to_json() + json['violatingNodeSelector'] = self.violating_node_selector + json['contrastRatio'] = self.contrast_ratio + json['thresholdAA'] = self.threshold_aa + json['thresholdAAA'] = self.threshold_aaa + json['fontSize'] = self.font_size + json['fontWeight'] = self.font_weight + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LowTextContrastIssueDetails: + return cls( + violating_node_id=dom.BackendNodeId.from_json(json['violatingNodeId']), + violating_node_selector=str(json['violatingNodeSelector']), + contrast_ratio=float(json['contrastRatio']), + threshold_aa=float(json['thresholdAA']), + threshold_aaa=float(json['thresholdAAA']), + font_size=str(json['fontSize']), + font_weight=str(json['fontWeight']), + ) + + +@dataclass +class CorsIssueDetails: + r''' + Details for a CORS related issue, e.g. a warning or error related to + CORS RFC1918 enforcement. + ''' + cors_error_status: network.CorsErrorStatus + + is_warning: bool + + request: AffectedRequest + + location: typing.Optional[SourceCodeLocation] = None + + initiator_origin: typing.Optional[str] = None + + resource_ip_address_space: typing.Optional[network.IPAddressSpace] = None + + client_security_state: typing.Optional[network.ClientSecurityState] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['corsErrorStatus'] = self.cors_error_status.to_json() + json['isWarning'] = self.is_warning + json['request'] = self.request.to_json() + if self.location is not None: + json['location'] = self.location.to_json() + if self.initiator_origin is not None: + json['initiatorOrigin'] = self.initiator_origin + if self.resource_ip_address_space is not None: + json['resourceIPAddressSpace'] = self.resource_ip_address_space.to_json() + if self.client_security_state is not None: + json['clientSecurityState'] = self.client_security_state.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CorsIssueDetails: + return cls( + cors_error_status=network.CorsErrorStatus.from_json(json['corsErrorStatus']), + is_warning=bool(json['isWarning']), + request=AffectedRequest.from_json(json['request']), + location=SourceCodeLocation.from_json(json['location']) if 'location' in json else None, + initiator_origin=str(json['initiatorOrigin']) if 'initiatorOrigin' in json else None, + resource_ip_address_space=network.IPAddressSpace.from_json(json['resourceIPAddressSpace']) if 'resourceIPAddressSpace' in json else None, + client_security_state=network.ClientSecurityState.from_json(json['clientSecurityState']) if 'clientSecurityState' in json else None, + ) + + +class AttributionReportingIssueType(enum.Enum): + PERMISSION_POLICY_DISABLED = "PermissionPolicyDisabled" + INVALID_ATTRIBUTION_SOURCE_EVENT_ID = "InvalidAttributionSourceEventId" + INVALID_ATTRIBUTION_DATA = "InvalidAttributionData" + ATTRIBUTION_SOURCE_UNTRUSTWORTHY_ORIGIN = "AttributionSourceUntrustworthyOrigin" + ATTRIBUTION_UNTRUSTWORTHY_ORIGIN = "AttributionUntrustworthyOrigin" + ATTRIBUTION_TRIGGER_DATA_TOO_LARGE = "AttributionTriggerDataTooLarge" + ATTRIBUTION_EVENT_SOURCE_TRIGGER_DATA_TOO_LARGE = "AttributionEventSourceTriggerDataTooLarge" + INVALID_ATTRIBUTION_SOURCE_EXPIRY = "InvalidAttributionSourceExpiry" + INVALID_ATTRIBUTION_SOURCE_PRIORITY = "InvalidAttributionSourcePriority" + INVALID_EVENT_SOURCE_TRIGGER_DATA = "InvalidEventSourceTriggerData" + INVALID_TRIGGER_PRIORITY = "InvalidTriggerPriority" + INVALID_TRIGGER_DEDUP_KEY = "InvalidTriggerDedupKey" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> AttributionReportingIssueType: + return cls(json) + + +@dataclass +class AttributionReportingIssueDetails: + r''' + Details for issues around "Attribution Reporting API" usage. + Explainer: https://github.com/WICG/conversion-measurement-api + ''' + violation_type: AttributionReportingIssueType + + frame: typing.Optional[AffectedFrame] = None + + request: typing.Optional[AffectedRequest] = None + + violating_node_id: typing.Optional[dom.BackendNodeId] = None + + invalid_parameter: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['violationType'] = self.violation_type.to_json() + if self.frame is not None: + json['frame'] = self.frame.to_json() + if self.request is not None: + json['request'] = self.request.to_json() + if self.violating_node_id is not None: + json['violatingNodeId'] = self.violating_node_id.to_json() + if self.invalid_parameter is not None: + json['invalidParameter'] = self.invalid_parameter + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AttributionReportingIssueDetails: + return cls( + violation_type=AttributionReportingIssueType.from_json(json['violationType']), + frame=AffectedFrame.from_json(json['frame']) if 'frame' in json else None, + request=AffectedRequest.from_json(json['request']) if 'request' in json else None, + violating_node_id=dom.BackendNodeId.from_json(json['violatingNodeId']) if 'violatingNodeId' in json else None, + invalid_parameter=str(json['invalidParameter']) if 'invalidParameter' in json else None, + ) + + +@dataclass +class QuirksModeIssueDetails: + r''' + Details for issues about documents in Quirks Mode + or Limited Quirks Mode that affects page layouting. + ''' + #: If false, it means the document's mode is "quirks" + #: instead of "limited-quirks". + is_limited_quirks_mode: bool + + document_node_id: dom.BackendNodeId + + url: str + + frame_id: page.FrameId + + loader_id: network.LoaderId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['isLimitedQuirksMode'] = self.is_limited_quirks_mode + json['documentNodeId'] = self.document_node_id.to_json() + json['url'] = self.url + json['frameId'] = self.frame_id.to_json() + json['loaderId'] = self.loader_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> QuirksModeIssueDetails: + return cls( + is_limited_quirks_mode=bool(json['isLimitedQuirksMode']), + document_node_id=dom.BackendNodeId.from_json(json['documentNodeId']), + url=str(json['url']), + frame_id=page.FrameId.from_json(json['frameId']), + loader_id=network.LoaderId.from_json(json['loaderId']), + ) + + +@dataclass +class NavigatorUserAgentIssueDetails: + url: str + + location: typing.Optional[SourceCodeLocation] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['url'] = self.url + if self.location is not None: + json['location'] = self.location.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> NavigatorUserAgentIssueDetails: + return cls( + url=str(json['url']), + location=SourceCodeLocation.from_json(json['location']) if 'location' in json else None, + ) + + +@dataclass +class WasmCrossOriginModuleSharingIssueDetails: + wasm_module_url: str + + source_origin: str + + target_origin: str + + is_warning: bool + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['wasmModuleUrl'] = self.wasm_module_url + json['sourceOrigin'] = self.source_origin + json['targetOrigin'] = self.target_origin + json['isWarning'] = self.is_warning + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> WasmCrossOriginModuleSharingIssueDetails: + return cls( + wasm_module_url=str(json['wasmModuleUrl']), + source_origin=str(json['sourceOrigin']), + target_origin=str(json['targetOrigin']), + is_warning=bool(json['isWarning']), + ) + + +class GenericIssueErrorType(enum.Enum): + CROSS_ORIGIN_PORTAL_POST_MESSAGE_ERROR = "CrossOriginPortalPostMessageError" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> GenericIssueErrorType: + return cls(json) + + +@dataclass +class GenericIssueDetails: + r''' + Depending on the concrete errorType, different properties are set. + ''' + #: Issues with the same errorType are aggregated in the frontend. + error_type: GenericIssueErrorType + + frame_id: typing.Optional[page.FrameId] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['errorType'] = self.error_type.to_json() + if self.frame_id is not None: + json['frameId'] = self.frame_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> GenericIssueDetails: + return cls( + error_type=GenericIssueErrorType.from_json(json['errorType']), + frame_id=page.FrameId.from_json(json['frameId']) if 'frameId' in json else None, + ) + + +@dataclass +class DeprecationIssueDetails: + r''' + This issue tracks information needed to print a deprecation message. + The formatting is inherited from the old console.log version, see more at: + https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/frame/deprecation.cc + TODO(crbug.com/1264960): Re-work format to add i18n support per: + https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/devtools_protocol/README.md + ''' + source_code_location: SourceCodeLocation + + affected_frame: typing.Optional[AffectedFrame] = None + + #: The content of the deprecation issue (this won't be translated), + #: e.g. "window.inefficientLegacyStorageMethod will be removed in M97, + #: around January 2022. Please use Web Storage or Indexed Database + #: instead. This standard was abandoned in January, 1970. See + #: https://www.chromestatus.com/feature/5684870116278272 for more details." + message: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['sourceCodeLocation'] = self.source_code_location.to_json() + if self.affected_frame is not None: + json['affectedFrame'] = self.affected_frame.to_json() + if self.message is not None: + json['message'] = self.message + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DeprecationIssueDetails: + return cls( + source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']), + affected_frame=AffectedFrame.from_json(json['affectedFrame']) if 'affectedFrame' in json else None, + message=str(json['message']) if 'message' in json else None, + ) + + +class ClientHintIssueReason(enum.Enum): + META_TAG_ALLOW_LIST_INVALID_ORIGIN = "MetaTagAllowListInvalidOrigin" + META_TAG_MODIFIED_HTML = "MetaTagModifiedHTML" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ClientHintIssueReason: + return cls(json) + + +@dataclass +class ClientHintIssueDetails: + r''' + This issue tracks client hints related issues. It's used to deprecate old + features, encourage the use of new ones, and provide general guidance. + ''' + source_code_location: SourceCodeLocation + + client_hint_issue_reason: ClientHintIssueReason + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['sourceCodeLocation'] = self.source_code_location.to_json() + json['clientHintIssueReason'] = self.client_hint_issue_reason.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ClientHintIssueDetails: + return cls( + source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']), + client_hint_issue_reason=ClientHintIssueReason.from_json(json['clientHintIssueReason']), + ) + + +class InspectorIssueCode(enum.Enum): + r''' + A unique identifier for the type of issue. Each type may use one of the + optional fields in InspectorIssueDetails to convey more specific + information about the kind of issue. + ''' + SAME_SITE_COOKIE_ISSUE = "SameSiteCookieIssue" + MIXED_CONTENT_ISSUE = "MixedContentIssue" + BLOCKED_BY_RESPONSE_ISSUE = "BlockedByResponseIssue" + HEAVY_AD_ISSUE = "HeavyAdIssue" + CONTENT_SECURITY_POLICY_ISSUE = "ContentSecurityPolicyIssue" + SHARED_ARRAY_BUFFER_ISSUE = "SharedArrayBufferIssue" + TRUSTED_WEB_ACTIVITY_ISSUE = "TrustedWebActivityIssue" + LOW_TEXT_CONTRAST_ISSUE = "LowTextContrastIssue" + CORS_ISSUE = "CorsIssue" + ATTRIBUTION_REPORTING_ISSUE = "AttributionReportingIssue" + QUIRKS_MODE_ISSUE = "QuirksModeIssue" + NAVIGATOR_USER_AGENT_ISSUE = "NavigatorUserAgentIssue" + WASM_CROSS_ORIGIN_MODULE_SHARING_ISSUE = "WasmCrossOriginModuleSharingIssue" + GENERIC_ISSUE = "GenericIssue" + DEPRECATION_ISSUE = "DeprecationIssue" + CLIENT_HINT_ISSUE = "ClientHintIssue" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> InspectorIssueCode: + return cls(json) + + +@dataclass +class InspectorIssueDetails: + r''' + This struct holds a list of optional fields with additional information + specific to the kind of issue. When adding a new issue code, please also + add a new optional field to this type. + ''' + same_site_cookie_issue_details: typing.Optional[SameSiteCookieIssueDetails] = None + + mixed_content_issue_details: typing.Optional[MixedContentIssueDetails] = None + + blocked_by_response_issue_details: typing.Optional[BlockedByResponseIssueDetails] = None + + heavy_ad_issue_details: typing.Optional[HeavyAdIssueDetails] = None + + content_security_policy_issue_details: typing.Optional[ContentSecurityPolicyIssueDetails] = None + + shared_array_buffer_issue_details: typing.Optional[SharedArrayBufferIssueDetails] = None + + twa_quality_enforcement_details: typing.Optional[TrustedWebActivityIssueDetails] = None + + low_text_contrast_issue_details: typing.Optional[LowTextContrastIssueDetails] = None + + cors_issue_details: typing.Optional[CorsIssueDetails] = None + + attribution_reporting_issue_details: typing.Optional[AttributionReportingIssueDetails] = None + + quirks_mode_issue_details: typing.Optional[QuirksModeIssueDetails] = None + + navigator_user_agent_issue_details: typing.Optional[NavigatorUserAgentIssueDetails] = None + + wasm_cross_origin_module_sharing_issue: typing.Optional[WasmCrossOriginModuleSharingIssueDetails] = None + + generic_issue_details: typing.Optional[GenericIssueDetails] = None + + deprecation_issue_details: typing.Optional[DeprecationIssueDetails] = None + + client_hint_issue_details: typing.Optional[ClientHintIssueDetails] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.same_site_cookie_issue_details is not None: + json['sameSiteCookieIssueDetails'] = self.same_site_cookie_issue_details.to_json() + if self.mixed_content_issue_details is not None: + json['mixedContentIssueDetails'] = self.mixed_content_issue_details.to_json() + if self.blocked_by_response_issue_details is not None: + json['blockedByResponseIssueDetails'] = self.blocked_by_response_issue_details.to_json() + if self.heavy_ad_issue_details is not None: + json['heavyAdIssueDetails'] = self.heavy_ad_issue_details.to_json() + if self.content_security_policy_issue_details is not None: + json['contentSecurityPolicyIssueDetails'] = self.content_security_policy_issue_details.to_json() + if self.shared_array_buffer_issue_details is not None: + json['sharedArrayBufferIssueDetails'] = self.shared_array_buffer_issue_details.to_json() + if self.twa_quality_enforcement_details is not None: + json['twaQualityEnforcementDetails'] = self.twa_quality_enforcement_details.to_json() + if self.low_text_contrast_issue_details is not None: + json['lowTextContrastIssueDetails'] = self.low_text_contrast_issue_details.to_json() + if self.cors_issue_details is not None: + json['corsIssueDetails'] = self.cors_issue_details.to_json() + if self.attribution_reporting_issue_details is not None: + json['attributionReportingIssueDetails'] = self.attribution_reporting_issue_details.to_json() + if self.quirks_mode_issue_details is not None: + json['quirksModeIssueDetails'] = self.quirks_mode_issue_details.to_json() + if self.navigator_user_agent_issue_details is not None: + json['navigatorUserAgentIssueDetails'] = self.navigator_user_agent_issue_details.to_json() + if self.wasm_cross_origin_module_sharing_issue is not None: + json['wasmCrossOriginModuleSharingIssue'] = self.wasm_cross_origin_module_sharing_issue.to_json() + if self.generic_issue_details is not None: + json['genericIssueDetails'] = self.generic_issue_details.to_json() + if self.deprecation_issue_details is not None: + json['deprecationIssueDetails'] = self.deprecation_issue_details.to_json() + if self.client_hint_issue_details is not None: + json['clientHintIssueDetails'] = self.client_hint_issue_details.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> InspectorIssueDetails: + return cls( + same_site_cookie_issue_details=SameSiteCookieIssueDetails.from_json(json['sameSiteCookieIssueDetails']) if 'sameSiteCookieIssueDetails' in json else None, + mixed_content_issue_details=MixedContentIssueDetails.from_json(json['mixedContentIssueDetails']) if 'mixedContentIssueDetails' in json else None, + blocked_by_response_issue_details=BlockedByResponseIssueDetails.from_json(json['blockedByResponseIssueDetails']) if 'blockedByResponseIssueDetails' in json else None, + heavy_ad_issue_details=HeavyAdIssueDetails.from_json(json['heavyAdIssueDetails']) if 'heavyAdIssueDetails' in json else None, + content_security_policy_issue_details=ContentSecurityPolicyIssueDetails.from_json(json['contentSecurityPolicyIssueDetails']) if 'contentSecurityPolicyIssueDetails' in json else None, + shared_array_buffer_issue_details=SharedArrayBufferIssueDetails.from_json(json['sharedArrayBufferIssueDetails']) if 'sharedArrayBufferIssueDetails' in json else None, + twa_quality_enforcement_details=TrustedWebActivityIssueDetails.from_json(json['twaQualityEnforcementDetails']) if 'twaQualityEnforcementDetails' in json else None, + low_text_contrast_issue_details=LowTextContrastIssueDetails.from_json(json['lowTextContrastIssueDetails']) if 'lowTextContrastIssueDetails' in json else None, + cors_issue_details=CorsIssueDetails.from_json(json['corsIssueDetails']) if 'corsIssueDetails' in json else None, + attribution_reporting_issue_details=AttributionReportingIssueDetails.from_json(json['attributionReportingIssueDetails']) if 'attributionReportingIssueDetails' in json else None, + quirks_mode_issue_details=QuirksModeIssueDetails.from_json(json['quirksModeIssueDetails']) if 'quirksModeIssueDetails' in json else None, + navigator_user_agent_issue_details=NavigatorUserAgentIssueDetails.from_json(json['navigatorUserAgentIssueDetails']) if 'navigatorUserAgentIssueDetails' in json else None, + wasm_cross_origin_module_sharing_issue=WasmCrossOriginModuleSharingIssueDetails.from_json(json['wasmCrossOriginModuleSharingIssue']) if 'wasmCrossOriginModuleSharingIssue' in json else None, + generic_issue_details=GenericIssueDetails.from_json(json['genericIssueDetails']) if 'genericIssueDetails' in json else None, + deprecation_issue_details=DeprecationIssueDetails.from_json(json['deprecationIssueDetails']) if 'deprecationIssueDetails' in json else None, + client_hint_issue_details=ClientHintIssueDetails.from_json(json['clientHintIssueDetails']) if 'clientHintIssueDetails' in json else None, + ) + + +class IssueId(str): + r''' + A unique id for a DevTools inspector issue. Allows other entities (e.g. + exceptions, CDP message, console messages, etc.) to reference an issue. + ''' + def to_json(self) -> str: + return self + + @classmethod + def from_json(cls, json: str) -> IssueId: + return cls(json) + + def __repr__(self): + return 'IssueId({})'.format(super().__repr__()) + + +@dataclass +class InspectorIssue: + r''' + An inspector issue reported from the back-end. + ''' + code: InspectorIssueCode + + details: InspectorIssueDetails + + #: A unique id for this issue. May be omitted if no other entity (e.g. + #: exception, CDP message, etc.) is referencing this issue. + issue_id: typing.Optional[IssueId] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['code'] = self.code.to_json() + json['details'] = self.details.to_json() + if self.issue_id is not None: + json['issueId'] = self.issue_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> InspectorIssue: + return cls( + code=InspectorIssueCode.from_json(json['code']), + details=InspectorIssueDetails.from_json(json['details']), + issue_id=IssueId.from_json(json['issueId']) if 'issueId' in json else None, + ) def get_encoded_response( @@ -20,7 +1110,7 @@ def get_encoded_response( quality: typing.Optional[float] = None, size_only: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[str], int, int]]: - ''' + r''' Returns the response body and size if it were re-encoded with the specified settings. Only applies to images. @@ -30,7 +1120,7 @@ def get_encoded_response( :param size_only: *(Optional)* Whether to only return the size information (defaults to false). :returns: A tuple with the following items: - 0. **body** - *(Optional)* The encoded body as a base64 string. Omitted if sizeOnly is true. + 0. **body** - *(Optional)* The encoded body as a base64 string. Omitted if sizeOnly is true. (Encoded as a base64 string when passed over JSON) 1. **originalSize** - Size before re-encoding. 2. **encodedSize** - Size after re-encoding. ''' @@ -51,3 +1141,55 @@ def get_encoded_response( int(json['originalSize']), int(json['encodedSize']) ) + + +def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Disables issues domain, prevents further issues from being reported to the client. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Audits.disable', + } + json = yield cmd_dict + + +def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Enables issues domain, sends the issues collected so far to the client by means of the + ``issueAdded`` event. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Audits.enable', + } + json = yield cmd_dict + + +def check_contrast( + report_aaa: typing.Optional[bool] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Runs the contrast check for the target page. Found issues are reported + using Audits.issueAdded event. + + :param report_aaa: *(Optional)* Whether to report WCAG AAA level issues. Default is false. + ''' + params: T_JSON_DICT = dict() + if report_aaa is not None: + params['reportAAA'] = report_aaa + cmd_dict: T_JSON_DICT = { + 'method': 'Audits.checkContrast', + 'params': params, + } + json = yield cmd_dict + + +@event_class('Audits.issueAdded') +@dataclass +class IssueAdded: + issue: InspectorIssue + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> IssueAdded: + return cls( + issue=InspectorIssue.from_json(json['issue']) + ) diff --git a/cdp/background_service.py b/cdp/background_service.py index 703747c..582c7af 100644 --- a/cdp/background_service.py +++ b/cdp/background_service.py @@ -16,7 +16,7 @@ class ServiceName(enum.Enum): - ''' + r''' The Background Service that will be associated with the commands/events. Every Background Service operates independently, but they share the same API. @@ -26,6 +26,7 @@ class ServiceName(enum.Enum): PUSH_MESSAGING = "pushMessaging" NOTIFICATIONS = "notifications" PAYMENT_HANDLER = "paymentHandler" + PERIODIC_BACKGROUND_SYNC = "periodicBackgroundSync" def to_json(self) -> str: return self.value @@ -37,7 +38,7 @@ def from_json(cls, json: str) -> ServiceName: @dataclass class EventMetadata: - ''' + r''' A key-value pair for additional event information to pass along. ''' key: str @@ -108,7 +109,7 @@ def from_json(cls, json: T_JSON_DICT) -> BackgroundServiceEvent: def start_observing( service: ServiceName ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables event updates for the service. :param service: @@ -125,7 +126,7 @@ def start_observing( def stop_observing( service: ServiceName ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables event updates for the service. :param service: @@ -143,7 +144,7 @@ def set_recording( should_record: bool, service: ServiceName ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Set the recording state for the service. :param should_record: @@ -162,7 +163,7 @@ def set_recording( def clear_events( service: ServiceName ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears all stored data for the service. :param service: @@ -179,7 +180,7 @@ def clear_events( @event_class('BackgroundService.recordingStateChanged') @dataclass class RecordingStateChanged: - ''' + r''' Called when the recording state for the service has been updated. ''' is_recording: bool @@ -196,7 +197,7 @@ def from_json(cls, json: T_JSON_DICT) -> RecordingStateChanged: @event_class('BackgroundService.backgroundServiceEventReceived') @dataclass class BackgroundServiceEventReceived: - ''' + r''' Called with all existing backgroundServiceEvents when enabled, and all new events afterwards if enabled and recording. ''' diff --git a/cdp/browser.py b/cdp/browser.py index 20102f7..d900db8 100644 --- a/cdp/browser.py +++ b/cdp/browser.py @@ -11,9 +11,22 @@ import enum import typing +from . import page from . import target +class BrowserContextID(str): + def to_json(self) -> str: + return self + + @classmethod + def from_json(cls, json: str) -> BrowserContextID: + return cls(json) + + def __repr__(self): + return 'BrowserContextID({})'.format(super().__repr__()) + + class WindowID(int): def to_json(self) -> int: return self @@ -27,7 +40,7 @@ def __repr__(self): class WindowState(enum.Enum): - ''' + r''' The state of the browser window. ''' NORMAL = "normal" @@ -45,7 +58,7 @@ def from_json(cls, json: str) -> WindowState: @dataclass class Bounds: - ''' + r''' Browser window bounds information ''' #: The offset from the left edge of the screen to the window in pixels. @@ -93,19 +106,22 @@ class PermissionType(enum.Enum): AUDIO_CAPTURE = "audioCapture" BACKGROUND_SYNC = "backgroundSync" BACKGROUND_FETCH = "backgroundFetch" - CLIPBOARD_READ = "clipboardRead" - CLIPBOARD_WRITE = "clipboardWrite" + CLIPBOARD_READ_WRITE = "clipboardReadWrite" + CLIPBOARD_SANITIZED_WRITE = "clipboardSanitizedWrite" + DISPLAY_CAPTURE = "displayCapture" DURABLE_STORAGE = "durableStorage" FLASH = "flash" GEOLOCATION = "geolocation" MIDI = "midi" MIDI_SYSEX = "midiSysex" + NFC = "nfc" NOTIFICATIONS = "notifications" PAYMENT_HANDLER = "paymentHandler" PERIODIC_BACKGROUND_SYNC = "periodicBackgroundSync" PROTECTED_MEDIA_IDENTIFIER = "protectedMediaIdentifier" SENSORS = "sensors" VIDEO_CAPTURE = "videoCapture" + VIDEO_CAPTURE_PAN_TILT_ZOOM = "videoCapturePanTiltZoom" IDLE_DETECTION = "idleDetection" WAKE_LOCK_SCREEN = "wakeLockScreen" WAKE_LOCK_SYSTEM = "wakeLockSystem" @@ -118,9 +134,84 @@ def from_json(cls, json: str) -> PermissionType: return cls(json) +class PermissionSetting(enum.Enum): + GRANTED = "granted" + DENIED = "denied" + PROMPT = "prompt" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> PermissionSetting: + return cls(json) + + @dataclass -class Bucket: +class PermissionDescriptor: + r''' + Definition of PermissionDescriptor defined in the Permissions API: + https://w3c.github.io/permissions/#dictdef-permissiondescriptor. + ''' + #: Name of permission. + #: See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names. + name: str + + #: For "midi" permission, may also specify sysex control. + sysex: typing.Optional[bool] = None + + #: For "push" permission, may specify userVisibleOnly. + #: Note that userVisibleOnly = true is the only currently supported type. + user_visible_only: typing.Optional[bool] = None + + #: For "clipboard" permission, may specify allowWithoutSanitization. + allow_without_sanitization: typing.Optional[bool] = None + + #: For "camera" permission, may specify panTiltZoom. + pan_tilt_zoom: typing.Optional[bool] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + if self.sysex is not None: + json['sysex'] = self.sysex + if self.user_visible_only is not None: + json['userVisibleOnly'] = self.user_visible_only + if self.allow_without_sanitization is not None: + json['allowWithoutSanitization'] = self.allow_without_sanitization + if self.pan_tilt_zoom is not None: + json['panTiltZoom'] = self.pan_tilt_zoom + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PermissionDescriptor: + return cls( + name=str(json['name']), + sysex=bool(json['sysex']) if 'sysex' in json else None, + user_visible_only=bool(json['userVisibleOnly']) if 'userVisibleOnly' in json else None, + allow_without_sanitization=bool(json['allowWithoutSanitization']) if 'allowWithoutSanitization' in json else None, + pan_tilt_zoom=bool(json['panTiltZoom']) if 'panTiltZoom' in json else None, + ) + + +class BrowserCommandId(enum.Enum): + r''' + Browser command ids used by executeBrowserCommand. ''' + OPEN_TAB_SEARCH = "openTabSearch" + CLOSE_TAB_SEARCH = "closeTabSearch" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> BrowserCommandId: + return cls(json) + + +@dataclass +class Bucket: + r''' Chrome histogram bucket. ''' #: Minimum value (inclusive). @@ -150,7 +241,7 @@ def from_json(cls, json: T_JSON_DICT) -> Bucket: @dataclass class Histogram: - ''' + r''' Chrome histogram. ''' #: Name. @@ -183,23 +274,54 @@ def from_json(cls, json: T_JSON_DICT) -> Histogram: ) +def set_permission( + permission: PermissionDescriptor, + setting: PermissionSetting, + origin: typing.Optional[str] = None, + browser_context_id: typing.Optional[BrowserContextID] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Set permission settings for given origin. + + **EXPERIMENTAL** + + :param permission: Descriptor of permission to override. + :param setting: Setting of the permission. + :param origin: *(Optional)* Origin the permission applies to, all origins if not specified. + :param browser_context_id: *(Optional)* Context to override. When omitted, default browser context is used. + ''' + params: T_JSON_DICT = dict() + params['permission'] = permission.to_json() + params['setting'] = setting.to_json() + if origin is not None: + params['origin'] = origin + if browser_context_id is not None: + params['browserContextId'] = browser_context_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Browser.setPermission', + 'params': params, + } + json = yield cmd_dict + + def grant_permissions( - origin: str, permissions: typing.List[PermissionType], - browser_context_id: typing.Optional[target.BrowserContextID] = None + origin: typing.Optional[str] = None, + browser_context_id: typing.Optional[BrowserContextID] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Grant specific permissions to the given origin and reject all others. **EXPERIMENTAL** - :param origin: :param permissions: + :param origin: *(Optional)* Origin the permission applies to, all origins if not specified. :param browser_context_id: *(Optional)* BrowserContext to override permissions. When omitted, default browser context is used. ''' params: T_JSON_DICT = dict() - params['origin'] = origin params['permissions'] = [i.to_json() for i in permissions] + if origin is not None: + params['origin'] = origin if browser_context_id is not None: params['browserContextId'] = browser_context_id.to_json() cmd_dict: T_JSON_DICT = { @@ -210,9 +332,9 @@ def grant_permissions( def reset_permissions( - browser_context_id: typing.Optional[target.BrowserContextID] = None + browser_context_id: typing.Optional[BrowserContextID] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Reset all permission management for all origins. **EXPERIMENTAL** @@ -229,8 +351,62 @@ def reset_permissions( json = yield cmd_dict -def close() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: +def set_download_behavior( + behavior: str, + browser_context_id: typing.Optional[BrowserContextID] = None, + download_path: typing.Optional[str] = None, + events_enabled: typing.Optional[bool] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Set the behavior when downloading a file. + + **EXPERIMENTAL** + + :param behavior: Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). ``allowAndName`` allows download and names files according to their dowmload guids. + :param browser_context_id: *(Optional)* BrowserContext to set download behavior. When omitted, default browser context is used. + :param download_path: *(Optional)* The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'. + :param events_enabled: *(Optional)* Whether to emit download events (defaults to false). ''' + params: T_JSON_DICT = dict() + params['behavior'] = behavior + if browser_context_id is not None: + params['browserContextId'] = browser_context_id.to_json() + if download_path is not None: + params['downloadPath'] = download_path + if events_enabled is not None: + params['eventsEnabled'] = events_enabled + cmd_dict: T_JSON_DICT = { + 'method': 'Browser.setDownloadBehavior', + 'params': params, + } + json = yield cmd_dict + + +def cancel_download( + guid: str, + browser_context_id: typing.Optional[BrowserContextID] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Cancel a download if in progress + + **EXPERIMENTAL** + + :param guid: Global unique identifier of the download. + :param browser_context_id: *(Optional)* BrowserContext to perform the action in. When omitted, default browser context is used. + ''' + params: T_JSON_DICT = dict() + params['guid'] = guid + if browser_context_id is not None: + params['browserContextId'] = browser_context_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Browser.cancelDownload', + 'params': params, + } + json = yield cmd_dict + + +def close() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Close browser gracefully. ''' cmd_dict: T_JSON_DICT = { @@ -240,7 +416,7 @@ def close() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def crash() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Crashes browser on the main thread. **EXPERIMENTAL** @@ -252,7 +428,7 @@ def crash() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def crash_gpu_process() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Crashes GPU process. **EXPERIMENTAL** @@ -264,7 +440,7 @@ def crash_gpu_process() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_version() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, str, str, str, str]]: - ''' + r''' Returns version information. :returns: A tuple with the following items: @@ -289,7 +465,7 @@ def get_version() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, def get_browser_command_line() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline. @@ -308,7 +484,7 @@ def get_histograms( query: typing.Optional[str] = None, delta: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Histogram]]: - ''' + r''' Get Chrome histograms. **EXPERIMENTAL** @@ -334,7 +510,7 @@ def get_histogram( name: str, delta: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Histogram]: - ''' + r''' Get a Chrome histogram by name. **EXPERIMENTAL** @@ -358,7 +534,7 @@ def get_histogram( def get_window_bounds( window_id: WindowID ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Bounds]: - ''' + r''' Get position and size of the browser window. **EXPERIMENTAL** @@ -379,7 +555,7 @@ def get_window_bounds( def get_window_for_target( target_id: typing.Optional[target.TargetID] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[WindowID, Bounds]]: - ''' + r''' Get the browser window that contains the devtools target. **EXPERIMENTAL** @@ -408,7 +584,7 @@ def set_window_bounds( window_id: WindowID, bounds: Bounds ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Set position and/or size of the browser window. **EXPERIMENTAL** @@ -430,13 +606,13 @@ def set_dock_tile( badge_label: typing.Optional[str] = None, image: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Set dock tile details, platform-specific. **EXPERIMENTAL** :param badge_label: *(Optional)* - :param image: *(Optional)* Png encoded image. + :param image: *(Optional)* Png encoded image. (Encoded as a base64 string when passed over JSON) ''' params: T_JSON_DICT = dict() if badge_label is not None: @@ -448,3 +624,76 @@ def set_dock_tile( 'params': params, } json = yield cmd_dict + + +def execute_browser_command( + command_id: BrowserCommandId + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Invoke custom browser commands used by telemetry. + + **EXPERIMENTAL** + + :param command_id: + ''' + params: T_JSON_DICT = dict() + params['commandId'] = command_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Browser.executeBrowserCommand', + 'params': params, + } + json = yield cmd_dict + + +@event_class('Browser.downloadWillBegin') +@dataclass +class DownloadWillBegin: + r''' + **EXPERIMENTAL** + + Fired when page is about to start a download. + ''' + #: Id of the frame that caused the download to begin. + frame_id: page.FrameId + #: Global unique identifier of the download. + guid: str + #: URL of the resource being downloaded. + url: str + #: Suggested file name of the resource (the actual name of the file saved on disk may differ). + suggested_filename: str + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DownloadWillBegin: + return cls( + frame_id=page.FrameId.from_json(json['frameId']), + guid=str(json['guid']), + url=str(json['url']), + suggested_filename=str(json['suggestedFilename']) + ) + + +@event_class('Browser.downloadProgress') +@dataclass +class DownloadProgress: + r''' + **EXPERIMENTAL** + + Fired when download makes progress. Last call has ``done`` == true. + ''' + #: Global unique identifier of the download. + guid: str + #: Total expected bytes to download. + total_bytes: float + #: Total bytes received. + received_bytes: float + #: Download status. + state: str + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DownloadProgress: + return cls( + guid=str(json['guid']), + total_bytes=float(json['totalBytes']), + received_bytes=float(json['receivedBytes']), + state=str(json['state']) + ) diff --git a/cdp/cache_storage.py b/cdp/cache_storage.py index 62646c8..b0a48a9 100644 --- a/cdp/cache_storage.py +++ b/cdp/cache_storage.py @@ -13,7 +13,7 @@ class CacheId(str): - ''' + r''' Unique identifier of the Cache object. ''' def to_json(self) -> str: @@ -28,7 +28,7 @@ def __repr__(self): class CachedResponseType(enum.Enum): - ''' + r''' type of HTTP response cached ''' BASIC = "basic" @@ -48,7 +48,7 @@ def from_json(cls, json: str) -> CachedResponseType: @dataclass class DataEntry: - ''' + r''' Data entry. ''' #: Request URL. @@ -103,7 +103,7 @@ def from_json(cls, json: T_JSON_DICT) -> DataEntry: @dataclass class Cache: - ''' + r''' Cache identifier. ''' #: An opaque unique id of the cache. @@ -153,10 +153,10 @@ def from_json(cls, json: T_JSON_DICT) -> Header: @dataclass class CachedResponse: - ''' + r''' Cached response ''' - #: Entry content, base64-encoded. + #: Entry content, base64-encoded. (Encoded as a base64 string when passed over JSON) body: str def to_json(self) -> T_JSON_DICT: @@ -174,7 +174,7 @@ def from_json(cls, json: T_JSON_DICT) -> CachedResponse: def delete_cache( cache_id: CacheId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Deletes a cache. :param cache_id: Id of cache for deletion. @@ -192,7 +192,7 @@ def delete_entry( cache_id: CacheId, request: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Deletes a cache entry. :param cache_id: Id of cache where the entry will be deleted. @@ -211,7 +211,7 @@ def delete_entry( def request_cache_names( security_origin: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Cache]]: - ''' + r''' Requests cache names. :param security_origin: Security origin. @@ -232,7 +232,7 @@ def request_cached_response( request_url: str, request_headers: typing.List[Header] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CachedResponse]: - ''' + r''' Fetches cache entry. :param cache_id: Id of cache that contains the entry. @@ -254,16 +254,16 @@ def request_cached_response( def request_entries( cache_id: CacheId, - skip_count: int, - page_size: int, + skip_count: typing.Optional[int] = None, + page_size: typing.Optional[int] = None, path_filter: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[DataEntry], float]]: - ''' + r''' Requests data from cache. :param cache_id: ID of cache to get entries from. - :param skip_count: Number of records to skip. - :param page_size: Number of records to fetch. + :param skip_count: *(Optional)* Number of records to skip. + :param page_size: *(Optional)* Number of records to fetch. :param path_filter: *(Optional)* If present, only return the entries containing this substring in the path :returns: A tuple with the following items: @@ -272,8 +272,10 @@ def request_entries( ''' params: T_JSON_DICT = dict() params['cacheId'] = cache_id.to_json() - params['skipCount'] = skip_count - params['pageSize'] = page_size + if skip_count is not None: + params['skipCount'] = skip_count + if page_size is not None: + params['pageSize'] = page_size if path_filter is not None: params['pathFilter'] = path_filter cmd_dict: T_JSON_DICT = { diff --git a/cdp/cast.py b/cdp/cast.py index 054071c..e409977 100644 --- a/cdp/cast.py +++ b/cdp/cast.py @@ -42,7 +42,7 @@ def from_json(cls, json: T_JSON_DICT) -> Sink: def enable( presentation_url: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Starts observing for sinks that can be used for tab mirroring, and if set, sinks compatible with ``presentationUrl`` as well. When sinks are found, a ``sinksUpdated`` event is fired. @@ -62,7 +62,7 @@ def enable( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Stops observing for sinks and issues. ''' cmd_dict: T_JSON_DICT = { @@ -74,7 +74,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def set_sink_to_use( sink_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets a sink to be used when the web page requests the browser to choose a sink via Presentation API, Remote Playback API, or Cast SDK. @@ -89,10 +89,27 @@ def set_sink_to_use( json = yield cmd_dict -def start_tab_mirroring( +def start_desktop_mirroring( sink_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Starts mirroring the desktop to the sink. + + :param sink_name: ''' + params: T_JSON_DICT = dict() + params['sinkName'] = sink_name + cmd_dict: T_JSON_DICT = { + 'method': 'Cast.startDesktopMirroring', + 'params': params, + } + json = yield cmd_dict + + +def start_tab_mirroring( + sink_name: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Starts mirroring the tab to the sink. :param sink_name: @@ -109,7 +126,7 @@ def start_tab_mirroring( def stop_casting( sink_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Stops the active Cast session on the sink. :param sink_name: @@ -126,7 +143,7 @@ def stop_casting( @event_class('Cast.sinksUpdated') @dataclass class SinksUpdated: - ''' + r''' This is fired whenever the list of available sinks changes. A sink is a device or a software surface that you can cast to. ''' @@ -142,7 +159,7 @@ def from_json(cls, json: T_JSON_DICT) -> SinksUpdated: @event_class('Cast.issueUpdated') @dataclass class IssueUpdated: - ''' + r''' This is fired whenever the outstanding issue/error message changes. ``issueMessage`` is empty if there is no issue. ''' diff --git a/cdp/console.py b/cdp/console.py index bf7e9c1..e1ac1cd 100644 --- a/cdp/console.py +++ b/cdp/console.py @@ -14,7 +14,7 @@ @dataclass class ConsoleMessage: - ''' + r''' Console message. ''' #: Message source. @@ -61,7 +61,7 @@ def from_json(cls, json: T_JSON_DICT) -> ConsoleMessage: def clear_messages() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Does nothing. ''' cmd_dict: T_JSON_DICT = { @@ -71,7 +71,7 @@ def clear_messages() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables console domain, prevents further console messages from being reported to the client. ''' cmd_dict: T_JSON_DICT = { @@ -81,7 +81,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables console domain, sends the messages collected so far to the client by means of the ``messageAdded`` notification. ''' @@ -94,7 +94,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: @event_class('Console.messageAdded') @dataclass class MessageAdded: - ''' + r''' Issued when new console message is added. ''' #: Console message that has been added. diff --git a/cdp/css.py b/cdp/css.py index bee93c6..a76ee2f 100644 --- a/cdp/css.py +++ b/cdp/css.py @@ -28,7 +28,7 @@ def __repr__(self): class StyleSheetOrigin(enum.Enum): - ''' + r''' 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. @@ -48,7 +48,7 @@ def from_json(cls, json: str) -> StyleSheetOrigin: @dataclass class PseudoElementMatches: - ''' + r''' CSS rule collection for a single pseudo style. ''' #: Pseudo element type. @@ -73,7 +73,7 @@ def from_json(cls, json: T_JSON_DICT) -> PseudoElementMatches: @dataclass class InheritedStyleEntry: - ''' + r''' Inherited CSS rule collection from ancestor node. ''' #: Matches of CSS rules matching the ancestor node in the style inheritance chain. @@ -99,7 +99,7 @@ def from_json(cls, json: T_JSON_DICT) -> InheritedStyleEntry: @dataclass class RuleMatch: - ''' + r''' Match data for a CSS rule. ''' #: CSS rule in the match. @@ -124,7 +124,7 @@ def from_json(cls, json: T_JSON_DICT) -> RuleMatch: @dataclass class Value: - ''' + r''' Data for a simple selector (these are delimited by commas in a selector list). ''' #: Value text. @@ -150,7 +150,7 @@ def from_json(cls, json: T_JSON_DICT) -> Value: @dataclass class SelectorList: - ''' + r''' Selector list data. ''' #: Selectors in the list. @@ -175,7 +175,7 @@ def from_json(cls, json: T_JSON_DICT) -> SelectorList: @dataclass class CSSStyleSheetHeader: - ''' + r''' CSS stylesheet metainformation. ''' #: The stylesheet identifier. @@ -184,7 +184,9 @@ class CSSStyleSheetHeader: #: Owner frame identifier. frame_id: page.FrameId - #: Stylesheet resource URL. + #: Stylesheet resource URL. Empty if this is a constructed stylesheet created using + #: new CSSStyleSheet() (but non-empty if this is a constructed sylesheet imported + #: as a CSS module script). source_url: str #: Stylesheet origin. @@ -200,6 +202,16 @@ class CSSStyleSheetHeader: #: document.written STYLE tags. is_inline: bool + #: Whether this stylesheet is mutable. Inline stylesheets become mutable + #: after they have been modified via CSSOM API. + #: element's stylesheets become mutable only if DevTools modifies them. + #: Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation. + is_mutable: bool + + #: True if this stylesheet is created through new CSSStyleSheet() or imported as a + #: CSS module script. + is_constructed: bool + #: Line offset of the stylesheet within the resource (zero based). start_line: float @@ -209,6 +221,12 @@ class CSSStyleSheetHeader: #: Size of the content (in characters). length: float + #: Line offset of the end of the stylesheet within the resource (zero based). + end_line: float + + #: Column offset of the end of the stylesheet within the resource (zero based). + end_column: float + #: URL of source map associated with the stylesheet (if any). source_map_url: typing.Optional[str] = None @@ -227,9 +245,13 @@ def to_json(self) -> T_JSON_DICT: json['title'] = self.title json['disabled'] = self.disabled json['isInline'] = self.is_inline + json['isMutable'] = self.is_mutable + json['isConstructed'] = self.is_constructed json['startLine'] = self.start_line json['startColumn'] = self.start_column json['length'] = self.length + json['endLine'] = self.end_line + json['endColumn'] = self.end_column if self.source_map_url is not None: json['sourceMapURL'] = self.source_map_url if self.owner_node is not None: @@ -248,9 +270,13 @@ def from_json(cls, json: T_JSON_DICT) -> CSSStyleSheetHeader: title=str(json['title']), disabled=bool(json['disabled']), is_inline=bool(json['isInline']), + is_mutable=bool(json['isMutable']), + is_constructed=bool(json['isConstructed']), start_line=float(json['startLine']), start_column=float(json['startColumn']), length=float(json['length']), + end_line=float(json['endLine']), + end_column=float(json['endColumn']), source_map_url=str(json['sourceMapURL']) if 'sourceMapURL' in json else None, owner_node=dom.BackendNodeId.from_json(json['ownerNode']) if 'ownerNode' in json else None, has_source_url=bool(json['hasSourceURL']) if 'hasSourceURL' in json else None, @@ -259,7 +285,7 @@ def from_json(cls, json: T_JSON_DICT) -> CSSStyleSheetHeader: @dataclass class CSSRule: - ''' + r''' CSS rule representation. ''' #: Rule selector data. @@ -279,6 +305,10 @@ class CSSRule: #: starting with the innermost one, going outwards. media: typing.Optional[typing.List[CSSMedia]] = None + #: Container query list array (for rules involving container queries). + #: The array enumerates container queries starting with the innermost one, going outwards. + container_queries: typing.Optional[typing.List[CSSContainerQuery]] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['selectorList'] = self.selector_list.to_json() @@ -288,6 +318,8 @@ def to_json(self) -> T_JSON_DICT: json['styleSheetId'] = self.style_sheet_id.to_json() if self.media is not None: json['media'] = [i.to_json() for i in self.media] + if self.container_queries is not None: + json['containerQueries'] = [i.to_json() for i in self.container_queries] return json @classmethod @@ -298,12 +330,13 @@ def from_json(cls, json: T_JSON_DICT) -> CSSRule: style=CSSStyle.from_json(json['style']), style_sheet_id=StyleSheetId.from_json(json['styleSheetId']) if 'styleSheetId' in json else None, media=[CSSMedia.from_json(i) for i in json['media']] if 'media' in json else None, + container_queries=[CSSContainerQuery.from_json(i) for i in json['containerQueries']] if 'containerQueries' in json else None, ) @dataclass class RuleUsage: - ''' + r''' CSS coverage information. ''' #: The css style sheet identifier (absent for user agent stylesheet and user-specified @@ -339,7 +372,7 @@ def from_json(cls, json: T_JSON_DICT) -> RuleUsage: @dataclass class SourceRange: - ''' + r''' Text range within a resource. All numbers are zero-based. ''' #: Start line of range. @@ -424,7 +457,7 @@ def from_json(cls, json: T_JSON_DICT) -> CSSComputedStyleProperty: @dataclass class CSSStyle: - ''' + r''' CSS style representation. ''' #: CSS properties in the style. @@ -468,7 +501,7 @@ def from_json(cls, json: T_JSON_DICT) -> CSSStyle: @dataclass class CSSProperty: - ''' + r''' CSS property declaration data. ''' #: The property name. @@ -529,7 +562,7 @@ def from_json(cls, json: T_JSON_DICT) -> CSSProperty: @dataclass class CSSMedia: - ''' + r''' CSS media rule descriptor. ''' #: Media query text. @@ -582,7 +615,7 @@ def from_json(cls, json: T_JSON_DICT) -> CSSMedia: @dataclass class MediaQuery: - ''' + r''' Media query descriptor. ''' #: Array of media query expressions. @@ -607,7 +640,7 @@ def from_json(cls, json: T_JSON_DICT) -> MediaQuery: @dataclass class MediaQueryExpression: - ''' + r''' Media query expression descriptor. ''' #: Media query expression value. @@ -648,8 +681,47 @@ def from_json(cls, json: T_JSON_DICT) -> MediaQueryExpression: @dataclass -class PlatformFontUsage: +class CSSContainerQuery: + r''' + CSS container query rule descriptor. ''' + #: Container query text. + text: str + + #: The associated rule header range in the enclosing stylesheet (if + #: available). + range_: typing.Optional[SourceRange] = None + + #: Identifier of the stylesheet containing this object (if exists). + style_sheet_id: typing.Optional[StyleSheetId] = None + + #: Optional name for the container. + name: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['text'] = self.text + if self.range_ is not None: + json['range'] = self.range_.to_json() + if self.style_sheet_id is not None: + json['styleSheetId'] = self.style_sheet_id.to_json() + if self.name is not None: + json['name'] = self.name + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CSSContainerQuery: + return cls( + text=str(json['text']), + range_=SourceRange.from_json(json['range']) if 'range' in json else None, + style_sheet_id=StyleSheetId.from_json(json['styleSheetId']) if 'styleSheetId' in json else None, + name=str(json['name']) if 'name' in json else None, + ) + + +@dataclass +class PlatformFontUsage: + r''' Information about amount of glyphs that were rendered with given font. ''' #: Font's family name reported by platform. @@ -678,9 +750,50 @@ def from_json(cls, json: T_JSON_DICT) -> PlatformFontUsage: @dataclass -class FontFace: +class FontVariationAxis: + r''' + Information about font variation axes for variable fonts ''' + #: The font-variation-setting tag (a.k.a. "axis tag"). + tag: str + + #: Human-readable variation name in the default language (normally, "en"). + name: str + + #: The minimum value (inclusive) the font supports for this tag. + min_value: float + + #: The maximum value (inclusive) the font supports for this tag. + max_value: float + + #: The default value. + default_value: float + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['tag'] = self.tag + json['name'] = self.name + json['minValue'] = self.min_value + json['maxValue'] = self.max_value + json['defaultValue'] = self.default_value + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> FontVariationAxis: + return cls( + tag=str(json['tag']), + name=str(json['name']), + min_value=float(json['minValue']), + max_value=float(json['maxValue']), + default_value=float(json['defaultValue']), + ) + + +@dataclass +class FontFace: + r''' 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. ''' #: The font-family. font_family: str @@ -706,6 +819,9 @@ class FontFace: #: The resolved platform font family platform_font_family: str + #: Available variation settings (a.k.a. "axes"). + font_variation_axes: typing.Optional[typing.List[FontVariationAxis]] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['fontFamily'] = self.font_family @@ -716,6 +832,8 @@ def to_json(self) -> T_JSON_DICT: json['unicodeRange'] = self.unicode_range json['src'] = self.src json['platformFontFamily'] = self.platform_font_family + if self.font_variation_axes is not None: + json['fontVariationAxes'] = [i.to_json() for i in self.font_variation_axes] return json @classmethod @@ -729,12 +847,13 @@ def from_json(cls, json: T_JSON_DICT) -> FontFace: unicode_range=str(json['unicodeRange']), src=str(json['src']), platform_font_family=str(json['platformFontFamily']), + font_variation_axes=[FontVariationAxis.from_json(i) for i in json['fontVariationAxes']] if 'fontVariationAxes' in json else None, ) @dataclass class CSSKeyframesRule: - ''' + r''' CSS keyframes rule representation. ''' #: Animation name. @@ -759,7 +878,7 @@ def from_json(cls, json: T_JSON_DICT) -> CSSKeyframesRule: @dataclass class CSSKeyframeRule: - ''' + r''' CSS keyframe rule representation. ''' #: Parent stylesheet's origin. @@ -796,7 +915,7 @@ def from_json(cls, json: T_JSON_DICT) -> CSSKeyframeRule: @dataclass class StyleDeclarationEdit: - ''' + r''' A descriptor of operation to mutate style declaration text. ''' #: The css style sheet identifier. @@ -829,7 +948,7 @@ def add_rule( rule_text: str, location: SourceRange ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSRule]: - ''' + r''' Inserts a new rule with the given ``ruleText`` in a stylesheet with given ``styleSheetId``, at the position specified by ``location``. @@ -853,7 +972,7 @@ def add_rule( def collect_class_names( style_sheet_id: StyleSheetId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Returns all class names from specified stylesheet. :param style_sheet_id: @@ -872,7 +991,7 @@ def collect_class_names( def create_style_sheet( frame_id: page.FrameId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,StyleSheetId]: - ''' + r''' Creates a new special "via-inspector" stylesheet in the frame with given ``frameId``. :param frame_id: Identifier of the frame where "via-inspector" stylesheet should be created. @@ -889,7 +1008,7 @@ def create_style_sheet( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables the CSS agent for the given page. ''' cmd_dict: T_JSON_DICT = { @@ -899,7 +1018,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' 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. ''' @@ -913,7 +1032,7 @@ def force_pseudo_state( node_id: dom.NodeId, forced_pseudo_classes: typing.List[str] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser. @@ -933,7 +1052,7 @@ def force_pseudo_state( def get_background_colors( node_id: dom.NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[typing.List[str]], typing.Optional[str], typing.Optional[str]]]: - ''' + r''' :param node_id: Id of the node to get background colors for. :returns: A tuple with the following items: @@ -958,7 +1077,7 @@ def get_background_colors( def get_computed_style_for_node( node_id: dom.NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[CSSComputedStyleProperty]]: - ''' + r''' Returns the computed style for a DOM node identified by ``nodeId``. :param node_id: @@ -977,7 +1096,7 @@ def get_computed_style_for_node( def get_inline_styles_for_node( node_id: dom.NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[CSSStyle], typing.Optional[CSSStyle]]]: - ''' + r''' Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by ``nodeId``. @@ -1003,7 +1122,7 @@ def get_inline_styles_for_node( def get_matched_styles_for_node( node_id: dom.NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[CSSStyle], typing.Optional[CSSStyle], typing.Optional[typing.List[RuleMatch]], typing.Optional[typing.List[PseudoElementMatches]], typing.Optional[typing.List[InheritedStyleEntry]], typing.Optional[typing.List[CSSKeyframesRule]]]]: - ''' + r''' Returns requested styles for a DOM node identified by ``nodeId``. :param node_id: @@ -1034,7 +1153,7 @@ def get_matched_styles_for_node( def get_media_queries() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[CSSMedia]]: - ''' + r''' Returns all media queries parsed by the rendering engine. :returns: @@ -1049,7 +1168,7 @@ def get_media_queries() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[ def get_platform_fonts_for_node( node_id: dom.NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[PlatformFontUsage]]: - ''' + r''' Requests information about platform fonts which we used to render child TextNodes in the given node. @@ -1069,7 +1188,7 @@ def get_platform_fonts_for_node( def get_style_sheet_text( style_sheet_id: StyleSheetId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Returns the current textual content for a stylesheet. :param style_sheet_id: @@ -1085,12 +1204,51 @@ def get_style_sheet_text( return str(json['text']) +def track_computed_style_updates( + properties_to_track: typing.List[CSSComputedStyleProperty] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + 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** + + :param properties_to_track: + ''' + params: T_JSON_DICT = dict() + params['propertiesToTrack'] = [i.to_json() for i in properties_to_track] + cmd_dict: T_JSON_DICT = { + 'method': 'CSS.trackComputedStyleUpdates', + 'params': params, + } + json = yield cmd_dict + + +def take_computed_style_updates() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[dom.NodeId]]: + r''' + Polls the next batch of computed style updates. + + **EXPERIMENTAL** + + :returns: The list of node Ids that have their tracked computed styles updated + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'CSS.takeComputedStyleUpdates', + } + json = yield cmd_dict + return [dom.NodeId.from_json(i) for i in json['nodeIds']] + + def set_effective_property_value_for_node( node_id: dom.NodeId, property_name: str, value: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Find a rule with the given active property for the given node and set the new value for this property @@ -1114,7 +1272,7 @@ def set_keyframe_key( range_: SourceRange, key_text: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Value]: - ''' + r''' Modifies the keyframe rule key text. :param style_sheet_id: @@ -1139,7 +1297,7 @@ def set_media_text( range_: SourceRange, text: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSMedia]: - ''' + r''' Modifies the rule selector. :param style_sheet_id: @@ -1159,12 +1317,39 @@ def set_media_text( return CSSMedia.from_json(json['media']) +def set_container_query_text( + style_sheet_id: StyleSheetId, + range_: SourceRange, + text: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSContainerQuery]: + r''' + Modifies the expression of a container query. + + **EXPERIMENTAL** + + :param style_sheet_id: + :param range_: + :param text: + :returns: The resulting CSS container query rule after modification. + ''' + params: T_JSON_DICT = dict() + params['styleSheetId'] = style_sheet_id.to_json() + params['range'] = range_.to_json() + params['text'] = text + cmd_dict: T_JSON_DICT = { + 'method': 'CSS.setContainerQueryText', + 'params': params, + } + json = yield cmd_dict + return CSSContainerQuery.from_json(json['containerQuery']) + + def set_rule_selector( style_sheet_id: StyleSheetId, range_: SourceRange, selector: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SelectorList]: - ''' + r''' Modifies the rule selector. :param style_sheet_id: @@ -1188,7 +1373,7 @@ def set_style_sheet_text( style_sheet_id: StyleSheetId, text: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Optional[str]]: - ''' + r''' Sets the new stylesheet text. :param style_sheet_id: @@ -1209,7 +1394,7 @@ def set_style_sheet_text( def set_style_texts( edits: typing.List[StyleDeclarationEdit] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[CSSStyle]]: - ''' + r''' Applies specified style edits one after another in the given order. :param edits: @@ -1226,7 +1411,7 @@ def set_style_texts( def start_rule_usage_tracking() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables the selector recording. ''' cmd_dict: T_JSON_DICT = { @@ -1236,7 +1421,7 @@ def start_rule_usage_tracking() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None def stop_rule_usage_tracking() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[RuleUsage]]: - ''' + r''' Stop tracking rule usage and return the list of rules that were used since last call to ``takeCoverageDelta`` (or since start of coverage instrumentation) @@ -1249,24 +1434,49 @@ def stop_rule_usage_tracking() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typin return [RuleUsage.from_json(i) for i in json['ruleUsage']] -def take_coverage_delta() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[RuleUsage]]: - ''' +def take_coverage_delta() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[RuleUsage], float]]: + r''' Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation) - :returns: + :returns: A tuple with the following items: + + 0. **coverage** - + 1. **timestamp** - Monotonically increasing time, in seconds. ''' cmd_dict: T_JSON_DICT = { 'method': 'CSS.takeCoverageDelta', } json = yield cmd_dict - return [RuleUsage.from_json(i) for i in json['coverage']] + return ( + [RuleUsage.from_json(i) for i in json['coverage']], + float(json['timestamp']) + ) + + +def set_local_fonts_enabled( + enabled: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Enables/disables rendering of local CSS fonts (enabled by default). + + **EXPERIMENTAL** + + :param enabled: Whether rendering of local fonts is enabled. + ''' + params: T_JSON_DICT = dict() + params['enabled'] = enabled + cmd_dict: T_JSON_DICT = { + 'method': 'CSS.setLocalFontsEnabled', + 'params': params, + } + json = yield cmd_dict @event_class('CSS.fontsUpdated') @dataclass class FontsUpdated: - ''' + r''' Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded web font ''' @@ -1283,7 +1493,7 @@ def from_json(cls, json: T_JSON_DICT) -> FontsUpdated: @event_class('CSS.mediaQueryResultChanged') @dataclass class MediaQueryResultChanged: - ''' + r''' Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features. ''' @@ -1299,7 +1509,7 @@ def from_json(cls, json: T_JSON_DICT) -> MediaQueryResultChanged: @event_class('CSS.styleSheetAdded') @dataclass class StyleSheetAdded: - ''' + r''' Fired whenever an active document stylesheet is added. ''' #: Added stylesheet metainfo. @@ -1315,7 +1525,7 @@ def from_json(cls, json: T_JSON_DICT) -> StyleSheetAdded: @event_class('CSS.styleSheetChanged') @dataclass class StyleSheetChanged: - ''' + r''' Fired whenever a stylesheet is changed as a result of the client operation. ''' style_sheet_id: StyleSheetId @@ -1330,7 +1540,7 @@ def from_json(cls, json: T_JSON_DICT) -> StyleSheetChanged: @event_class('CSS.styleSheetRemoved') @dataclass class StyleSheetRemoved: - ''' + r''' Fired whenever an active document stylesheet is removed. ''' #: Identifier of the removed stylesheet. diff --git a/cdp/database.py b/cdp/database.py index 71dac2c..3b059af 100644 --- a/cdp/database.py +++ b/cdp/database.py @@ -13,7 +13,7 @@ class DatabaseId(str): - ''' + r''' Unique identifier of Database object. ''' def to_json(self) -> str: @@ -29,7 +29,7 @@ def __repr__(self): @dataclass class Database: - ''' + r''' Database object. ''' #: Database ID. @@ -64,7 +64,7 @@ def from_json(cls, json: T_JSON_DICT) -> Database: @dataclass class Error: - ''' + r''' Database error. ''' #: Error message. @@ -88,7 +88,7 @@ def from_json(cls, json: T_JSON_DICT) -> Error: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables database tracking, prevents database events from being sent to the client. ''' cmd_dict: T_JSON_DICT = { @@ -98,7 +98,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables database tracking, database events will now be delivered to the client. ''' cmd_dict: T_JSON_DICT = { @@ -111,7 +111,7 @@ def execute_sql( database_id: DatabaseId, query: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[typing.List[str]], typing.Optional[typing.List[typing.Any]], typing.Optional[Error]]]: - ''' + r''' :param database_id: :param query: :returns: A tuple with the following items: @@ -138,7 +138,7 @@ def execute_sql( def get_database_table_names( database_id: DatabaseId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' :param database_id: :returns: ''' diff --git a/cdp/debugger.py b/cdp/debugger.py index 873d783..f77b073 100644 --- a/cdp/debugger.py +++ b/cdp/debugger.py @@ -12,10 +12,11 @@ import typing from . import runtime +from deprecated.sphinx import deprecated # type: ignore class BreakpointId(str): - ''' + r''' Breakpoint identifier. ''' def to_json(self) -> str: @@ -30,7 +31,7 @@ def __repr__(self): class CallFrameId(str): - ''' + r''' Call frame identifier. ''' def to_json(self) -> str: @@ -46,7 +47,7 @@ def __repr__(self): @dataclass class Location: - ''' + r''' Location in the source code. ''' #: Script identifier as reported in the ``Debugger.scriptParsed``. @@ -77,7 +78,7 @@ def from_json(cls, json: T_JSON_DICT) -> Location: @dataclass class ScriptPosition: - ''' + r''' Location in the source code. ''' line_number: int @@ -99,8 +100,35 @@ def from_json(cls, json: T_JSON_DICT) -> ScriptPosition: @dataclass -class CallFrame: +class LocationRange: + r''' + Location range within one script. ''' + script_id: runtime.ScriptId + + start: ScriptPosition + + end: ScriptPosition + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['scriptId'] = self.script_id.to_json() + json['start'] = self.start.to_json() + json['end'] = self.end.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LocationRange: + return cls( + script_id=runtime.ScriptId.from_json(json['scriptId']), + start=ScriptPosition.from_json(json['start']), + end=ScriptPosition.from_json(json['end']), + ) + + +@dataclass +class CallFrame: + r''' JavaScript call frame. Array of call frames form the call stack. ''' #: Call frame identifier. This identifier is only valid while the virtual machine is paused. @@ -157,7 +185,7 @@ def from_json(cls, json: T_JSON_DICT) -> CallFrame: @dataclass class Scope: - ''' + r''' Scope description. ''' #: Scope type. @@ -201,7 +229,7 @@ def from_json(cls, json: T_JSON_DICT) -> Scope: @dataclass class SearchMatch: - ''' + r''' Search match for resource. ''' #: Line number in resource content. @@ -257,11 +285,52 @@ def from_json(cls, json: T_JSON_DICT) -> BreakLocation: ) +class ScriptLanguage(enum.Enum): + r''' + Enum of possible script languages. + ''' + JAVA_SCRIPT = "JavaScript" + WEB_ASSEMBLY = "WebAssembly" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ScriptLanguage: + return cls(json) + + +@dataclass +class DebugSymbols: + r''' + Debug symbols available for a wasm script. + ''' + #: Type of the debug symbols. + type_: str + + #: URL of the external symbol source. + external_url: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['type'] = self.type_ + if self.external_url is not None: + json['externalURL'] = self.external_url + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DebugSymbols: + return cls( + type_=str(json['type']), + external_url=str(json['externalURL']) if 'externalURL' in json else None, + ) + + def continue_to_location( location: Location, target_call_frames: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Continues execution until specific location is reached. :param location: Location to continue to. @@ -279,7 +348,7 @@ def continue_to_location( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables debugger for given page. ''' cmd_dict: T_JSON_DICT = { @@ -291,11 +360,11 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable( max_scripts_cache_size: typing.Optional[float] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.UniqueDebuggerId]: - ''' + r''' Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - :param max_scripts_cache_size: **(EXPERIMENTAL)** *(Optional)* The maximum size in bytes of collected scripts (not referenced by other heap objects) the debugger can hold. Puts no limit if paramter is omitted. + :param max_scripts_cache_size: **(EXPERIMENTAL)** *(Optional)* The maximum size in bytes of collected scripts (not referenced by other heap objects) the debugger can hold. Puts no limit if parameter is omitted. :returns: Unique identifier of the debugger. ''' params: T_JSON_DICT = dict() @@ -320,7 +389,7 @@ def evaluate_on_call_frame( throw_on_side_effect: typing.Optional[bool] = None, timeout: typing.Optional[runtime.TimeDelta] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[runtime.RemoteObject, typing.Optional[runtime.ExceptionDetails]]]: - ''' + r''' Evaluates expression on a given call frame. :param call_frame_id: Call frame identifier to evaluate on. @@ -370,7 +439,7 @@ def get_possible_breakpoints( end: typing.Optional[Location] = None, restrict_to_function: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[BreakLocation]]: - ''' + r''' Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. @@ -395,12 +464,15 @@ def get_possible_breakpoints( def get_script_source( script_id: runtime.ScriptId - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, typing.Optional[str]]]: + r''' Returns source for the script with given id. :param script_id: Id of the script to get source for. - :returns: Script source. + :returns: A tuple with the following items: + + 0. **scriptSource** - Script source (empty in case of Wasm bytecode). + 1. **bytecode** - *(Optional)* Wasm bytecode. (Encoded as a base64 string when passed over JSON) ''' params: T_JSON_DICT = dict() params['scriptId'] = script_id.to_json() @@ -409,13 +481,38 @@ def get_script_source( 'params': params, } json = yield cmd_dict - return str(json['scriptSource']) + return ( + str(json['scriptSource']), + str(json['bytecode']) if 'bytecode' in json else None + ) + + +@deprecated(version="1.3") +def get_wasm_bytecode( + script_id: runtime.ScriptId + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: + r''' + This command is deprecated. Use getScriptSource instead. + + .. deprecated:: 1.3 + + :param script_id: Id of the Wasm script to get source for. + :returns: Script source. (Encoded as a base64 string when passed over JSON) + ''' + params: T_JSON_DICT = dict() + params['scriptId'] = script_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Debugger.getWasmBytecode', + 'params': params, + } + json = yield cmd_dict + return str(json['bytecode']) def get_stack_trace( stack_trace_id: runtime.StackTraceId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.StackTrace]: - ''' + r''' Returns stack trace with given ``stackTraceId``. **EXPERIMENTAL** @@ -434,7 +531,7 @@ def get_stack_trace( def pause() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Stops on the next JavaScript statement. ''' cmd_dict: T_JSON_DICT = { @@ -443,11 +540,14 @@ def pause() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict +@deprecated(version="1.3") def pause_on_async_call( parent_stack_trace_id: runtime.StackTraceId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' + + .. deprecated:: 1.3 **EXPERIMENTAL** @@ -465,7 +565,7 @@ def pause_on_async_call( def remove_breakpoint( breakpoint_id: BreakpointId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes JavaScript breakpoint. :param breakpoint_id: @@ -479,12 +579,15 @@ def remove_breakpoint( json = yield cmd_dict +@deprecated(version="1.3") def restart_frame( call_frame_id: CallFrameId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[CallFrame], typing.Optional[runtime.StackTrace], typing.Optional[runtime.StackTraceId]]]: - ''' + r''' Restarts particular call frame from the beginning. + .. deprecated:: 1.3 + :param call_frame_id: Call frame identifier to evaluate on. :returns: A tuple with the following items: @@ -506,12 +609,20 @@ def restart_frame( ) -def resume() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' +def resume( + terminate_on_resume: typing.Optional[bool] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Resumes JavaScript execution. + + :param terminate_on_resume: *(Optional)* Set to true to terminate execution upon resuming execution. In contrast to Runtime.terminateExecution, this will allows to execute further JavaScript (i.e. via evaluation) until execution of the paused code is actually resumed, at which point termination is triggered. If execution is currently not paused, this parameter has no effect. ''' + params: T_JSON_DICT = dict() + if terminate_on_resume is not None: + params['terminateOnResume'] = terminate_on_resume cmd_dict: T_JSON_DICT = { 'method': 'Debugger.resume', + 'params': params, } json = yield cmd_dict @@ -522,7 +633,7 @@ def search_in_content( case_sensitive: typing.Optional[bool] = None, is_regex: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[SearchMatch]]: - ''' + r''' Searches for given string in script content. :param script_id: Id of the script to search in. @@ -549,7 +660,7 @@ def search_in_content( def set_async_call_stack_depth( max_depth: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables or disables async call stacks tracking. :param max_depth: Maximum depth of async call stacks. Setting to ```0``` will effectively disable collecting async call stacks (default). @@ -566,7 +677,7 @@ def set_async_call_stack_depth( def set_blackbox_patterns( patterns: typing.List[str] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. @@ -588,7 +699,7 @@ def set_blackboxed_ranges( script_id: runtime.ScriptId, positions: typing.List[ScriptPosition] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't @@ -613,7 +724,7 @@ def set_breakpoint( location: Location, condition: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[BreakpointId, Location]]: - ''' + r''' Sets JavaScript breakpoint at a given location. :param location: Location to set breakpoint in. @@ -641,7 +752,7 @@ def set_breakpoint( def set_instrumentation_breakpoint( instrumentation: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,BreakpointId]: - ''' + r''' Sets instrumentation breakpoint. :param instrumentation: Instrumentation name. @@ -665,7 +776,7 @@ def set_breakpoint_by_url( column_number: typing.Optional[int] = None, condition: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[BreakpointId, typing.List[Location]]]: - ''' + r''' Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in ``locations`` property. Further matching script parsing will result in subsequent @@ -709,7 +820,7 @@ def set_breakpoint_on_function_call( object_id: runtime.RemoteObjectId, condition: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,BreakpointId]: - ''' + r''' Sets JavaScript breakpoint before each call to the given function. If another function was created from the same source as a given one, calling it will also trigger the breakpoint. @@ -735,7 +846,7 @@ def set_breakpoint_on_function_call( def set_breakpoints_active( active: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Activates / deactivates all breakpoints on the page. :param active: New value for breakpoints active state. @@ -752,7 +863,7 @@ def set_breakpoints_active( def set_pause_on_exceptions( state: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is ``none``. @@ -770,7 +881,7 @@ def set_pause_on_exceptions( def set_return_value( new_value: runtime.CallArgument ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Changes return value in top frame. Available only at return break position. **EXPERIMENTAL** @@ -791,7 +902,7 @@ def set_script_source( script_source: str, dry_run: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[typing.List[CallFrame]], typing.Optional[bool], typing.Optional[runtime.StackTrace], typing.Optional[runtime.StackTraceId], typing.Optional[runtime.ExceptionDetails]]]: - ''' + r''' Edits JavaScript source live. :param script_id: Id of the script to edit. @@ -827,7 +938,7 @@ def set_script_source( def set_skip_all_pauses( skip: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). :param skip: New value for skip pauses state. @@ -847,7 +958,7 @@ def set_variable_value( new_value: runtime.CallArgument, call_frame_id: CallFrameId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. @@ -869,16 +980,20 @@ def set_variable_value( def step_into( - break_on_async_call: typing.Optional[bool] = None + break_on_async_call: typing.Optional[bool] = None, + skip_list: typing.Optional[typing.List[LocationRange]] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Steps into the function call. - :param break_on_async_call: **(EXPERIMENTAL)** *(Optional)* Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. + :param break_on_async_call: **(EXPERIMENTAL)** *(Optional)* Debugger will pause on the execution of the first async task which was scheduled before next pause. + :param skip_list: **(EXPERIMENTAL)** *(Optional)* The skipList specifies location ranges that should be skipped on step into. ''' params: T_JSON_DICT = dict() if break_on_async_call is not None: params['breakOnAsyncCall'] = break_on_async_call + if skip_list is not None: + params['skipList'] = [i.to_json() for i in skip_list] cmd_dict: T_JSON_DICT = { 'method': 'Debugger.stepInto', 'params': params, @@ -887,7 +1002,7 @@ def step_into( def step_out() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Steps out of the function call. ''' cmd_dict: T_JSON_DICT = { @@ -896,12 +1011,20 @@ def step_out() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict -def step_over() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' +def step_over( + skip_list: typing.Optional[typing.List[LocationRange]] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Steps over the statement. + + :param skip_list: **(EXPERIMENTAL)** *(Optional)* The skipList specifies location ranges that should be skipped on step over. ''' + params: T_JSON_DICT = dict() + if skip_list is not None: + params['skipList'] = [i.to_json() for i in skip_list] cmd_dict: T_JSON_DICT = { 'method': 'Debugger.stepOver', + 'params': params, } json = yield cmd_dict @@ -909,7 +1032,7 @@ def step_over() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: @event_class('Debugger.breakpointResolved') @dataclass class BreakpointResolved: - ''' + r''' Fired when breakpoint is resolved to an actual script and location. ''' #: Breakpoint unique identifier. @@ -928,7 +1051,7 @@ def from_json(cls, json: T_JSON_DICT) -> BreakpointResolved: @event_class('Debugger.paused') @dataclass class Paused: - ''' + r''' Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. ''' #: Call stack the virtual machine stopped on. @@ -943,8 +1066,7 @@ class Paused: async_stack_trace: typing.Optional[runtime.StackTrace] #: Async stack trace, if any. async_stack_trace_id: typing.Optional[runtime.StackTraceId] - #: Just scheduled async call will have this stack trace as parent stack during async execution. - #: This field is available only after ``Debugger.stepInto`` call with ``breakOnAsynCall`` flag. + #: Never present, will be removed. async_call_stack_trace_id: typing.Optional[runtime.StackTraceId] @classmethod @@ -963,7 +1085,7 @@ def from_json(cls, json: T_JSON_DICT) -> Paused: @event_class('Debugger.resumed') @dataclass class Resumed: - ''' + r''' Fired when the virtual machine resumed execution. ''' @@ -978,7 +1100,7 @@ def from_json(cls, json: T_JSON_DICT) -> Resumed: @event_class('Debugger.scriptFailedToParse') @dataclass class ScriptFailedToParse: - ''' + r''' Fired when virtual machine fails to parse the script. ''' #: Identifier of the script parsed. @@ -1009,6 +1131,12 @@ class ScriptFailedToParse: length: typing.Optional[int] #: JavaScript top stack frame of where the script parsed event was triggered if available. stack_trace: typing.Optional[runtime.StackTrace] + #: If the scriptLanguage is WebAssembly, the code section offset in the module. + code_offset: typing.Optional[int] + #: The language of the script. + script_language: typing.Optional[debugger.ScriptLanguage] + #: The name the embedder supplied for this script. + embedder_name: typing.Optional[str] @classmethod def from_json(cls, json: T_JSON_DICT) -> ScriptFailedToParse: @@ -1026,14 +1154,17 @@ def from_json(cls, json: T_JSON_DICT) -> ScriptFailedToParse: has_source_url=bool(json['hasSourceURL']) if 'hasSourceURL' in json else None, is_module=bool(json['isModule']) if 'isModule' in json else None, length=int(json['length']) if 'length' in json else None, - stack_trace=runtime.StackTrace.from_json(json['stackTrace']) if 'stackTrace' in json else None + stack_trace=runtime.StackTrace.from_json(json['stackTrace']) if 'stackTrace' in json else None, + code_offset=int(json['codeOffset']) if 'codeOffset' in json else None, + script_language=debugger.ScriptLanguage.from_json(json['scriptLanguage']) if 'scriptLanguage' in json else None, + embedder_name=str(json['embedderName']) if 'embedderName' in json else None ) @event_class('Debugger.scriptParsed') @dataclass class ScriptParsed: - ''' + r''' Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. ''' @@ -1067,6 +1198,14 @@ class ScriptParsed: length: typing.Optional[int] #: JavaScript top stack frame of where the script parsed event was triggered if available. stack_trace: typing.Optional[runtime.StackTrace] + #: If the scriptLanguage is WebAssembly, the code section offset in the module. + code_offset: typing.Optional[int] + #: The language of the script. + script_language: typing.Optional[debugger.ScriptLanguage] + #: If the scriptLanguage is WebASsembly, the source of debug symbols for the module. + debug_symbols: typing.Optional[debugger.DebugSymbols] + #: The name the embedder supplied for this script. + embedder_name: typing.Optional[str] @classmethod def from_json(cls, json: T_JSON_DICT) -> ScriptParsed: @@ -1085,5 +1224,9 @@ def from_json(cls, json: T_JSON_DICT) -> ScriptParsed: has_source_url=bool(json['hasSourceURL']) if 'hasSourceURL' in json else None, is_module=bool(json['isModule']) if 'isModule' in json else None, length=int(json['length']) if 'length' in json else None, - stack_trace=runtime.StackTrace.from_json(json['stackTrace']) if 'stackTrace' in json else None + stack_trace=runtime.StackTrace.from_json(json['stackTrace']) if 'stackTrace' in json else None, + code_offset=int(json['codeOffset']) if 'codeOffset' in json else None, + script_language=debugger.ScriptLanguage.from_json(json['scriptLanguage']) if 'scriptLanguage' in json else None, + debug_symbols=debugger.DebugSymbols.from_json(json['debugSymbols']) if 'debugSymbols' in json else None, + embedder_name=str(json['embedderName']) if 'embedderName' in json else None ) diff --git a/cdp/device_orientation.py b/cdp/device_orientation.py index 1296997..9d496d4 100644 --- a/cdp/device_orientation.py +++ b/cdp/device_orientation.py @@ -13,7 +13,7 @@ def clear_device_orientation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears the overridden Device Orientation. ''' cmd_dict: T_JSON_DICT = { @@ -27,7 +27,7 @@ def set_device_orientation_override( beta: float, gamma: float ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides the Device Orientation. :param alpha: Mock alpha diff --git a/cdp/dom.py b/cdp/dom.py index 8e03c98..543e0bb 100644 --- a/cdp/dom.py +++ b/cdp/dom.py @@ -13,10 +13,11 @@ from . import page from . import runtime +from deprecated.sphinx import deprecated # type: ignore class NodeId(int): - ''' + r''' Unique DOM node identifier. ''' def to_json(self) -> int: @@ -31,7 +32,7 @@ def __repr__(self): class BackendNodeId(int): - ''' + r''' Unique DOM node identifier used to reference a node that may not have been pushed to the front-end. ''' @@ -48,7 +49,7 @@ def __repr__(self): @dataclass class BackendNode: - ''' + r''' Backend node with a friendly name. ''' #: ``Node``'s nodeType. @@ -76,15 +77,20 @@ def from_json(cls, json: T_JSON_DICT) -> BackendNode: class PseudoType(enum.Enum): - ''' + r''' Pseudo element type. ''' FIRST_LINE = "first-line" FIRST_LETTER = "first-letter" BEFORE = "before" AFTER = "after" + MARKER = "marker" BACKDROP = "backdrop" SELECTION = "selection" + TARGET_TEXT = "target-text" + SPELLING_ERROR = "spelling-error" + GRAMMAR_ERROR = "grammar-error" + HIGHLIGHT = "highlight" FIRST_LINE_INHERITED = "first-line-inherited" SCROLLBAR = "scrollbar" SCROLLBAR_THUMB = "scrollbar-thumb" @@ -94,6 +100,10 @@ class PseudoType(enum.Enum): SCROLLBAR_CORNER = "scrollbar-corner" RESIZER = "resizer" INPUT_LIST_BUTTON = "input-list-button" + TRANSITION = "transition" + TRANSITION_CONTAINER = "transition-container" + TRANSITION_OLD_CONTENT = "transition-old-content" + TRANSITION_NEW_CONTENT = "transition-new-content" def to_json(self) -> str: return self.value @@ -104,7 +114,7 @@ def from_json(cls, json: str) -> PseudoType: class ShadowRootType(enum.Enum): - ''' + r''' Shadow root type. ''' USER_AGENT = "user-agent" @@ -119,9 +129,25 @@ def from_json(cls, json: str) -> ShadowRootType: return cls(json) +class CompatibilityMode(enum.Enum): + r''' + Document compatibility mode. + ''' + QUIRKS_MODE = "QuirksMode" + LIMITED_QUIRKS_MODE = "LimitedQuirksMode" + NO_QUIRKS_MODE = "NoQuirksMode" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CompatibilityMode: + return cls(json) + + @dataclass class Node: - ''' + r''' DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type. ''' @@ -202,7 +228,9 @@ class Node: #: Pseudo elements associated with this node. pseudo_elements: typing.Optional[typing.List[Node]] = None - #: Import document for the HTMLImport links. + #: Deprecated, as the HTML Imports API has been removed (crbug.com/937746). + #: This property used to return the imported document for the HTMLImport links. + #: The property is always undefined now. imported_document: typing.Optional[Node] = None #: Distributed nodes for given insertion point. @@ -211,6 +239,8 @@ class Node: #: Whether the node is SVG. is_svg: typing.Optional[bool] = None + compatibility_mode: typing.Optional[CompatibilityMode] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['nodeId'] = self.node_id.to_json() @@ -263,6 +293,8 @@ def to_json(self) -> T_JSON_DICT: json['distributedNodes'] = [i.to_json() for i in self.distributed_nodes] if self.is_svg is not None: json['isSVG'] = self.is_svg + if self.compatibility_mode is not None: + json['compatibilityMode'] = self.compatibility_mode.to_json() return json @classmethod @@ -296,12 +328,13 @@ def from_json(cls, json: T_JSON_DICT) -> Node: imported_document=Node.from_json(json['importedDocument']) if 'importedDocument' in json else None, distributed_nodes=[BackendNode.from_json(i) for i in json['distributedNodes']] if 'distributedNodes' in json else None, is_svg=bool(json['isSVG']) if 'isSVG' in json else None, + compatibility_mode=CompatibilityMode.from_json(json['compatibilityMode']) if 'compatibilityMode' in json else None, ) @dataclass class RGBA: - ''' + r''' A structure holding an RGBA color. ''' #: The red component, in the [0-255] range. @@ -336,7 +369,7 @@ def from_json(cls, json: T_JSON_DICT) -> RGBA: class Quad(list): - ''' + r''' An array of quad vertices, x immediately followed by y for each point, points clock-wise. ''' def to_json(self) -> typing.List[float]: @@ -352,7 +385,7 @@ def __repr__(self): @dataclass class BoxModel: - ''' + r''' Box model. ''' #: Content box @@ -403,7 +436,7 @@ def from_json(cls, json: T_JSON_DICT) -> BoxModel: @dataclass class ShapeOutsideInfo: - ''' + r''' CSS Shape Outside details. ''' #: Shape bounds @@ -433,7 +466,7 @@ def from_json(cls, json: T_JSON_DICT) -> ShapeOutsideInfo: @dataclass class Rect: - ''' + r''' Rectangle. ''' #: X coordinate @@ -466,10 +499,32 @@ def from_json(cls, json: T_JSON_DICT) -> Rect: ) +@dataclass +class CSSComputedStyleProperty: + #: Computed style property name. + name: str + + #: Computed style property value. + value: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + json['value'] = self.value + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CSSComputedStyleProperty: + return cls( + name=str(json['name']), + value=str(json['value']), + ) + + def collect_class_names_from_subtree( node_id: NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Collects class names for the node with given id and all of it's child nodes. **EXPERIMENTAL** @@ -492,7 +547,7 @@ def copy_to( target_node_id: NodeId, insert_before_node_id: typing.Optional[NodeId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,NodeId]: - ''' + r''' Creates a deep copy of the specified node and places it into the target container before the given anchor. @@ -523,7 +578,7 @@ def describe_node( depth: typing.Optional[int] = None, pierce: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Node]: - ''' + r''' Describes node given its id, does not require domain to be enabled. Does not start tracking any objects, can be used for automation. @@ -553,8 +608,42 @@ def describe_node( return Node.from_json(json['node']) -def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: +def scroll_into_view_if_needed( + node_id: typing.Optional[NodeId] = None, + backend_node_id: typing.Optional[BackendNodeId] = None, + object_id: typing.Optional[runtime.RemoteObjectId] = None, + rect: typing.Optional[Rect] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + 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. + + **EXPERIMENTAL** + + :param node_id: *(Optional)* Identifier of the node. + :param backend_node_id: *(Optional)* Identifier of the backend node. + :param object_id: *(Optional)* JavaScript object id of the node wrapper. + :param 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. ''' + params: T_JSON_DICT = dict() + if node_id is not None: + params['nodeId'] = node_id.to_json() + if backend_node_id is not None: + params['backendNodeId'] = backend_node_id.to_json() + if object_id is not None: + params['objectId'] = object_id.to_json() + if rect is not None: + params['rect'] = rect.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'DOM.scrollIntoViewIfNeeded', + 'params': params, + } + json = yield cmd_dict + + +def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Disables DOM agent for the given page. ''' cmd_dict: T_JSON_DICT = { @@ -566,7 +655,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def discard_search_results( search_id: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Discards search results from the session with the given id. ``getSearchResults`` should no longer be called for that search. @@ -584,7 +673,7 @@ def discard_search_results( def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables DOM agent for the given page. ''' cmd_dict: T_JSON_DICT = { @@ -598,7 +687,7 @@ def focus( backend_node_id: typing.Optional[BackendNodeId] = None, object_id: typing.Optional[runtime.RemoteObjectId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Focuses the given element. :param node_id: *(Optional)* Identifier of the node. @@ -622,7 +711,7 @@ def focus( def get_attributes( node_id: NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Returns attributes for the specified node. :param node_id: Id of the node to retrieve attibutes for. @@ -643,7 +732,7 @@ def get_box_model( backend_node_id: typing.Optional[BackendNodeId] = None, object_id: typing.Optional[runtime.RemoteObjectId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,BoxModel]: - ''' + r''' Returns boxes for the given node. :param node_id: *(Optional)* Identifier of the node. @@ -671,7 +760,7 @@ def get_content_quads( backend_node_id: typing.Optional[BackendNodeId] = None, object_id: typing.Optional[runtime.RemoteObjectId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Quad]]: - ''' + r''' Returns quads that describe node position on the page. This method might return multiple quads for inline nodes. @@ -701,7 +790,7 @@ def get_document( depth: typing.Optional[int] = None, pierce: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Node]: - ''' + r''' Returns the root DOM node (and optionally the subtree) to the caller. :param depth: *(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. @@ -721,12 +810,17 @@ def get_document( return Node.from_json(json['root']) +@deprecated(version="1.3") def get_flattened_document( depth: typing.Optional[int] = None, pierce: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Node]]: - ''' + r''' 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 :param depth: *(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. :param pierce: *(Optional)* Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). @@ -745,30 +839,61 @@ def get_flattened_document( return [Node.from_json(i) for i in json['nodes']] +def get_nodes_for_subtree_by_style( + node_id: NodeId, + computed_styles: typing.List[CSSComputedStyleProperty], + pierce: typing.Optional[bool] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[NodeId]]: + r''' + Finds nodes with a given computed style in a subtree. + + **EXPERIMENTAL** + + :param node_id: Node ID pointing to the root of a subtree. + :param computed_styles: The style to filter nodes by (includes nodes if any of properties matches). + :param pierce: *(Optional)* Whether or not iframes and shadow roots in the same target should be traversed when returning the results (default is false). + :returns: Resulting nodes. + ''' + params: T_JSON_DICT = dict() + params['nodeId'] = node_id.to_json() + params['computedStyles'] = [i.to_json() for i in computed_styles] + if pierce is not None: + params['pierce'] = pierce + cmd_dict: T_JSON_DICT = { + 'method': 'DOM.getNodesForSubtreeByStyle', + 'params': params, + } + json = yield cmd_dict + return [NodeId.from_json(i) for i in json['nodeIds']] + + def get_node_for_location( x: int, y: int, - include_user_agent_shadow_dom: typing.Optional[bool] = None - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[BackendNodeId, typing.Optional[NodeId]]]: - ''' + include_user_agent_shadow_dom: typing.Optional[bool] = None, + ignore_pointer_events_none: typing.Optional[bool] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[BackendNodeId, page.FrameId, typing.Optional[NodeId]]]: + r''' Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is either returned or not. - **EXPERIMENTAL** - :param x: X coordinate. :param y: Y coordinate. :param include_user_agent_shadow_dom: *(Optional)* False to skip to the nearest non-UA shadow root ancestor (default: false). + :param ignore_pointer_events_none: *(Optional)* Whether to ignore pointer-events: none on elements and hit test them. :returns: 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. + 1. **frameId** - Frame this node belongs to. + 2. **nodeId** - *(Optional)* Id of the node at given coordinates, only when enabled and requested document. ''' params: T_JSON_DICT = dict() params['x'] = x params['y'] = y if include_user_agent_shadow_dom is not None: params['includeUserAgentShadowDOM'] = include_user_agent_shadow_dom + if ignore_pointer_events_none is not None: + params['ignorePointerEventsNone'] = ignore_pointer_events_none cmd_dict: T_JSON_DICT = { 'method': 'DOM.getNodeForLocation', 'params': params, @@ -776,6 +901,7 @@ def get_node_for_location( json = yield cmd_dict return ( BackendNodeId.from_json(json['backendNodeId']), + page.FrameId.from_json(json['frameId']), NodeId.from_json(json['nodeId']) if 'nodeId' in json else None ) @@ -785,7 +911,7 @@ def get_outer_html( backend_node_id: typing.Optional[BackendNodeId] = None, object_id: typing.Optional[runtime.RemoteObjectId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Returns node's HTML markup. :param node_id: *(Optional)* Identifier of the node. @@ -811,7 +937,7 @@ def get_outer_html( def get_relayout_boundary( node_id: NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,NodeId]: - ''' + r''' Returns the id of the nearest ancestor that is a relayout boundary. **EXPERIMENTAL** @@ -834,7 +960,7 @@ def get_search_results( from_index: int, to_index: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[NodeId]]: - ''' + r''' Returns search results from given ``fromIndex`` to given ``toIndex`` from the search with the given identifier. @@ -858,7 +984,7 @@ def get_search_results( def hide_highlight() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Hides any highlight. ''' cmd_dict: T_JSON_DICT = { @@ -868,7 +994,7 @@ def hide_highlight() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def highlight_node() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Highlights DOM node. ''' cmd_dict: T_JSON_DICT = { @@ -878,7 +1004,7 @@ def highlight_node() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def highlight_rect() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Highlights given rectangle. ''' cmd_dict: T_JSON_DICT = { @@ -888,7 +1014,7 @@ def highlight_rect() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def mark_undoable_state() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Marks last undoable state. **EXPERIMENTAL** @@ -904,7 +1030,7 @@ def move_to( target_node_id: NodeId, insert_before_node_id: typing.Optional[NodeId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,NodeId]: - ''' + r''' Moves node into the new container, places it before the given anchor. :param node_id: Id of the node to move. @@ -929,7 +1055,7 @@ def perform_search( query: str, include_user_agent_shadow_dom: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, int]]: - ''' + r''' Searches for a given string in the DOM tree. Use ``getSearchResults`` to access search results or ``cancelSearch`` to end this search session. @@ -960,7 +1086,7 @@ def perform_search( def push_node_by_path_to_frontend( path: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,NodeId]: - ''' + r''' Requests that the node is sent to the caller given its path. // FIXME, use XPath **EXPERIMENTAL** @@ -981,7 +1107,7 @@ def push_node_by_path_to_frontend( def push_nodes_by_backend_ids_to_frontend( backend_node_ids: typing.List[BackendNodeId] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[NodeId]]: - ''' + r''' Requests that a batch of nodes is sent to the caller given their backend node ids. **EXPERIMENTAL** @@ -1003,7 +1129,7 @@ def query_selector( node_id: NodeId, selector: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,NodeId]: - ''' + r''' Executes ``querySelector`` on a given node. :param node_id: Id of the node to query upon. @@ -1025,7 +1151,7 @@ def query_selector_all( node_id: NodeId, selector: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[NodeId]]: - ''' + r''' Executes ``querySelectorAll`` on a given node. :param node_id: Id of the node to query upon. @@ -1044,7 +1170,7 @@ def query_selector_all( def redo() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Re-does the last undone action. **EXPERIMENTAL** @@ -1059,7 +1185,7 @@ def remove_attribute( node_id: NodeId, name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes attribute with given name from an element with given id. :param node_id: Id of the element to remove attribute from. @@ -1078,7 +1204,7 @@ def remove_attribute( def remove_node( node_id: NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes node with given id. :param node_id: Id of the node to remove. @@ -1097,7 +1223,7 @@ def request_child_nodes( depth: typing.Optional[int] = None, pierce: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' 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. @@ -1122,7 +1248,7 @@ def request_child_nodes( def request_node( object_id: runtime.RemoteObjectId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,NodeId]: - ''' + r''' 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. @@ -1146,7 +1272,7 @@ def resolve_node( object_group: typing.Optional[str] = None, execution_context_id: typing.Optional[runtime.ExecutionContextId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.RemoteObject]: - ''' + r''' Resolves the JavaScript node object for a given NodeId or BackendNodeId. :param node_id: *(Optional)* Id of the node to resolve. @@ -1177,7 +1303,7 @@ def set_attribute_value( name: str, value: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets attribute for an element with given id. :param node_id: Id of the element to set attribute for. @@ -1200,7 +1326,7 @@ def set_attributes_as_text( text: str, name: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' 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. @@ -1226,7 +1352,7 @@ def set_file_input_files( backend_node_id: typing.Optional[BackendNodeId] = None, object_id: typing.Optional[runtime.RemoteObjectId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets files for the given file input element. :param files: Array of file paths to set. @@ -1249,10 +1375,50 @@ def set_file_input_files( json = yield cmd_dict +def set_node_stack_traces_enabled( + enable: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Sets if stack traces should be captured for Nodes. See ``Node.getNodeStackTraces``. Default is disabled. + + **EXPERIMENTAL** + + :param enable: Enable or disable. + ''' + params: T_JSON_DICT = dict() + params['enable'] = enable + cmd_dict: T_JSON_DICT = { + 'method': 'DOM.setNodeStackTracesEnabled', + 'params': params, + } + json = yield cmd_dict + + +def get_node_stack_traces( + node_id: NodeId + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Optional[runtime.StackTrace]]: + r''' + Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation. + + **EXPERIMENTAL** + + :param node_id: Id of the node to get stack traces for. + :returns: *(Optional)* Creation stack trace, if available. + ''' + params: T_JSON_DICT = dict() + params['nodeId'] = node_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'DOM.getNodeStackTraces', + 'params': params, + } + json = yield cmd_dict + return runtime.StackTrace.from_json(json['creation']) if 'creation' in json else None + + def get_file_info( object_id: runtime.RemoteObjectId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Returns file information for the given File wrapper. @@ -1274,7 +1440,7 @@ def get_file_info( def set_inspected_node( node_id: NodeId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). @@ -1295,7 +1461,7 @@ def set_node_name( node_id: NodeId, name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,NodeId]: - ''' + r''' Sets node name for a node with given id. :param node_id: Id of the node to set name for. @@ -1317,7 +1483,7 @@ def set_node_value( node_id: NodeId, value: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets node value for a node with given id. :param node_id: Id of the node to set value for. @@ -1337,7 +1503,7 @@ def set_outer_html( node_id: NodeId, outer_html: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets node HTML markup, returns new node id. :param node_id: Id of the node to set markup for. @@ -1354,7 +1520,7 @@ def set_outer_html( def undo() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Undoes the last performed action. **EXPERIMENTAL** @@ -1368,7 +1534,7 @@ def undo() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_frame_owner( frame_id: page.FrameId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[BackendNodeId, typing.Optional[NodeId]]]: - ''' + r''' Returns iframe node that owns iframe with the given domain. **EXPERIMENTAL** @@ -1392,10 +1558,59 @@ def get_frame_owner( ) +def get_container_for_node( + node_id: NodeId, + container_name: typing.Optional[str] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Optional[NodeId]]: + r''' + Returns the container of the given node based on container query conditions. + If containerName is given, it will find the nearest container with a matching name; + otherwise it will find the nearest container regardless of its container name. + + **EXPERIMENTAL** + + :param node_id: + :param container_name: *(Optional)* + :returns: *(Optional)* The container node for the given node, or null if not found. + ''' + params: T_JSON_DICT = dict() + params['nodeId'] = node_id.to_json() + if container_name is not None: + params['containerName'] = container_name + cmd_dict: T_JSON_DICT = { + 'method': 'DOM.getContainerForNode', + 'params': params, + } + json = yield cmd_dict + return NodeId.from_json(json['nodeId']) if 'nodeId' in json else None + + +def get_querying_descendants_for_container( + node_id: NodeId + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[NodeId]]: + r''' + Returns the descendants of a container query container that have + container queries against this container. + + **EXPERIMENTAL** + + :param node_id: Id of the container node to find querying descendants from. + :returns: Descendant nodes with container queries against the given container. + ''' + params: T_JSON_DICT = dict() + params['nodeId'] = node_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'DOM.getQueryingDescendantsForContainer', + 'params': params, + } + json = yield cmd_dict + return [NodeId.from_json(i) for i in json['nodeIds']] + + @event_class('DOM.attributeModified') @dataclass class AttributeModified: - ''' + r''' Fired when ``Element``'s attribute is modified. ''' #: Id of the node that has changed. @@ -1417,7 +1632,7 @@ def from_json(cls, json: T_JSON_DICT) -> AttributeModified: @event_class('DOM.attributeRemoved') @dataclass class AttributeRemoved: - ''' + r''' Fired when ``Element``'s attribute is removed. ''' #: Id of the node that has changed. @@ -1436,7 +1651,7 @@ def from_json(cls, json: T_JSON_DICT) -> AttributeRemoved: @event_class('DOM.characterDataModified') @dataclass class CharacterDataModified: - ''' + r''' Mirrors ``DOMCharacterDataModified`` event. ''' #: Id of the node that has changed. @@ -1455,7 +1670,7 @@ def from_json(cls, json: T_JSON_DICT) -> CharacterDataModified: @event_class('DOM.childNodeCountUpdated') @dataclass class ChildNodeCountUpdated: - ''' + r''' Fired when ``Container``'s child node count has changed. ''' #: Id of the node that has changed. @@ -1474,7 +1689,7 @@ def from_json(cls, json: T_JSON_DICT) -> ChildNodeCountUpdated: @event_class('DOM.childNodeInserted') @dataclass class ChildNodeInserted: - ''' + r''' Mirrors ``DOMNodeInserted`` event. ''' #: Id of the node that has changed. @@ -1496,7 +1711,7 @@ def from_json(cls, json: T_JSON_DICT) -> ChildNodeInserted: @event_class('DOM.childNodeRemoved') @dataclass class ChildNodeRemoved: - ''' + r''' Mirrors ``DOMNodeRemoved`` event. ''' #: Parent id. @@ -1515,12 +1730,12 @@ def from_json(cls, json: T_JSON_DICT) -> ChildNodeRemoved: @event_class('DOM.distributedNodesUpdated') @dataclass class DistributedNodesUpdated: - ''' + r''' **EXPERIMENTAL** - Called when distrubution is changed. + Called when distribution is changed. ''' - #: Insertion point where distrubuted nodes were updated. + #: Insertion point where distributed nodes were updated. insertion_point_id: NodeId #: Distributed nodes for given insertion point. distributed_nodes: typing.List[BackendNode] @@ -1536,7 +1751,7 @@ def from_json(cls, json: T_JSON_DICT) -> DistributedNodesUpdated: @event_class('DOM.documentUpdated') @dataclass class DocumentUpdated: - ''' + r''' Fired when ``Document`` has been totally updated. Node ids are no longer valid. ''' @@ -1551,7 +1766,7 @@ def from_json(cls, json: T_JSON_DICT) -> DocumentUpdated: @event_class('DOM.inlineStyleInvalidated') @dataclass class InlineStyleInvalidated: - ''' + r''' **EXPERIMENTAL** Fired when ``Element``'s inline style is modified via a CSS property modification. @@ -1569,7 +1784,7 @@ def from_json(cls, json: T_JSON_DICT) -> InlineStyleInvalidated: @event_class('DOM.pseudoElementAdded') @dataclass class PseudoElementAdded: - ''' + r''' **EXPERIMENTAL** Called when a pseudo element is added to an element. @@ -1590,7 +1805,7 @@ def from_json(cls, json: T_JSON_DICT) -> PseudoElementAdded: @event_class('DOM.pseudoElementRemoved') @dataclass class PseudoElementRemoved: - ''' + r''' **EXPERIMENTAL** Called when a pseudo element is removed from an element. @@ -1611,7 +1826,7 @@ def from_json(cls, json: T_JSON_DICT) -> PseudoElementRemoved: @event_class('DOM.setChildNodes') @dataclass class SetChildNodes: - ''' + r''' Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids. ''' @@ -1631,7 +1846,7 @@ def from_json(cls, json: T_JSON_DICT) -> SetChildNodes: @event_class('DOM.shadowRootPopped') @dataclass class ShadowRootPopped: - ''' + r''' **EXPERIMENTAL** Called when shadow root is popped from the element. @@ -1652,7 +1867,7 @@ def from_json(cls, json: T_JSON_DICT) -> ShadowRootPopped: @event_class('DOM.shadowRootPushed') @dataclass class ShadowRootPushed: - ''' + r''' **EXPERIMENTAL** Called when shadow root is pushed into the element. diff --git a/cdp/dom_debugger.py b/cdp/dom_debugger.py index 0b09a58..8b3d5f4 100644 --- a/cdp/dom_debugger.py +++ b/cdp/dom_debugger.py @@ -16,7 +16,7 @@ class DOMBreakpointType(enum.Enum): - ''' + r''' DOM breakpoint type. ''' SUBTREE_MODIFIED = "subtree-modified" @@ -31,9 +31,24 @@ def from_json(cls, json: str) -> DOMBreakpointType: return cls(json) +class CSPViolationType(enum.Enum): + r''' + CSP Violation type. + ''' + TRUSTEDTYPE_SINK_VIOLATION = "trustedtype-sink-violation" + TRUSTEDTYPE_POLICY_VIOLATION = "trustedtype-policy-violation" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CSPViolationType: + return cls(json) + + @dataclass class EventListener: - ''' + r''' Object event listener. ''' #: ``EventListener``'s type. @@ -104,7 +119,7 @@ def get_event_listeners( depth: typing.Optional[int] = None, pierce: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[EventListener]]: - ''' + r''' Returns event listeners of the given object. :param object_id: Identifier of the object to return listeners for. @@ -130,7 +145,7 @@ def remove_dom_breakpoint( node_id: dom.NodeId, type_: DOMBreakpointType ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes DOM breakpoint that was set using ``setDOMBreakpoint``. :param node_id: Identifier of the node to remove breakpoint from. @@ -150,7 +165,7 @@ def remove_event_listener_breakpoint( event_name: str, target_name: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes breakpoint on particular DOM event. :param event_name: Event name. @@ -170,7 +185,7 @@ def remove_event_listener_breakpoint( def remove_instrumentation_breakpoint( event_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes breakpoint on particular native event. **EXPERIMENTAL** @@ -189,7 +204,7 @@ def remove_instrumentation_breakpoint( def remove_xhr_breakpoint( url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes breakpoint from XMLHttpRequest. :param url: Resource URL substring. @@ -203,11 +218,30 @@ def remove_xhr_breakpoint( json = yield cmd_dict +def set_break_on_csp_violation( + violation_types: typing.List[CSPViolationType] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Sets breakpoint on particular CSP violations. + + **EXPERIMENTAL** + + :param violation_types: CSP Violations to stop upon. + ''' + params: T_JSON_DICT = dict() + params['violationTypes'] = [i.to_json() for i in violation_types] + cmd_dict: T_JSON_DICT = { + 'method': 'DOMDebugger.setBreakOnCSPViolation', + 'params': params, + } + json = yield cmd_dict + + def set_dom_breakpoint( node_id: dom.NodeId, type_: DOMBreakpointType ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets breakpoint on particular operation with DOM. :param node_id: Identifier of the node to set breakpoint on. @@ -227,7 +261,7 @@ def set_event_listener_breakpoint( event_name: str, target_name: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets breakpoint on particular DOM event. :param event_name: DOM Event name to stop on (any DOM event will do). @@ -247,7 +281,7 @@ def set_event_listener_breakpoint( def set_instrumentation_breakpoint( event_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets breakpoint on particular native event. **EXPERIMENTAL** @@ -266,7 +300,7 @@ def set_instrumentation_breakpoint( def set_xhr_breakpoint( url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets breakpoint on XMLHttpRequest. :param url: Resource URL substring. All XHRs having this substring in the URL will get stopped upon. diff --git a/cdp/dom_snapshot.py b/cdp/dom_snapshot.py index fa63767..013204c 100644 --- a/cdp/dom_snapshot.py +++ b/cdp/dom_snapshot.py @@ -19,7 +19,7 @@ @dataclass class DOMNode: - ''' + r''' A Node in the DOM tree. ''' #: ``Node``'s nodeType. @@ -203,7 +203,7 @@ def from_json(cls, json: T_JSON_DICT) -> DOMNode: @dataclass class InlineTextBox: - ''' + r''' Details of post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions. ''' @@ -236,7 +236,7 @@ def from_json(cls, json: T_JSON_DICT) -> InlineTextBox: @dataclass class LayoutTreeNode: - ''' + r''' Details of an element in the DOM tree with a LayoutObject. ''' #: The index of the related DOM node in the ``domNodes`` array returned by ``getSnapshot``. @@ -293,7 +293,7 @@ def from_json(cls, json: T_JSON_DICT) -> LayoutTreeNode: @dataclass class ComputedStyle: - ''' + r''' A subset of the full ComputedStyle as defined by the request whitelist. ''' #: Name/value pairs of computed style properties. @@ -313,7 +313,7 @@ def from_json(cls, json: T_JSON_DICT) -> ComputedStyle: @dataclass class NameValue: - ''' + r''' A name/value pair. ''' #: Attribute/property name. @@ -337,7 +337,7 @@ def from_json(cls, json: T_JSON_DICT) -> NameValue: class StringIndex(int): - ''' + r''' Index of the string in the strings table. ''' def to_json(self) -> int: @@ -352,7 +352,7 @@ def __repr__(self): class ArrayOfStrings(list): - ''' + r''' Index of the string in the strings table. ''' def to_json(self) -> typing.List[StringIndex]: @@ -368,7 +368,7 @@ def __repr__(self): @dataclass class RareStringData: - ''' + r''' Data that is only present on rare nodes. ''' index: typing.List[int] @@ -439,12 +439,15 @@ def __repr__(self): @dataclass class DocumentSnapshot: - ''' + r''' Document snapshot. ''' #: Document URL that ``Document`` or ``FrameOwner`` node points to. document_url: StringIndex + #: Document title. + title: StringIndex + #: Base URL that ``Document`` or ``FrameOwner`` node uses for URL completion. base_url: StringIndex @@ -478,9 +481,16 @@ class DocumentSnapshot: #: Vertical scroll offset. scroll_offset_y: typing.Optional[float] = None + #: Document content width. + content_width: typing.Optional[float] = None + + #: Document content height. + content_height: typing.Optional[float] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['documentURL'] = self.document_url.to_json() + json['title'] = self.title.to_json() json['baseURL'] = self.base_url.to_json() json['contentLanguage'] = self.content_language.to_json() json['encodingName'] = self.encoding_name.to_json() @@ -494,12 +504,17 @@ def to_json(self) -> T_JSON_DICT: json['scrollOffsetX'] = self.scroll_offset_x if self.scroll_offset_y is not None: json['scrollOffsetY'] = self.scroll_offset_y + if self.content_width is not None: + json['contentWidth'] = self.content_width + if self.content_height is not None: + json['contentHeight'] = self.content_height return json @classmethod def from_json(cls, json: T_JSON_DICT) -> DocumentSnapshot: return cls( document_url=StringIndex.from_json(json['documentURL']), + title=StringIndex.from_json(json['title']), base_url=StringIndex.from_json(json['baseURL']), content_language=StringIndex.from_json(json['contentLanguage']), encoding_name=StringIndex.from_json(json['encodingName']), @@ -511,12 +526,14 @@ def from_json(cls, json: T_JSON_DICT) -> DocumentSnapshot: text_boxes=TextBoxSnapshot.from_json(json['textBoxes']), scroll_offset_x=float(json['scrollOffsetX']) if 'scrollOffsetX' in json else None, scroll_offset_y=float(json['scrollOffsetY']) if 'scrollOffsetY' in json else None, + content_width=float(json['contentWidth']) if 'contentWidth' in json else None, + content_height=float(json['contentHeight']) if 'contentHeight' in json else None, ) @dataclass class NodeTreeSnapshot: - ''' + r''' Table containing nodes. ''' #: Parent node index. @@ -525,6 +542,9 @@ class NodeTreeSnapshot: #: ``Node``'s nodeType. node_type: typing.Optional[typing.List[int]] = None + #: Type of the shadow root the ``Node`` is in. String values are equal to the ``ShadowRootType`` enum. + shadow_root_type: typing.Optional[RareStringData] = None + #: ``Node``'s nodeName. node_name: typing.Optional[typing.List[StringIndex]] = None @@ -572,6 +592,8 @@ def to_json(self) -> T_JSON_DICT: json['parentIndex'] = [i for i in self.parent_index] if self.node_type is not None: json['nodeType'] = [i for i in self.node_type] + if self.shadow_root_type is not None: + json['shadowRootType'] = self.shadow_root_type.to_json() if self.node_name is not None: json['nodeName'] = [i.to_json() for i in self.node_name] if self.node_value is not None: @@ -605,6 +627,7 @@ def from_json(cls, json: T_JSON_DICT) -> NodeTreeSnapshot: return cls( parent_index=[int(i) for i in json['parentIndex']] if 'parentIndex' in json else None, node_type=[int(i) for i in json['nodeType']] if 'nodeType' in json else None, + shadow_root_type=RareStringData.from_json(json['shadowRootType']) if 'shadowRootType' in json else None, node_name=[StringIndex.from_json(i) for i in json['nodeName']] if 'nodeName' in json else None, node_value=[StringIndex.from_json(i) for i in json['nodeValue']] if 'nodeValue' in json else None, backend_node_id=[dom.BackendNodeId.from_json(i) for i in json['backendNodeId']] if 'backendNodeId' in json else None, @@ -623,7 +646,7 @@ def from_json(cls, json: T_JSON_DICT) -> NodeTreeSnapshot: @dataclass class LayoutTreeSnapshot: - ''' + r''' Table of details of an element in the DOM tree with a LayoutObject. ''' #: Index of the corresponding node in the ``NodeTreeSnapshot`` array returned by ``captureSnapshot``. @@ -641,6 +664,11 @@ class LayoutTreeSnapshot: #: Stacking context information. stacking_contexts: RareBooleanData + #: Global paint order index, which is determined by the stacking order of the nodes. Nodes + #: that are painted together will have the same index. Only provided if includePaintOrder in + #: captureSnapshot was true. + paint_orders: typing.Optional[typing.List[int]] = None + #: The offset rect of nodes. Only available when includeDOMRects is set to true offset_rects: typing.Optional[typing.List[Rectangle]] = None @@ -650,6 +678,12 @@ class LayoutTreeSnapshot: #: The client rect of nodes. Only available when includeDOMRects is set to true client_rects: typing.Optional[typing.List[Rectangle]] = None + #: The list of background colors that are blended with colors of overlapping elements. + blended_background_colors: typing.Optional[typing.List[StringIndex]] = None + + #: The list of computed text opacities. + text_color_opacities: typing.Optional[typing.List[float]] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['nodeIndex'] = [i for i in self.node_index] @@ -657,12 +691,18 @@ def to_json(self) -> T_JSON_DICT: json['bounds'] = [i.to_json() for i in self.bounds] json['text'] = [i.to_json() for i in self.text] json['stackingContexts'] = self.stacking_contexts.to_json() + if self.paint_orders is not None: + json['paintOrders'] = [i for i in self.paint_orders] if self.offset_rects is not None: json['offsetRects'] = [i.to_json() for i in self.offset_rects] if self.scroll_rects is not None: json['scrollRects'] = [i.to_json() for i in self.scroll_rects] if self.client_rects is not None: json['clientRects'] = [i.to_json() for i in self.client_rects] + if self.blended_background_colors is not None: + json['blendedBackgroundColors'] = [i.to_json() for i in self.blended_background_colors] + if self.text_color_opacities is not None: + json['textColorOpacities'] = [i for i in self.text_color_opacities] return json @classmethod @@ -673,15 +713,18 @@ def from_json(cls, json: T_JSON_DICT) -> LayoutTreeSnapshot: bounds=[Rectangle.from_json(i) for i in json['bounds']], text=[StringIndex.from_json(i) for i in json['text']], stacking_contexts=RareBooleanData.from_json(json['stackingContexts']), + paint_orders=[int(i) for i in json['paintOrders']] if 'paintOrders' in json else None, offset_rects=[Rectangle.from_json(i) for i in json['offsetRects']] if 'offsetRects' in json else None, scroll_rects=[Rectangle.from_json(i) for i in json['scrollRects']] if 'scrollRects' in json else None, client_rects=[Rectangle.from_json(i) for i in json['clientRects']] if 'clientRects' in json else None, + blended_background_colors=[StringIndex.from_json(i) for i in json['blendedBackgroundColors']] if 'blendedBackgroundColors' in json else None, + text_color_opacities=[float(i) for i in json['textColorOpacities']] if 'textColorOpacities' in json else None, ) @dataclass class TextBoxSnapshot: - ''' + r''' Table of details of the post layout rendered text positions. The exact layout should not be regarded as stable and may change between versions. ''' @@ -718,7 +761,7 @@ def from_json(cls, json: T_JSON_DICT) -> TextBoxSnapshot: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables DOM snapshot agent for the given page. ''' cmd_dict: T_JSON_DICT = { @@ -728,7 +771,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables DOM snapshot agent for the given page. ''' cmd_dict: T_JSON_DICT = { @@ -744,7 +787,7 @@ def get_snapshot( include_paint_order: typing.Optional[bool] = None, include_user_agent_shadow_tree: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[DOMNode], typing.List[LayoutTreeNode], typing.List[ComputedStyle]]]: - ''' + r''' 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 @@ -784,16 +827,22 @@ def get_snapshot( def capture_snapshot( computed_styles: typing.List[str], - include_dom_rects: typing.Optional[bool] = None + include_paint_order: typing.Optional[bool] = None, + include_dom_rects: typing.Optional[bool] = None, + include_blended_background_colors: typing.Optional[bool] = None, + include_text_color_opacities: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[DocumentSnapshot], typing.List[str]]]: - ''' + r''' 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. :param computed_styles: Whitelist of computed styles to return. + :param include_paint_order: *(Optional)* Whether to include layout object paint orders into the snapshot. :param include_dom_rects: *(Optional)* Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot + :param include_blended_background_colors: **(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. + :param include_text_color_opacities: **(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. :returns: A tuple with the following items: 0. **documents** - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. @@ -801,8 +850,14 @@ def capture_snapshot( ''' params: T_JSON_DICT = dict() params['computedStyles'] = [i for i in computed_styles] + if include_paint_order is not None: + params['includePaintOrder'] = include_paint_order if include_dom_rects is not None: params['includeDOMRects'] = include_dom_rects + if include_blended_background_colors is not None: + params['includeBlendedBackgroundColors'] = include_blended_background_colors + if include_text_color_opacities is not None: + params['includeTextColorOpacities'] = include_text_color_opacities cmd_dict: T_JSON_DICT = { 'method': 'DOMSnapshot.captureSnapshot', 'params': params, diff --git a/cdp/dom_storage.py b/cdp/dom_storage.py index 700f9cd..74c539c 100644 --- a/cdp/dom_storage.py +++ b/cdp/dom_storage.py @@ -14,7 +14,7 @@ @dataclass class StorageId: - ''' + r''' DOM Storage identifier. ''' #: Security origin for the storage. @@ -38,7 +38,7 @@ def from_json(cls, json: T_JSON_DICT) -> StorageId: class Item(list): - ''' + r''' DOM Storage item. ''' def to_json(self) -> typing.List[str]: @@ -55,7 +55,7 @@ def __repr__(self): def clear( storage_id: StorageId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param storage_id: ''' params: T_JSON_DICT = dict() @@ -68,7 +68,7 @@ def clear( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables storage tracking, prevents storage events from being sent to the client. ''' cmd_dict: T_JSON_DICT = { @@ -78,7 +78,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables storage tracking, storage events will now be delivered to the client. ''' cmd_dict: T_JSON_DICT = { @@ -90,7 +90,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_dom_storage_items( storage_id: StorageId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Item]]: - ''' + r''' :param storage_id: :returns: ''' @@ -108,7 +108,7 @@ def remove_dom_storage_item( storage_id: StorageId, key: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param storage_id: :param key: ''' @@ -127,7 +127,7 @@ def set_dom_storage_item( key: str, value: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param storage_id: :param key: :param value: diff --git a/cdp/emulation.py b/cdp/emulation.py index cdee287..85a143d 100644 --- a/cdp/emulation.py +++ b/cdp/emulation.py @@ -19,7 +19,7 @@ @dataclass class ScreenOrientation: - ''' + r''' Screen orientation. ''' #: Orientation type. @@ -42,8 +42,58 @@ def from_json(cls, json: T_JSON_DICT) -> ScreenOrientation: ) +@dataclass +class DisplayFeature: + #: Orientation of a display feature in relation to screen + orientation: str + + #: The offset from the screen origin in either the x (for vertical + #: orientation) or y (for horizontal orientation) direction. + offset: int + + #: A display feature may mask content such that it is not physically + #: displayed - this length along with the offset describes this area. + #: A display feature that only splits content will have a 0 mask_length. + mask_length: int + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['orientation'] = self.orientation + json['offset'] = self.offset + json['maskLength'] = self.mask_length + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DisplayFeature: + return cls( + orientation=str(json['orientation']), + offset=int(json['offset']), + mask_length=int(json['maskLength']), + ) + + +@dataclass +class MediaFeature: + name: str + + value: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + json['value'] = self.value + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> MediaFeature: + return cls( + name=str(json['name']), + value=str(json['value']), + ) + + class VirtualTimePolicy(enum.Enum): - ''' + r''' advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending @@ -61,8 +111,98 @@ def from_json(cls, json: str) -> VirtualTimePolicy: return cls(json) -def can_emulate() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: +@dataclass +class UserAgentBrandVersion: + r''' + Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints + ''' + brand: str + + version: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['brand'] = self.brand + json['version'] = self.version + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> UserAgentBrandVersion: + return cls( + brand=str(json['brand']), + version=str(json['version']), + ) + + +@dataclass +class UserAgentMetadata: + r''' + Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints + Missing optional values will be filled in by the target with what it would normally use. + ''' + platform: str + + platform_version: str + + architecture: str + + model: str + + mobile: bool + + brands: typing.Optional[typing.List[UserAgentBrandVersion]] = None + + full_version_list: typing.Optional[typing.List[UserAgentBrandVersion]] = None + + full_version: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['platform'] = self.platform + json['platformVersion'] = self.platform_version + json['architecture'] = self.architecture + json['model'] = self.model + json['mobile'] = self.mobile + if self.brands is not None: + json['brands'] = [i.to_json() for i in self.brands] + if self.full_version_list is not None: + json['fullVersionList'] = [i.to_json() for i in self.full_version_list] + if self.full_version is not None: + json['fullVersion'] = self.full_version + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> UserAgentMetadata: + return cls( + platform=str(json['platform']), + platform_version=str(json['platformVersion']), + architecture=str(json['architecture']), + model=str(json['model']), + mobile=bool(json['mobile']), + brands=[UserAgentBrandVersion.from_json(i) for i in json['brands']] if 'brands' in json else None, + full_version_list=[UserAgentBrandVersion.from_json(i) for i in json['fullVersionList']] if 'fullVersionList' in json else None, + full_version=str(json['fullVersion']) if 'fullVersion' in json else None, + ) + + +class DisabledImageType(enum.Enum): + r''' + Enum of image types that can be disabled. ''' + AVIF = "avif" + JXL = "jxl" + WEBP = "webp" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> DisabledImageType: + return cls(json) + + +def can_emulate() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: + r''' Tells whether emulation is supported. :returns: True if emulation is supported. @@ -75,8 +215,8 @@ def can_emulate() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: def clear_device_metrics_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Clears the overriden device metrics. + r''' + Clears the overridden device metrics. ''' cmd_dict: T_JSON_DICT = { 'method': 'Emulation.clearDeviceMetricsOverride', @@ -85,8 +225,8 @@ def clear_device_metrics_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT, def clear_geolocation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Clears the overriden Geolocation Position and Error. + r''' + Clears the overridden Geolocation Position and Error. ''' cmd_dict: T_JSON_DICT = { 'method': 'Emulation.clearGeolocationOverride', @@ -95,7 +235,7 @@ def clear_geolocation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Non def reset_page_scale_factor() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Requests that page scale factor is reset to initial values. **EXPERIMENTAL** @@ -109,7 +249,7 @@ def reset_page_scale_factor() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def set_focus_emulation_enabled( enabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables or disables simulating a focused and active page. **EXPERIMENTAL** @@ -125,10 +265,30 @@ def set_focus_emulation_enabled( json = yield cmd_dict +def set_auto_dark_mode_override( + enabled: typing.Optional[bool] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Automatically render all web contents using a dark theme. + + **EXPERIMENTAL** + + :param enabled: *(Optional)* Whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared. + ''' + params: T_JSON_DICT = dict() + if enabled is not None: + params['enabled'] = enabled + cmd_dict: T_JSON_DICT = { + 'method': 'Emulation.setAutoDarkModeOverride', + 'params': params, + } + json = yield cmd_dict + + def set_cpu_throttling_rate( rate: float ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables CPU throttling to emulate slow CPUs. **EXPERIMENTAL** @@ -147,7 +307,7 @@ def set_cpu_throttling_rate( def set_default_background_color_override( color: typing.Optional[dom.RGBA] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one. @@ -175,9 +335,10 @@ def set_device_metrics_override( position_y: typing.Optional[int] = None, dont_set_visible_size: typing.Optional[bool] = None, screen_orientation: typing.Optional[ScreenOrientation] = None, - viewport: typing.Optional[page.Viewport] = None + viewport: typing.Optional[page.Viewport] = None, + display_feature: typing.Optional[DisplayFeature] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results). @@ -194,6 +355,7 @@ def set_device_metrics_override( :param dont_set_visible_size: **(EXPERIMENTAL)** *(Optional)* Do not set visible view size, rely upon explicit setVisibleSize call. :param screen_orientation: *(Optional)* Screen orientation override. :param viewport: **(EXPERIMENTAL)** *(Optional)* If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions. + :param display_feature: **(EXPERIMENTAL)** *(Optional)* If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. ''' params: T_JSON_DICT = dict() params['width'] = width @@ -216,6 +378,8 @@ def set_device_metrics_override( params['screenOrientation'] = screen_orientation.to_json() if viewport is not None: params['viewport'] = viewport.to_json() + if display_feature is not None: + params['displayFeature'] = display_feature.to_json() cmd_dict: T_JSON_DICT = { 'method': 'Emulation.setDeviceMetricsOverride', 'params': params, @@ -226,7 +390,7 @@ def set_device_metrics_override( def set_scrollbars_hidden( hidden: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' **EXPERIMENTAL** @@ -245,7 +409,7 @@ def set_scrollbars_hidden( def set_document_cookie_disabled( disabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' **EXPERIMENTAL** @@ -265,7 +429,7 @@ def set_emit_touch_events_for_mouse( enabled: bool, configuration: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' **EXPERIMENTAL** @@ -285,15 +449,20 @@ def set_emit_touch_events_for_mouse( def set_emulated_media( - media: str + media: typing.Optional[str] = None, + features: typing.Optional[typing.List[MediaFeature]] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Emulates the given media for CSS media queries. + r''' + Emulates the given media type or media feature for CSS media queries. - :param media: Media type to emulate. Empty string disables the override. + :param media: *(Optional)* Media type to emulate. Empty string disables the override. + :param features: *(Optional)* Media features to emulate. ''' params: T_JSON_DICT = dict() - params['media'] = media + if media is not None: + params['media'] = media + if features is not None: + params['features'] = [i.to_json() for i in features] cmd_dict: T_JSON_DICT = { 'method': 'Emulation.setEmulatedMedia', 'params': params, @@ -301,12 +470,31 @@ def set_emulated_media( json = yield cmd_dict +def set_emulated_vision_deficiency( + type_: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Emulates the given vision deficiency. + + **EXPERIMENTAL** + + :param type_: Vision deficiency to emulate. + ''' + params: T_JSON_DICT = dict() + params['type'] = type_ + cmd_dict: T_JSON_DICT = { + 'method': 'Emulation.setEmulatedVisionDeficiency', + 'params': params, + } + json = yield cmd_dict + + def set_geolocation_override( latitude: typing.Optional[float] = None, longitude: typing.Optional[float] = None, accuracy: typing.Optional[float] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable. @@ -328,11 +516,45 @@ def set_geolocation_override( json = yield cmd_dict +def set_idle_override( + is_user_active: bool, + is_screen_unlocked: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Overrides the Idle state. + + **EXPERIMENTAL** + + :param is_user_active: Mock isUserActive + :param is_screen_unlocked: Mock isScreenUnlocked + ''' + params: T_JSON_DICT = dict() + params['isUserActive'] = is_user_active + params['isScreenUnlocked'] = is_screen_unlocked + cmd_dict: T_JSON_DICT = { + 'method': 'Emulation.setIdleOverride', + 'params': params, + } + json = yield cmd_dict + + +def clear_idle_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Clears Idle state overrides. + + **EXPERIMENTAL** + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Emulation.clearIdleOverride', + } + json = yield cmd_dict + + @deprecated(version="1.3") def set_navigator_overrides( platform: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides value returned by the javascript navigator object. .. deprecated:: 1.3 @@ -353,7 +575,7 @@ def set_navigator_overrides( def set_page_scale_factor( page_scale_factor: float ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets a specified page scale factor. **EXPERIMENTAL** @@ -372,7 +594,7 @@ def set_page_scale_factor( def set_script_execution_disabled( value: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Switches script execution in the page. :param value: Whether script execution should be disabled in the page. @@ -390,7 +612,7 @@ def set_touch_emulation_enabled( enabled: bool, max_touch_points: typing.Optional[int] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables touch on platforms which do not support them. :param enabled: Whether the touch event emulation should be enabled. @@ -414,7 +636,7 @@ def set_virtual_time_policy( wait_for_navigation: typing.Optional[bool] = None, initial_virtual_time: typing.Optional[network.TimeSinceEpoch] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]: - ''' + r''' Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy. Note this supersedes any previous time budget. @@ -424,7 +646,7 @@ def set_virtual_time_policy( :param budget: *(Optional)* If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent. :param max_virtual_time_task_starvation_count: *(Optional)* If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock. :param wait_for_navigation: *(Optional)* If set the virtual time policy change should be deferred until any frame starts navigating. Note any previous deferred policy change is superseded. - :param initial_virtual_time: *(Optional)* If set, base::Time::Now will be overriden to initially return this value. + :param initial_virtual_time: *(Optional)* If set, base::Time::Now will be overridden to initially return this value. :returns: Absolute timestamp at which virtual time was first enabled (up time in milliseconds). ''' params: T_JSON_DICT = dict() @@ -445,10 +667,30 @@ def set_virtual_time_policy( return float(json['virtualTimeTicksBase']) +def set_locale_override( + locale: typing.Optional[str] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Overrides default host system locale with the specified one. + + **EXPERIMENTAL** + + :param locale: *(Optional)* ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale. + ''' + params: T_JSON_DICT = dict() + if locale is not None: + params['locale'] = locale + cmd_dict: T_JSON_DICT = { + 'method': 'Emulation.setLocaleOverride', + 'params': params, + } + json = yield cmd_dict + + def set_timezone_override( timezone_id: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides default host system timezone with the specified one. **EXPERIMENTAL** @@ -469,7 +711,7 @@ def set_visible_size( width: int, height: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Resizes the frame/viewport of the page. Note that this does not affect the frame's container (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported on Android. @@ -491,17 +733,38 @@ def set_visible_size( json = yield cmd_dict +def set_disabled_image_types( + image_types: typing.List[DisabledImageType] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + + + **EXPERIMENTAL** + + :param image_types: Image types to disable. + ''' + params: T_JSON_DICT = dict() + params['imageTypes'] = [i.to_json() for i in image_types] + cmd_dict: T_JSON_DICT = { + 'method': 'Emulation.setDisabledImageTypes', + 'params': params, + } + json = yield cmd_dict + + def set_user_agent_override( user_agent: str, accept_language: typing.Optional[str] = None, - platform: typing.Optional[str] = None + platform: typing.Optional[str] = None, + user_agent_metadata: typing.Optional[UserAgentMetadata] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Allows overriding user agent with the given string. :param user_agent: User agent to use. :param accept_language: *(Optional)* Browser langugage to emulate. :param platform: *(Optional)* The platform navigator.platform should return. + :param user_agent_metadata: **(EXPERIMENTAL)** *(Optional)* To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData ''' params: T_JSON_DICT = dict() params['userAgent'] = user_agent @@ -509,6 +772,8 @@ def set_user_agent_override( params['acceptLanguage'] = accept_language if platform is not None: params['platform'] = platform + if user_agent_metadata is not None: + params['userAgentMetadata'] = user_agent_metadata.to_json() cmd_dict: T_JSON_DICT = { 'method': 'Emulation.setUserAgentOverride', 'params': params, @@ -519,7 +784,7 @@ def set_user_agent_override( @event_class('Emulation.virtualTimeBudgetExpired') @dataclass class VirtualTimeBudgetExpired: - ''' + r''' **EXPERIMENTAL** Notification sent after the virtual time budget for the current VirtualTimePolicy has run out. diff --git a/cdp/event_breakpoints.py b/cdp/event_breakpoints.py new file mode 100644 index 0000000..665f49d --- /dev/null +++ b/cdp/event_breakpoints.py @@ -0,0 +1,46 @@ +# DO NOT EDIT THIS FILE! +# +# This file is generated from the CDP specification. If you need to make +# changes, edit the generator and regenerate all of the modules. +# +# CDP domain: EventBreakpoints (experimental) + +from __future__ import annotations +from cdp.util import event_class, T_JSON_DICT +from dataclasses import dataclass +import enum +import typing + + +def set_instrumentation_breakpoint( + event_name: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Sets breakpoint on particular native event. + + :param event_name: Instrumentation name to stop on. + ''' + params: T_JSON_DICT = dict() + params['eventName'] = event_name + cmd_dict: T_JSON_DICT = { + 'method': 'EventBreakpoints.setInstrumentationBreakpoint', + 'params': params, + } + json = yield cmd_dict + + +def remove_instrumentation_breakpoint( + event_name: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Removes breakpoint on particular native event. + + :param event_name: Instrumentation name to stop on. + ''' + params: T_JSON_DICT = dict() + params['eventName'] = event_name + cmd_dict: T_JSON_DICT = { + 'method': 'EventBreakpoints.removeInstrumentationBreakpoint', + 'params': params, + } + json = yield cmd_dict diff --git a/cdp/fetch.py b/cdp/fetch.py index 1043e71..d526a48 100644 --- a/cdp/fetch.py +++ b/cdp/fetch.py @@ -3,7 +3,7 @@ # This file is generated from the CDP specification. If you need to make # changes, edit the generator and regenerate all of the modules. # -# CDP domain: Fetch (experimental) +# CDP domain: Fetch from __future__ import annotations from cdp.util import event_class, T_JSON_DICT @@ -17,7 +17,7 @@ class RequestId(str): - ''' + r''' Unique request identifier. ''' def to_json(self) -> str: @@ -32,10 +32,10 @@ def __repr__(self): class RequestStage(enum.Enum): - ''' + r''' Stages of the request to handle. Request will intercept before the request is sent. Response will intercept after the response is received (but before response - body is received. + body is received). ''' REQUEST = "Request" RESPONSE = "Response" @@ -50,14 +50,14 @@ def from_json(cls, json: str) -> RequestStage: @dataclass class RequestPattern: - #: Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is - #: backslash. Omitting is equivalent to "*". + #: Wildcards (``'*'`` -> zero or more, ``'?'`` -> exactly one) are allowed. Escape character is + #: backslash. Omitting is equivalent to ``"*"``. url_pattern: typing.Optional[str] = None #: If set, only requests for matching resource types will be intercepted. resource_type: typing.Optional[network.ResourceType] = None - #: Stage at wich to begin intercepting requests. Default is Request. + #: Stage at which to begin intercepting requests. Default is Request. request_stage: typing.Optional[RequestStage] = None def to_json(self) -> T_JSON_DICT: @@ -81,7 +81,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestPattern: @dataclass class HeaderEntry: - ''' + r''' Response HTTP header entry ''' name: str @@ -104,7 +104,7 @@ def from_json(cls, json: T_JSON_DICT) -> HeaderEntry: @dataclass class AuthChallenge: - ''' + r''' Authorization challenge for HTTP status code 401 or 407. ''' #: Origin of the challenger. @@ -140,7 +140,7 @@ def from_json(cls, json: T_JSON_DICT) -> AuthChallenge: @dataclass class AuthChallengeResponse: - ''' + r''' Response to an AuthChallenge. ''' #: The decision on what to do in response to the authorization challenge. Default means @@ -175,7 +175,7 @@ def from_json(cls, json: T_JSON_DICT) -> AuthChallengeResponse: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables the fetch domain. ''' cmd_dict: T_JSON_DICT = { @@ -188,7 +188,7 @@ def enable( patterns: typing.Optional[typing.List[RequestPattern]] = None, handle_auth_requests: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables issuing of requestPaused events. A request will be paused until client calls one of failRequest, fulfillRequest or continueRequest/continueWithAuth. @@ -211,7 +211,7 @@ def fail_request( request_id: RequestId, error_reason: network.ErrorReason ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Causes the request to fail with specified reason. :param request_id: An id the client received in requestPaused event. @@ -230,23 +230,28 @@ def fail_request( def fulfill_request( request_id: RequestId, response_code: int, - response_headers: typing.List[HeaderEntry], + response_headers: typing.Optional[typing.List[HeaderEntry]] = None, + binary_response_headers: typing.Optional[str] = None, body: typing.Optional[str] = None, response_phrase: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Provides response to the request. :param request_id: An id the client received in requestPaused event. :param response_code: An HTTP response code. - :param response_headers: Response headers. - :param body: *(Optional)* A response body. - :param response_phrase: *(Optional)* A textual representation of responseCode. If absent, a standard phrase mathcing responseCode is used. + :param response_headers: *(Optional)* Response headers. + :param binary_response_headers: *(Optional)* Alternative way of specifying response headers as a \0-separated series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can't be transmitted over the protocol as text. (Encoded as a base64 string when passed over JSON) + :param body: *(Optional)* A response body. If absent, original response body will be used if the request is intercepted at the response stage and empty body will be used if the request is intercepted at the request stage. (Encoded as a base64 string when passed over JSON) + :param response_phrase: *(Optional)* A textual representation of responseCode. If absent, a standard phrase matching responseCode is used. ''' params: T_JSON_DICT = dict() params['requestId'] = request_id.to_json() params['responseCode'] = response_code - params['responseHeaders'] = [i.to_json() for i in response_headers] + if response_headers is not None: + params['responseHeaders'] = [i.to_json() for i in response_headers] + if binary_response_headers is not None: + params['binaryResponseHeaders'] = binary_response_headers if body is not None: params['body'] = body if response_phrase is not None: @@ -263,16 +268,18 @@ def continue_request( url: typing.Optional[str] = None, method: typing.Optional[str] = None, post_data: typing.Optional[str] = None, - headers: typing.Optional[typing.List[HeaderEntry]] = None + headers: typing.Optional[typing.List[HeaderEntry]] = None, + intercept_response: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Continues the request, optionally modifying some of its parameters. :param request_id: An id the client received in requestPaused event. :param url: *(Optional)* If set, the request url will be modified in a way that's not observable by page. :param method: *(Optional)* If set, the request method is overridden. - :param post_data: *(Optional)* If set, overrides the post data in the request. - :param headers: *(Optional)* If set, overrides the request headrts. + :param post_data: *(Optional)* If set, overrides the post data in the request. (Encoded as a base64 string when passed over JSON) + :param headers: *(Optional)* If set, overrides the request headers. + :param intercept_response: **(EXPERIMENTAL)** *(Optional)* If set, overrides response interception behavior for this request. ''' params: T_JSON_DICT = dict() params['requestId'] = request_id.to_json() @@ -284,6 +291,8 @@ def continue_request( params['postData'] = post_data if headers is not None: params['headers'] = [i.to_json() for i in headers] + if intercept_response is not None: + params['interceptResponse'] = intercept_response cmd_dict: T_JSON_DICT = { 'method': 'Fetch.continueRequest', 'params': params, @@ -295,7 +304,7 @@ def continue_with_auth( request_id: RequestId, auth_challenge_response: AuthChallengeResponse ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Continues a request supplying authChallengeResponse following authRequired event. :param request_id: An id the client received in authRequired event. @@ -311,10 +320,47 @@ def continue_with_auth( json = yield cmd_dict +def continue_response( + request_id: RequestId, + response_code: typing.Optional[int] = None, + response_phrase: typing.Optional[str] = None, + response_headers: typing.Optional[typing.List[HeaderEntry]] = None, + binary_response_headers: typing.Optional[str] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Continues loading of the paused response, optionally modifying the + response headers. If either responseCode or headers are modified, all of them + must be present. + + **EXPERIMENTAL** + + :param request_id: An id the client received in requestPaused event. + :param response_code: *(Optional)* An HTTP response code. If absent, original response code will be used. + :param response_phrase: *(Optional)* A textual representation of responseCode. If absent, a standard phrase matching responseCode is used. + :param response_headers: *(Optional)* Response headers. If absent, original response headers will be used. + :param binary_response_headers: *(Optional)* Alternative way of specifying response headers as a \0-separated series of name: value pairs. Prefer the above method unless you need to represent some non-UTF8 values that can't be transmitted over the protocol as text. (Encoded as a base64 string when passed over JSON) + ''' + params: T_JSON_DICT = dict() + params['requestId'] = request_id.to_json() + if response_code is not None: + params['responseCode'] = response_code + if response_phrase is not None: + params['responsePhrase'] = response_phrase + if response_headers is not None: + params['responseHeaders'] = [i.to_json() for i in response_headers] + if binary_response_headers is not None: + params['binaryResponseHeaders'] = binary_response_headers + cmd_dict: T_JSON_DICT = { + 'method': 'Fetch.continueResponse', + 'params': params, + } + json = yield cmd_dict + + def get_response_body( request_id: RequestId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, bool]]: - ''' + r''' Causes the body of the response to be received from the server and returned as a single string. May only be issued for a request that is paused in the Response stage and is mutually exclusive with @@ -344,7 +390,7 @@ def get_response_body( def take_response_body_as_stream( request_id: RequestId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,io.StreamHandle]: - ''' + r''' Returns a handle to the stream representing the response body. The request must be paused in the HeadersReceived stage. Note that after this command the request can't be continued @@ -372,7 +418,7 @@ def take_response_body_as_stream( @event_class('Fetch.requestPaused') @dataclass class RequestPaused: - ''' + r''' Issued when the domain is enabled and the request URL matches the specified filter. The request is paused until the client responds with one of continueRequest, failRequest or fulfillRequest. @@ -392,6 +438,8 @@ class RequestPaused: response_error_reason: typing.Optional[network.ErrorReason] #: Response code if intercepted at response stage. response_status_code: typing.Optional[int] + #: Response status text if intercepted at response stage. + response_status_text: typing.Optional[str] #: Response headers if intercepted at the response stage. response_headers: typing.Optional[typing.List[HeaderEntry]] #: If the intercepted request had a corresponding Network.requestWillBeSent event fired for it, @@ -407,6 +455,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestPaused: resource_type=network.ResourceType.from_json(json['resourceType']), response_error_reason=network.ErrorReason.from_json(json['responseErrorReason']) if 'responseErrorReason' in json else None, response_status_code=int(json['responseStatusCode']) if 'responseStatusCode' in json else None, + response_status_text=str(json['responseStatusText']) if 'responseStatusText' in json else None, response_headers=[HeaderEntry.from_json(i) for i in json['responseHeaders']] if 'responseHeaders' in json else None, network_id=RequestId.from_json(json['networkId']) if 'networkId' in json else None ) @@ -415,7 +464,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestPaused: @event_class('Fetch.authRequired') @dataclass class AuthRequired: - ''' + r''' Issued when the domain is enabled with handleAuthRequests set to true. The request is paused until client responds with continueWithAuth. ''' diff --git a/cdp/headless_experimental.py b/cdp/headless_experimental.py index 72f81be..7db8f9d 100644 --- a/cdp/headless_experimental.py +++ b/cdp/headless_experimental.py @@ -12,9 +12,12 @@ import typing +from deprecated.sphinx import deprecated # type: ignore + + @dataclass class ScreenshotParams: - ''' + r''' Encoding options for a screenshot. ''' #: Image compression format (defaults to png). @@ -45,7 +48,7 @@ def begin_frame( no_display_updates: typing.Optional[bool] = None, screenshot: typing.Optional[ScreenshotParams] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[bool, typing.Optional[str]]]: - ''' + r''' Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a screenshot from the resulting frame. Requires that the target was created with enabled BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also @@ -58,7 +61,7 @@ def begin_frame( :returns: A tuple with the following items: 0. **hasDamage** - Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future. - 1. **screenshotData** - *(Optional)* Base64-encoded image data of the screenshot, if one was requested and successfully taken. + 1. **screenshotData** - *(Optional)* Base64-encoded image data of the screenshot, if one was requested and successfully taken. (Encoded as a base64 string when passed over JSON) ''' params: T_JSON_DICT = dict() if frame_time_ticks is not None: @@ -81,7 +84,7 @@ def begin_frame( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables headless events for the target. ''' cmd_dict: T_JSON_DICT = { @@ -91,7 +94,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables headless events for the target. ''' cmd_dict: T_JSON_DICT = { @@ -100,11 +103,14 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict +@deprecated(version="1.3") @event_class('HeadlessExperimental.needsBeginFramesChanged') @dataclass class NeedsBeginFramesChanged: - ''' + r''' Issued when the target starts or stops needing BeginFrames. + Deprecated. Issue beginFrame unconditionally instead and use result from + beginFrame to detect whether the frames were suppressed. ''' #: True if BeginFrames are needed, false otherwise. needs_begin_frames: bool diff --git a/cdp/heap_profiler.py b/cdp/heap_profiler.py index ab29f7c..b6aa8bf 100644 --- a/cdp/heap_profiler.py +++ b/cdp/heap_profiler.py @@ -15,7 +15,7 @@ class HeapSnapshotObjectId(str): - ''' + r''' Heap snapshot object id. ''' def to_json(self) -> str: @@ -31,7 +31,7 @@ def __repr__(self): @dataclass class SamplingHeapProfileNode: - ''' + r''' Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. ''' #: Function location. @@ -66,7 +66,7 @@ def from_json(cls, json: T_JSON_DICT) -> SamplingHeapProfileNode: @dataclass class SamplingHeapProfileSample: - ''' + r''' A single sample from a sampling profile. ''' #: Allocation size in bytes attributed to the sample. @@ -97,7 +97,7 @@ def from_json(cls, json: T_JSON_DICT) -> SamplingHeapProfileSample: @dataclass class SamplingHeapProfile: - ''' + r''' Sampling profile. ''' head: SamplingHeapProfileNode @@ -121,7 +121,7 @@ def from_json(cls, json: T_JSON_DICT) -> SamplingHeapProfile: def add_inspected_heap_object( heap_object_id: HeapSnapshotObjectId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). @@ -163,7 +163,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_heap_object_id( object_id: runtime.RemoteObjectId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,HeapSnapshotObjectId]: - ''' + r''' :param object_id: Identifier of the object to get heap object id for. :returns: Id of the heap snapshot object corresponding to the passed remote object id. ''' @@ -181,7 +181,7 @@ def get_object_by_heap_object_id( object_id: HeapSnapshotObjectId, object_group: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.RemoteObject]: - ''' + r''' :param object_id: :param object_group: *(Optional)* Symbolic group name that can be used to release multiple objects. :returns: Evaluation result. @@ -199,7 +199,7 @@ def get_object_by_heap_object_id( def get_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingHeapProfile]: - ''' + r''' :returns: Return the sampling profile being collected. @@ -214,7 +214,7 @@ def get_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingH def start_sampling( sampling_interval: typing.Optional[float] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param sampling_interval: *(Optional)* Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. ''' params: T_JSON_DICT = dict() @@ -230,7 +230,7 @@ def start_sampling( def start_tracking_heap_objects( track_allocations: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param track_allocations: *(Optional)* ''' params: T_JSON_DICT = dict() @@ -244,7 +244,7 @@ def start_tracking_heap_objects( def stop_sampling() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingHeapProfile]: - ''' + r''' :returns: Recorded sampling heap profile. @@ -257,14 +257,22 @@ def stop_sampling() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingHeapProf def stop_tracking_heap_objects( - report_progress: typing.Optional[bool] = None + report_progress: typing.Optional[bool] = None, + treat_global_objects_as_roots: typing.Optional[bool] = None, + capture_numeric_value: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param report_progress: *(Optional)* If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. + :param treat_global_objects_as_roots: *(Optional)* + :param capture_numeric_value: *(Optional)* If true, numerical values are included in the snapshot ''' params: T_JSON_DICT = dict() if report_progress is not None: params['reportProgress'] = report_progress + if treat_global_objects_as_roots is not None: + params['treatGlobalObjectsAsRoots'] = treat_global_objects_as_roots + if capture_numeric_value is not None: + params['captureNumericValue'] = capture_numeric_value cmd_dict: T_JSON_DICT = { 'method': 'HeapProfiler.stopTrackingHeapObjects', 'params': params, @@ -273,14 +281,22 @@ def stop_tracking_heap_objects( def take_heap_snapshot( - report_progress: typing.Optional[bool] = None + report_progress: typing.Optional[bool] = None, + treat_global_objects_as_roots: typing.Optional[bool] = None, + capture_numeric_value: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param report_progress: *(Optional)* If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. + :param treat_global_objects_as_roots: *(Optional)* If true, a raw snapshot without artificial roots will be generated + :param capture_numeric_value: *(Optional)* If true, numerical values are included in the snapshot ''' params: T_JSON_DICT = dict() if report_progress is not None: params['reportProgress'] = report_progress + if treat_global_objects_as_roots is not None: + params['treatGlobalObjectsAsRoots'] = treat_global_objects_as_roots + if capture_numeric_value is not None: + params['captureNumericValue'] = capture_numeric_value cmd_dict: T_JSON_DICT = { 'method': 'HeapProfiler.takeHeapSnapshot', 'params': params, @@ -303,7 +319,7 @@ def from_json(cls, json: T_JSON_DICT) -> AddHeapSnapshotChunk: @event_class('HeapProfiler.heapStatsUpdate') @dataclass class HeapStatsUpdate: - ''' + r''' If heap objects tracking has been started then backend may send update for one or more fragments ''' #: An array of triplets. Each triplet describes a fragment. The first integer is the fragment @@ -321,7 +337,7 @@ def from_json(cls, json: T_JSON_DICT) -> HeapStatsUpdate: @event_class('HeapProfiler.lastSeenObjectId') @dataclass class LastSeenObjectId: - ''' + r''' If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. diff --git a/cdp/indexed_db.py b/cdp/indexed_db.py index 56f1328..7920c51 100644 --- a/cdp/indexed_db.py +++ b/cdp/indexed_db.py @@ -16,7 +16,7 @@ @dataclass class DatabaseWithObjectStores: - ''' + r''' Database with an array of object stores. ''' #: Database name. @@ -47,7 +47,7 @@ def from_json(cls, json: T_JSON_DICT) -> DatabaseWithObjectStores: @dataclass class ObjectStore: - ''' + r''' Object store. ''' #: Object store name. @@ -82,7 +82,7 @@ def from_json(cls, json: T_JSON_DICT) -> ObjectStore: @dataclass class ObjectStoreIndex: - ''' + r''' Object store index. ''' #: Index name. @@ -117,7 +117,7 @@ def from_json(cls, json: T_JSON_DICT) -> ObjectStoreIndex: @dataclass class Key: - ''' + r''' Key. ''' #: Key type. @@ -161,7 +161,7 @@ def from_json(cls, json: T_JSON_DICT) -> Key: @dataclass class KeyRange: - ''' + r''' Key range. ''' #: If true lower bound is open. @@ -198,7 +198,7 @@ def from_json(cls, json: T_JSON_DICT) -> KeyRange: @dataclass class DataEntry: - ''' + r''' Data entry. ''' #: Key object. @@ -228,7 +228,7 @@ def from_json(cls, json: T_JSON_DICT) -> DataEntry: @dataclass class KeyPath: - ''' + r''' Key path. ''' #: Key path type. @@ -263,7 +263,7 @@ def clear_object_store( database_name: str, object_store_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears all entries from an object store. :param security_origin: Security origin. @@ -285,7 +285,7 @@ def delete_database( security_origin: str, database_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Deletes a database. :param security_origin: Security origin. @@ -307,7 +307,7 @@ def delete_object_store_entries( object_store_name: str, key_range: KeyRange ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Delete a range of entries from an object store :param security_origin: @@ -328,7 +328,7 @@ def delete_object_store_entries( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables events from backend. ''' cmd_dict: T_JSON_DICT = { @@ -338,7 +338,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables events from backend. ''' cmd_dict: T_JSON_DICT = { @@ -356,7 +356,7 @@ def request_data( page_size: int, key_range: typing.Optional[KeyRange] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[DataEntry], bool]]: - ''' + r''' Requests data from object store or index. :param security_origin: Security origin. @@ -396,7 +396,7 @@ def get_metadata( database_name: str, object_store_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[float, float]]: - ''' + r''' Gets metadata of an object store :param security_origin: Security origin. @@ -426,7 +426,7 @@ def request_database( security_origin: str, database_name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,DatabaseWithObjectStores]: - ''' + r''' Requests database with given name in given frame. :param security_origin: Security origin. @@ -447,7 +447,7 @@ def request_database( def request_database_names( security_origin: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Requests database names for given security origin. :param security_origin: Security origin. diff --git a/cdp/input_.py b/cdp/input_.py index 4bb2092..949067b 100644 --- a/cdp/input_.py +++ b/cdp/input_.py @@ -33,6 +33,18 @@ class TouchPoint: #: Force (default: 1.0). force: typing.Optional[float] = None + #: The normalized tangential pressure, which has a range of [-1,1] (default: 0). + tangential_pressure: typing.Optional[float] = None + + #: The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0) + tilt_x: typing.Optional[int] = None + + #: The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0). + tilt_y: typing.Optional[int] = None + + #: The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0). + twist: typing.Optional[int] = None + #: Identifier used to track touch sources between events, must be unique within an event. id_: typing.Optional[float] = None @@ -48,6 +60,14 @@ def to_json(self) -> T_JSON_DICT: json['rotationAngle'] = self.rotation_angle if self.force is not None: json['force'] = self.force + if self.tangential_pressure is not None: + json['tangentialPressure'] = self.tangential_pressure + if self.tilt_x is not None: + json['tiltX'] = self.tilt_x + if self.tilt_y is not None: + json['tiltY'] = self.tilt_y + if self.twist is not None: + json['twist'] = self.twist if self.id_ is not None: json['id'] = self.id_ return json @@ -61,6 +81,10 @@ def from_json(cls, json: T_JSON_DICT) -> TouchPoint: radius_y=float(json['radiusY']) if 'radiusY' in json else None, rotation_angle=float(json['rotationAngle']) if 'rotationAngle' in json else None, force=float(json['force']) if 'force' in json else None, + tangential_pressure=float(json['tangentialPressure']) if 'tangentialPressure' in json else None, + tilt_x=int(json['tiltX']) if 'tiltX' in json else None, + tilt_y=int(json['tiltY']) if 'tiltY' in json else None, + twist=int(json['twist']) if 'twist' in json else None, id_=float(json['id']) if 'id' in json else None, ) @@ -78,8 +102,24 @@ def from_json(cls, json: str) -> GestureSourceType: return cls(json) +class MouseButton(enum.Enum): + NONE = "none" + LEFT = "left" + MIDDLE = "middle" + RIGHT = "right" + BACK = "back" + FORWARD = "forward" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> MouseButton: + return cls(json) + + class TimeSinceEpoch(float): - ''' + r''' UTC time in seconds, counted from January 1, 1970. ''' def to_json(self) -> float: @@ -93,6 +133,101 @@ def __repr__(self): return 'TimeSinceEpoch({})'.format(super().__repr__()) +@dataclass +class DragDataItem: + #: Mime type of the dragged data. + mime_type: str + + #: Depending of the value of ``mimeType``, it contains the dragged link, + #: text, HTML markup or any other data. + data: str + + #: Title associated with a link. Only valid when ``mimeType`` == "text/uri-list". + title: typing.Optional[str] = None + + #: Stores the base URL for the contained markup. Only valid when ``mimeType`` + #: == "text/html". + base_url: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['mimeType'] = self.mime_type + json['data'] = self.data + if self.title is not None: + json['title'] = self.title + if self.base_url is not None: + json['baseURL'] = self.base_url + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DragDataItem: + return cls( + mime_type=str(json['mimeType']), + data=str(json['data']), + title=str(json['title']) if 'title' in json else None, + base_url=str(json['baseURL']) if 'baseURL' in json else None, + ) + + +@dataclass +class DragData: + items: typing.List[DragDataItem] + + #: Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16 + drag_operations_mask: int + + #: List of filenames that should be included when dropping + files: typing.Optional[typing.List[str]] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['items'] = [i.to_json() for i in self.items] + json['dragOperationsMask'] = self.drag_operations_mask + if self.files is not None: + json['files'] = [i for i in self.files] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DragData: + return cls( + items=[DragDataItem.from_json(i) for i in json['items']], + drag_operations_mask=int(json['dragOperationsMask']), + files=[str(i) for i in json['files']] if 'files' in json else None, + ) + + +def dispatch_drag_event( + type_: str, + x: float, + y: float, + data: DragData, + modifiers: typing.Optional[int] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Dispatches a drag event into the page. + + **EXPERIMENTAL** + + :param type_: Type of the drag event. + :param x: X coordinate of the event relative to the main frame's viewport in CSS pixels. + :param y: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport. + :param data: + :param modifiers: *(Optional)* Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). + ''' + params: T_JSON_DICT = dict() + params['type'] = type_ + params['x'] = x + params['y'] = y + params['data'] = data.to_json() + if modifiers is not None: + params['modifiers'] = modifiers + cmd_dict: T_JSON_DICT = { + 'method': 'Input.dispatchDragEvent', + 'params': params, + } + json = yield cmd_dict + + def dispatch_key_event( type_: str, modifiers: typing.Optional[int] = None, @@ -107,15 +242,16 @@ def dispatch_key_event( auto_repeat: typing.Optional[bool] = None, is_keypad: typing.Optional[bool] = None, is_system_key: typing.Optional[bool] = None, - location: typing.Optional[int] = None + location: typing.Optional[int] = None, + commands: typing.Optional[typing.List[str]] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Dispatches a key event to the page. :param type_: Type of the key event. :param modifiers: *(Optional)* Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0). :param timestamp: *(Optional)* Time at which the event occurred. - :param text: *(Optional)* Text as generated by processing a virtual key code with a keyboard layout. Not needed for for ```keyUp```` and ````rawKeyDown``` events (default: "") + :param text: *(Optional)* Text as generated by processing a virtual key code with a keyboard layout. Not needed for for ```keyUp```` and ````rawKeyDown```` events (default: "") :param unmodified_text: *(Optional)* Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: ""). :param key_identifier: *(Optional)* Unique key identifier (e.g., 'U+0041') (default: ""). :param code: *(Optional)* Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: ""). @@ -126,6 +262,7 @@ def dispatch_key_event( :param is_keypad: *(Optional)* Whether the event was generated from the keypad (default: false). :param is_system_key: *(Optional)* Whether the event was a system key event (default: false). :param location: *(Optional)* Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0). + :param commands: **(EXPERIMENTAL)** *(Optional)* Editing commands to send with the key event (e.g., 'selectAll') (default: []). These are related to but not equal the command names used in ````document.execCommand``` and NSStandardKeyBindingResponding. See https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names. ''' params: T_JSON_DICT = dict() params['type'] = type_ @@ -155,6 +292,8 @@ def dispatch_key_event( params['isSystemKey'] = is_system_key if location is not None: params['location'] = location + if commands is not None: + params['commands'] = [i for i in commands] cmd_dict: T_JSON_DICT = { 'method': 'Input.dispatchKeyEvent', 'params': params, @@ -165,7 +304,7 @@ def dispatch_key_event( def insert_text( text: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' This method emulates inserting text that doesn't come from a key press, for example an emoji keyboard or an IME. @@ -182,20 +321,60 @@ def insert_text( json = yield cmd_dict +def ime_set_composition( + text: str, + selection_start: int, + selection_end: int, + replacement_start: typing.Optional[int] = None, + replacement_end: typing.Optional[int] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + This method sets the current candidate text for ime. + Use imeCommitComposition to commit the final text. + Use imeSetComposition with empty string as text to cancel composition. + + **EXPERIMENTAL** + + :param text: The text to insert + :param selection_start: selection start + :param selection_end: selection end + :param replacement_start: *(Optional)* replacement start + :param replacement_end: *(Optional)* replacement end + ''' + params: T_JSON_DICT = dict() + params['text'] = text + params['selectionStart'] = selection_start + params['selectionEnd'] = selection_end + if replacement_start is not None: + params['replacementStart'] = replacement_start + if replacement_end is not None: + params['replacementEnd'] = replacement_end + cmd_dict: T_JSON_DICT = { + 'method': 'Input.imeSetComposition', + 'params': params, + } + json = yield cmd_dict + + def dispatch_mouse_event( type_: str, x: float, y: float, modifiers: typing.Optional[int] = None, timestamp: typing.Optional[TimeSinceEpoch] = None, - button: typing.Optional[str] = None, + button: typing.Optional[MouseButton] = None, buttons: typing.Optional[int] = None, click_count: typing.Optional[int] = None, + force: typing.Optional[float] = None, + tangential_pressure: typing.Optional[float] = None, + tilt_x: typing.Optional[int] = None, + tilt_y: typing.Optional[int] = None, + twist: typing.Optional[int] = None, delta_x: typing.Optional[float] = None, delta_y: typing.Optional[float] = None, pointer_type: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Dispatches a mouse event to the page. :param type_: Type of the mouse event. @@ -206,6 +385,11 @@ def dispatch_mouse_event( :param button: *(Optional)* Mouse button (default: "none"). :param buttons: *(Optional)* A number indicating which buttons are pressed on the mouse when a mouse event is triggered. Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0. :param click_count: *(Optional)* Number of times the mouse button was clicked (default: 0). + :param force: **(EXPERIMENTAL)** *(Optional)* The normalized pressure, which has a range of [0,1] (default: 0). + :param tangential_pressure: **(EXPERIMENTAL)** *(Optional)* The normalized tangential pressure, which has a range of [-1,1] (default: 0). + :param tilt_x: **(EXPERIMENTAL)** *(Optional)* The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0). + :param tilt_y: **(EXPERIMENTAL)** *(Optional)* The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0). + :param twist: **(EXPERIMENTAL)** *(Optional)* The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0). :param delta_x: *(Optional)* X delta in CSS pixels for mouse wheel event (default: 0). :param delta_y: *(Optional)* Y delta in CSS pixels for mouse wheel event (default: 0). :param pointer_type: *(Optional)* Pointer type (default: "mouse"). @@ -219,11 +403,21 @@ def dispatch_mouse_event( if timestamp is not None: params['timestamp'] = timestamp.to_json() if button is not None: - params['button'] = button + params['button'] = button.to_json() if buttons is not None: params['buttons'] = buttons if click_count is not None: params['clickCount'] = click_count + if force is not None: + params['force'] = force + if tangential_pressure is not None: + params['tangentialPressure'] = tangential_pressure + if tilt_x is not None: + params['tiltX'] = tilt_x + if tilt_y is not None: + params['tiltY'] = tilt_y + if twist is not None: + params['twist'] = twist if delta_x is not None: params['deltaX'] = delta_x if delta_y is not None: @@ -243,7 +437,7 @@ def dispatch_touch_event( modifiers: typing.Optional[int] = None, timestamp: typing.Optional[TimeSinceEpoch] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Dispatches a touch event to the page. :param type_: Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one. @@ -269,14 +463,14 @@ def emulate_touch_from_mouse_event( type_: str, x: int, y: int, - button: str, + button: MouseButton, timestamp: typing.Optional[TimeSinceEpoch] = None, delta_x: typing.Optional[float] = None, delta_y: typing.Optional[float] = None, modifiers: typing.Optional[int] = None, click_count: typing.Optional[int] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Emulates touch event from the mouse event parameters. **EXPERIMENTAL** @@ -284,7 +478,7 @@ def emulate_touch_from_mouse_event( :param type_: Type of the mouse event. :param x: X coordinate of the mouse pointer in DIP. :param y: Y coordinate of the mouse pointer in DIP. - :param button: Mouse button. + :param button: Mouse button. Only "none", "left", "right" are supported. :param timestamp: *(Optional)* Time at which the event occurred (default: current time). :param delta_x: *(Optional)* X delta in DIP for mouse wheel event (default: 0). :param delta_y: *(Optional)* Y delta in DIP for mouse wheel event (default: 0). @@ -295,7 +489,7 @@ def emulate_touch_from_mouse_event( params['type'] = type_ params['x'] = x params['y'] = y - params['button'] = button + params['button'] = button.to_json() if timestamp is not None: params['timestamp'] = timestamp.to_json() if delta_x is not None: @@ -316,7 +510,7 @@ def emulate_touch_from_mouse_event( def set_ignore_input_events( ignore: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Ignores input events (useful while auditing page). :param ignore: Ignores input events processing when set to true. @@ -330,6 +524,26 @@ def set_ignore_input_events( json = yield cmd_dict +def set_intercept_drags( + enabled: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Prevents default drag and drop behavior and instead emits ``Input.dragIntercepted`` events. + Drag and drop behavior can be directly controlled via ``Input.dispatchDragEvent``. + + **EXPERIMENTAL** + + :param enabled: + ''' + params: T_JSON_DICT = dict() + params['enabled'] = enabled + cmd_dict: T_JSON_DICT = { + 'method': 'Input.setInterceptDrags', + 'params': params, + } + json = yield cmd_dict + + def synthesize_pinch_gesture( x: float, y: float, @@ -337,7 +551,7 @@ def synthesize_pinch_gesture( relative_speed: typing.Optional[int] = None, gesture_source_type: typing.Optional[GestureSourceType] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Synthesizes a pinch gesture over a time period by issuing appropriate touch events. **EXPERIMENTAL** @@ -377,7 +591,7 @@ def synthesize_scroll_gesture( repeat_delay_ms: typing.Optional[int] = None, interaction_marker_name: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Synthesizes a scroll gesture over a time period by issuing appropriate touch events. **EXPERIMENTAL** @@ -432,7 +646,7 @@ def synthesize_tap_gesture( tap_count: typing.Optional[int] = None, gesture_source_type: typing.Optional[GestureSourceType] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Synthesizes a tap gesture over a time period by issuing appropriate touch events. **EXPERIMENTAL** @@ -457,3 +671,21 @@ def synthesize_tap_gesture( 'params': params, } json = yield cmd_dict + + +@event_class('Input.dragIntercepted') +@dataclass +class DragIntercepted: + r''' + **EXPERIMENTAL** + + Emitted only when ``Input.setInterceptDrags`` is enabled. Use this data with ``Input.dispatchDragEvent`` to + restore normal drag and drop behavior. + ''' + data: DragData + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DragIntercepted: + return cls( + data=DragData.from_json(json['data']) + ) diff --git a/cdp/inspector.py b/cdp/inspector.py index b2e33ea..b1bce82 100644 --- a/cdp/inspector.py +++ b/cdp/inspector.py @@ -13,7 +13,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables inspector domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -23,7 +23,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables inspector domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -35,7 +35,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: @event_class('Inspector.detached') @dataclass class Detached: - ''' + r''' Fired when remote debugging connection is about to be terminated. Contains detach reason. ''' #: The reason why connection has been terminated. @@ -51,7 +51,7 @@ def from_json(cls, json: T_JSON_DICT) -> Detached: @event_class('Inspector.targetCrashed') @dataclass class TargetCrashed: - ''' + r''' Fired when debugging target has crashed ''' @@ -66,7 +66,7 @@ def from_json(cls, json: T_JSON_DICT) -> TargetCrashed: @event_class('Inspector.targetReloadedAfterCrash') @dataclass class TargetReloadedAfterCrash: - ''' + r''' Fired when debugging target has reloaded after crash ''' diff --git a/cdp/io.py b/cdp/io.py index 91b1cb2..0fe524c 100644 --- a/cdp/io.py +++ b/cdp/io.py @@ -15,8 +15,8 @@ class StreamHandle(str): - ''' - This is either obtained from another method or specifed as ``blob:<uuid>`` where + r''' + This is either obtained from another method or specified as ``blob:<uuid>`` where ``<uuid>`` is an UUID of a Blob. ''' def to_json(self) -> str: @@ -33,7 +33,7 @@ def __repr__(self): def close( handle: StreamHandle ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Close the stream, discard any temporary backing storage. :param handle: Handle of the stream to close. @@ -52,7 +52,7 @@ def read( offset: typing.Optional[int] = None, size: typing.Optional[int] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[bool], str, bool]]: - ''' + r''' Read a chunk of the stream :param handle: Handle of the stream to read. @@ -62,7 +62,7 @@ def read( 0. **base64Encoded** - *(Optional)* Set if the data is base64-encoded 1. **data** - Data that were read. - 2. **eof** - Set if the end-of-file condition occured while reading. + 2. **eof** - Set if the end-of-file condition occurred while reading. ''' params: T_JSON_DICT = dict() params['handle'] = handle.to_json() @@ -85,7 +85,7 @@ def read( def resolve_blob( object_id: runtime.RemoteObjectId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Return UUID of Blob object specified by a remote object id. :param object_id: Object id of a Blob object wrapper. diff --git a/cdp/layer_tree.py b/cdp/layer_tree.py index 7458d66..cdce3d7 100644 --- a/cdp/layer_tree.py +++ b/cdp/layer_tree.py @@ -15,7 +15,7 @@ class LayerId(str): - ''' + r''' Unique Layer identifier. ''' def to_json(self) -> str: @@ -30,7 +30,7 @@ def __repr__(self): class SnapshotId(str): - ''' + r''' Unique snapshot identifier. ''' def to_json(self) -> str: @@ -46,7 +46,7 @@ def __repr__(self): @dataclass class ScrollRect: - ''' + r''' Rectangle where scrolling happens on the main thread. ''' #: Rectangle itself. @@ -71,7 +71,7 @@ def from_json(cls, json: T_JSON_DICT) -> ScrollRect: @dataclass class StickyPositionConstraint: - ''' + r''' Sticky position constraints. ''' #: Layout rectangle of the sticky element before being shifted @@ -108,7 +108,7 @@ def from_json(cls, json: T_JSON_DICT) -> StickyPositionConstraint: @dataclass class PictureTile: - ''' + r''' Serialized fragment of layer picture along with its offset within the layer. ''' #: Offset from owning layer left boundary @@ -117,7 +117,7 @@ class PictureTile: #: Offset from owning layer top boundary y: float - #: Base64-encoded snapshot data. + #: Base64-encoded snapshot data. (Encoded as a base64 string when passed over JSON) picture: str def to_json(self) -> T_JSON_DICT: @@ -138,7 +138,7 @@ def from_json(cls, json: T_JSON_DICT) -> PictureTile: @dataclass class Layer: - ''' + r''' Information about a compositing layer. ''' #: The unique id for this layer. @@ -242,7 +242,7 @@ def from_json(cls, json: T_JSON_DICT) -> Layer: class PaintProfile(list): - ''' + r''' Array of timings, one per paint step. ''' def to_json(self) -> typing.List[float]: @@ -258,12 +258,15 @@ def __repr__(self): def compositing_reasons( layer_id: LayerId - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[str], typing.List[str]]]: + r''' Provides the reasons why the given layer was composited. :param layer_id: The id of the layer for which we want to get the reasons it was composited. - :returns: A list of strings specifying reasons for the given layer to become composited. + :returns: A tuple with the following items: + + 0. **compositingReasons** - A list of strings specifying reasons for the given layer to become composited. + 1. **compositingReasonIds** - A list of strings specifying reason IDs for the given layer to become composited. ''' params: T_JSON_DICT = dict() params['layerId'] = layer_id.to_json() @@ -272,11 +275,14 @@ def compositing_reasons( 'params': params, } json = yield cmd_dict - return [str(i) for i in json['compositingReasons']] + return ( + [str(i) for i in json['compositingReasons']], + [str(i) for i in json['compositingReasonIds']] + ) def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables compositing tree inspection. ''' cmd_dict: T_JSON_DICT = { @@ -286,7 +292,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables compositing tree inspection. ''' cmd_dict: T_JSON_DICT = { @@ -298,7 +304,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def load_snapshot( tiles: typing.List[PictureTile] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SnapshotId]: - ''' + r''' Returns the snapshot identifier. :param tiles: An array of tiles composing the snapshot. @@ -317,7 +323,7 @@ def load_snapshot( def make_snapshot( layer_id: LayerId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SnapshotId]: - ''' + r''' Returns the layer snapshot identifier. :param layer_id: The id of the layer. @@ -339,7 +345,7 @@ def profile_snapshot( min_duration: typing.Optional[float] = None, clip_rect: typing.Optional[dom.Rect] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[PaintProfile]]: - ''' + r''' :param snapshot_id: The id of the layer snapshot. :param min_repeat_count: *(Optional)* The maximum number of times to replay the snapshot (1, if not specified). :param min_duration: *(Optional)* The minimum duration (in seconds) to replay the snapshot. @@ -365,7 +371,7 @@ def profile_snapshot( def release_snapshot( snapshot_id: SnapshotId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Releases layer snapshot captured by the back-end. :param snapshot_id: The id of the layer snapshot. @@ -385,7 +391,7 @@ def replay_snapshot( to_step: typing.Optional[int] = None, scale: typing.Optional[float] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Replays the layer snapshot and returns the resulting bitmap. :param snapshot_id: The id of the layer snapshot. @@ -413,7 +419,7 @@ def replay_snapshot( def snapshot_command_log( snapshot_id: SnapshotId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[dict]]: - ''' + r''' Replays the layer snapshot and returns canvas log. :param snapshot_id: The id of the layer snapshot. diff --git a/cdp/log.py b/cdp/log.py index 825a931..5523a34 100644 --- a/cdp/log.py +++ b/cdp/log.py @@ -17,7 +17,7 @@ @dataclass class LogEntry: - ''' + r''' Log entry. ''' #: Log entry source. @@ -32,6 +32,8 @@ class LogEntry: #: Timestamp when this entry was added. timestamp: runtime.Timestamp + category: typing.Optional[str] = None + #: URL of the resource if known. url: typing.Optional[str] = None @@ -56,6 +58,8 @@ def to_json(self) -> T_JSON_DICT: json['level'] = self.level json['text'] = self.text json['timestamp'] = self.timestamp.to_json() + if self.category is not None: + json['category'] = self.category if self.url is not None: json['url'] = self.url if self.line_number is not None: @@ -77,6 +81,7 @@ def from_json(cls, json: T_JSON_DICT) -> LogEntry: level=str(json['level']), text=str(json['text']), timestamp=runtime.Timestamp.from_json(json['timestamp']), + category=str(json['category']) if 'category' in json else None, url=str(json['url']) if 'url' in json else None, line_number=int(json['lineNumber']) if 'lineNumber' in json else None, stack_trace=runtime.StackTrace.from_json(json['stackTrace']) if 'stackTrace' in json else None, @@ -88,7 +93,7 @@ def from_json(cls, json: T_JSON_DICT) -> LogEntry: @dataclass class ViolationSetting: - ''' + r''' Violation configuration setting. ''' #: Violation type. @@ -112,7 +117,7 @@ def from_json(cls, json: T_JSON_DICT) -> ViolationSetting: def clear() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears the log. ''' cmd_dict: T_JSON_DICT = { @@ -122,7 +127,7 @@ def clear() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables log domain, prevents further log entries from being reported to the client. ''' cmd_dict: T_JSON_DICT = { @@ -132,7 +137,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables log domain, sends the entries collected so far to the client by means of the ``entryAdded`` notification. ''' @@ -145,7 +150,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def start_violations_report( config: typing.List[ViolationSetting] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' start violation reporting. :param config: Configuration for violations. @@ -160,7 +165,7 @@ def start_violations_report( def stop_violations_report() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Stop violation reporting. ''' cmd_dict: T_JSON_DICT = { @@ -172,7 +177,7 @@ def stop_violations_report() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: @event_class('Log.entryAdded') @dataclass class EntryAdded: - ''' + r''' Issued when new message was logged. ''' #: The entry. diff --git a/cdp/media.py b/cdp/media.py new file mode 100644 index 0000000..478aea6 --- /dev/null +++ b/cdp/media.py @@ -0,0 +1,253 @@ +# DO NOT EDIT THIS FILE! +# +# This file is generated from the CDP specification. If you need to make +# changes, edit the generator and regenerate all of the modules. +# +# CDP domain: Media (experimental) + +from __future__ import annotations +from cdp.util import event_class, T_JSON_DICT +from dataclasses import dataclass +import enum +import typing + + +class PlayerId(str): + r''' + Players will get an ID that is unique within the agent context. + ''' + def to_json(self) -> str: + return self + + @classmethod + def from_json(cls, json: str) -> PlayerId: + return cls(json) + + def __repr__(self): + return 'PlayerId({})'.format(super().__repr__()) + + +class Timestamp(float): + def to_json(self) -> float: + return self + + @classmethod + def from_json(cls, json: float) -> Timestamp: + return cls(json) + + def __repr__(self): + return 'Timestamp({})'.format(super().__repr__()) + + +@dataclass +class PlayerMessage: + r''' + Have one type per entry in MediaLogRecord::Type + Corresponds to kMessage + ''' + #: Keep in sync with MediaLogMessageLevel + #: We are currently keeping the message level 'error' separate from the + #: PlayerError type because right now they represent different things, + #: this one being a DVLOG(ERROR) style log message that gets printed + #: based on what log level is selected in the UI, and the other is a + #: representation of a media::PipelineStatus object. Soon however we're + #: going to be moving away from using PipelineStatus for errors and + #: introducing a new error type which should hopefully let us integrate + #: the error log level into the PlayerError type. + level: str + + message: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['level'] = self.level + json['message'] = self.message + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerMessage: + return cls( + level=str(json['level']), + message=str(json['message']), + ) + + +@dataclass +class PlayerProperty: + r''' + Corresponds to kMediaPropertyChange + ''' + name: str + + value: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + json['value'] = self.value + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerProperty: + return cls( + name=str(json['name']), + value=str(json['value']), + ) + + +@dataclass +class PlayerEvent: + r''' + Corresponds to kMediaEventTriggered + ''' + timestamp: Timestamp + + value: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['timestamp'] = self.timestamp.to_json() + json['value'] = self.value + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerEvent: + return cls( + timestamp=Timestamp.from_json(json['timestamp']), + value=str(json['value']), + ) + + +@dataclass +class PlayerError: + r''' + Corresponds to kMediaError + ''' + type_: str + + #: When this switches to using media::Status instead of PipelineStatus + #: we can remove "errorCode" and replace it with the fields from + #: a Status instance. This also seems like a duplicate of the error + #: level enum - there is a todo bug to have that level removed and + #: use this instead. (crbug.com/1068454) + error_code: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['type'] = self.type_ + json['errorCode'] = self.error_code + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerError: + return cls( + type_=str(json['type']), + error_code=str(json['errorCode']), + ) + + +def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Enables the Media domain + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Media.enable', + } + json = yield cmd_dict + + +def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Disables the Media domain. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Media.disable', + } + json = yield cmd_dict + + +@event_class('Media.playerPropertiesChanged') +@dataclass +class PlayerPropertiesChanged: + r''' + This can be called multiple times, and can be used to set / override / + remove player properties. A null propValue indicates removal. + ''' + player_id: PlayerId + properties: typing.List[PlayerProperty] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerPropertiesChanged: + return cls( + player_id=PlayerId.from_json(json['playerId']), + properties=[PlayerProperty.from_json(i) for i in json['properties']] + ) + + +@event_class('Media.playerEventsAdded') +@dataclass +class PlayerEventsAdded: + r''' + Send events as a list, allowing them to be batched on the browser for less + congestion. If batched, events must ALWAYS be in chronological order. + ''' + player_id: PlayerId + events: typing.List[PlayerEvent] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerEventsAdded: + return cls( + player_id=PlayerId.from_json(json['playerId']), + events=[PlayerEvent.from_json(i) for i in json['events']] + ) + + +@event_class('Media.playerMessagesLogged') +@dataclass +class PlayerMessagesLogged: + r''' + Send a list of any messages that need to be delivered. + ''' + player_id: PlayerId + messages: typing.List[PlayerMessage] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerMessagesLogged: + return cls( + player_id=PlayerId.from_json(json['playerId']), + messages=[PlayerMessage.from_json(i) for i in json['messages']] + ) + + +@event_class('Media.playerErrorsRaised') +@dataclass +class PlayerErrorsRaised: + r''' + Send a list of any errors that need to be delivered. + ''' + player_id: PlayerId + errors: typing.List[PlayerError] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayerErrorsRaised: + return cls( + player_id=PlayerId.from_json(json['playerId']), + errors=[PlayerError.from_json(i) for i in json['errors']] + ) + + +@event_class('Media.playersCreated') +@dataclass +class PlayersCreated: + r''' + Called whenever a player is created, or when a new agent joins and receives + a list of active players. If an agent is restored, it will receive the full + list of player ids and all events again. + ''' + players: typing.List[PlayerId] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PlayersCreated: + return cls( + players=[PlayerId.from_json(i) for i in json['players']] + ) diff --git a/cdp/memory.py b/cdp/memory.py index 6647a7f..1d00c1f 100644 --- a/cdp/memory.py +++ b/cdp/memory.py @@ -13,7 +13,7 @@ class PressureLevel(enum.Enum): - ''' + r''' Memory pressure level. ''' MODERATE = "moderate" @@ -29,7 +29,7 @@ def from_json(cls, json: str) -> PressureLevel: @dataclass class SamplingProfileNode: - ''' + r''' Heap profile sample. ''' #: Size of the sampled allocation. @@ -59,7 +59,7 @@ def from_json(cls, json: T_JSON_DICT) -> SamplingProfileNode: @dataclass class SamplingProfile: - ''' + r''' Array of heap profile samples. ''' samples: typing.List[SamplingProfileNode] @@ -82,7 +82,7 @@ def from_json(cls, json: T_JSON_DICT) -> SamplingProfile: @dataclass class Module: - ''' + r''' Executable module information ''' #: Name of the module. @@ -117,7 +117,7 @@ def from_json(cls, json: T_JSON_DICT) -> Module: def get_dom_counters() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[int, int, int]]: - ''' + r''' :returns: A tuple with the following items: @@ -146,7 +146,7 @@ def prepare_for_leak_detection() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Non def forcibly_purge_java_script_memory() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Simulate OomIntervention by purging V8 memory. ''' cmd_dict: T_JSON_DICT = { @@ -158,7 +158,7 @@ def forcibly_purge_java_script_memory() -> typing.Generator[T_JSON_DICT,T_JSON_D def set_pressure_notifications_suppressed( suppressed: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enable/disable suppressing memory pressure notifications in all processes. :param suppressed: If true, memory pressure notifications will be suppressed. @@ -175,7 +175,7 @@ def set_pressure_notifications_suppressed( def simulate_pressure_notification( level: PressureLevel ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Simulate a memory pressure notification in all processes. :param level: Memory pressure level of the notification. @@ -193,7 +193,7 @@ def start_sampling( sampling_interval: typing.Optional[int] = None, suppress_randomness: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Start collecting native memory profile. :param sampling_interval: *(Optional)* Average number of bytes between samples. @@ -212,7 +212,7 @@ def start_sampling( def stop_sampling() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Stop collecting native memory profile. ''' cmd_dict: T_JSON_DICT = { @@ -222,7 +222,7 @@ def stop_sampling() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_all_time_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingProfile]: - ''' + r''' Retrieve native memory allocations profile collected since renderer process startup. @@ -236,7 +236,7 @@ def get_all_time_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT, def get_browser_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingProfile]: - ''' + r''' Retrieve native memory allocations profile collected since browser process startup. @@ -250,7 +250,7 @@ def get_browser_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,S def get_sampling_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SamplingProfile]: - ''' + r''' Retrieve native memory allocations profile collected since last ``startSampling`` call. diff --git a/cdp/network.py b/cdp/network.py index 6e60c51..815ff7d 100644 --- a/cdp/network.py +++ b/cdp/network.py @@ -12,6 +12,7 @@ import typing from . import debugger +from . import emulation from . import io from . import page from . import runtime @@ -20,7 +21,7 @@ class ResourceType(enum.Enum): - ''' + r''' Resource type as it was perceived by the rendering engine. ''' DOCUMENT = "Document" @@ -38,6 +39,7 @@ class ResourceType(enum.Enum): SIGNED_EXCHANGE = "SignedExchange" PING = "Ping" CSP_VIOLATION_REPORT = "CSPViolationReport" + PREFLIGHT = "Preflight" OTHER = "Other" def to_json(self) -> str: @@ -49,7 +51,7 @@ def from_json(cls, json: str) -> ResourceType: class LoaderId(str): - ''' + r''' Unique loader identifier. ''' def to_json(self) -> str: @@ -64,7 +66,7 @@ def __repr__(self): class RequestId(str): - ''' + r''' Unique request identifier. ''' def to_json(self) -> str: @@ -79,7 +81,7 @@ def __repr__(self): class InterceptionId(str): - ''' + r''' Unique intercepted request identifier. ''' def to_json(self) -> str: @@ -94,7 +96,7 @@ def __repr__(self): class ErrorReason(enum.Enum): - ''' + r''' Network level fetch failure reason. ''' FAILED = "Failed" @@ -121,7 +123,7 @@ def from_json(cls, json: str) -> ErrorReason: class TimeSinceEpoch(float): - ''' + r''' UTC time in seconds, counted from January 1, 1970. ''' def to_json(self) -> float: @@ -136,7 +138,7 @@ def __repr__(self): class MonotonicTime(float): - ''' + r''' Monotonically increasing time in seconds since an arbitrary point in the past. ''' def to_json(self) -> float: @@ -151,7 +153,7 @@ def __repr__(self): class Headers(dict): - ''' + r''' Request / response headers as keys / values of JSON object. ''' def to_json(self) -> dict: @@ -166,7 +168,7 @@ def __repr__(self): class ConnectionType(enum.Enum): - ''' + r''' The underlying connection technology that the browser is supposedly using. ''' NONE = "none" @@ -188,13 +190,12 @@ def from_json(cls, json: str) -> ConnectionType: class CookieSameSite(enum.Enum): - ''' + r''' Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookies ''' STRICT = "Strict" LAX = "Lax" - EXTENDED = "Extended" NONE = "None" def to_json(self) -> str: @@ -205,9 +206,44 @@ def from_json(cls, json: str) -> CookieSameSite: return cls(json) +class CookiePriority(enum.Enum): + r''' + Represents the cookie's 'Priority' status: + https://tools.ietf.org/html/draft-west-cookie-priority-00 + ''' + LOW = "Low" + MEDIUM = "Medium" + HIGH = "High" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CookiePriority: + return cls(json) + + +class CookieSourceScheme(enum.Enum): + r''' + Represents the source scheme of the origin that originally set the cookie. + A value of "Unset" allows protocol clients to emulate legacy cookie scope for the scheme. + This is a temporary ability and it will be removed in the future. + ''' + UNSET = "Unset" + NON_SECURE = "NonSecure" + SECURE = "Secure" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CookieSourceScheme: + return cls(json) + + @dataclass class ResourceTiming: - ''' + r''' Timing information for the request. ''' #: Timing's requestTime is a baseline in seconds, while the other numbers are ticks in @@ -244,6 +280,12 @@ class ResourceTiming: #: Finished Starting ServiceWorker. worker_ready: float + #: Started fetch event. + worker_fetch_start: float + + #: Settled fetch event respondWith promise. + worker_respond_with_settled: float + #: Started sending request. send_start: float @@ -272,6 +314,8 @@ def to_json(self) -> T_JSON_DICT: json['sslEnd'] = self.ssl_end json['workerStart'] = self.worker_start json['workerReady'] = self.worker_ready + json['workerFetchStart'] = self.worker_fetch_start + json['workerRespondWithSettled'] = self.worker_respond_with_settled json['sendStart'] = self.send_start json['sendEnd'] = self.send_end json['pushStart'] = self.push_start @@ -293,6 +337,8 @@ def from_json(cls, json: T_JSON_DICT) -> ResourceTiming: ssl_end=float(json['sslEnd']), worker_start=float(json['workerStart']), worker_ready=float(json['workerReady']), + worker_fetch_start=float(json['workerFetchStart']), + worker_respond_with_settled=float(json['workerRespondWithSettled']), send_start=float(json['sendStart']), send_end=float(json['sendEnd']), push_start=float(json['pushStart']), @@ -302,7 +348,7 @@ def from_json(cls, json: T_JSON_DICT) -> ResourceTiming: class ResourcePriority(enum.Enum): - ''' + r''' Loading priority of a resource request. ''' VERY_LOW = "VeryLow" @@ -320,8 +366,28 @@ def from_json(cls, json: str) -> ResourcePriority: @dataclass -class Request: +class PostDataEntry: + r''' + Post data entry for HTTP request ''' + bytes_: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.bytes_ is not None: + json['bytes'] = self.bytes_ + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PostDataEntry: + return cls( + bytes_=str(json['bytes']) if 'bytes' in json else None, + ) + + +@dataclass +class Request: + r''' HTTP request data. ''' #: Request URL (without fragment). @@ -348,12 +414,23 @@ class Request: #: True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. has_post_data: typing.Optional[bool] = None + #: Request body elements. This will be converted from base64 to binary + post_data_entries: typing.Optional[typing.List[PostDataEntry]] = None + #: The mixed content type of the request. mixed_content_type: typing.Optional[security.MixedContentType] = None #: Whether is loaded via link preload. is_link_preload: typing.Optional[bool] = None + #: Set for requests when the TrustToken API is used. Contains the parameters + #: passed by the developer (e.g. via "fetch") as understood by the backend. + trust_token_params: typing.Optional[TrustTokenParams] = None + + #: True if this resource request is considered to be the 'same site' as the + #: request correspondinfg to the main frame. + is_same_site: typing.Optional[bool] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['url'] = self.url @@ -367,10 +444,16 @@ def to_json(self) -> T_JSON_DICT: json['postData'] = self.post_data if self.has_post_data is not None: json['hasPostData'] = self.has_post_data + if self.post_data_entries is not None: + json['postDataEntries'] = [i.to_json() for i in self.post_data_entries] if self.mixed_content_type is not None: json['mixedContentType'] = self.mixed_content_type.to_json() if self.is_link_preload is not None: json['isLinkPreload'] = self.is_link_preload + if self.trust_token_params is not None: + json['trustTokenParams'] = self.trust_token_params.to_json() + if self.is_same_site is not None: + json['isSameSite'] = self.is_same_site return json @classmethod @@ -384,14 +467,17 @@ def from_json(cls, json: T_JSON_DICT) -> Request: url_fragment=str(json['urlFragment']) if 'urlFragment' in json else None, post_data=str(json['postData']) if 'postData' in json else None, has_post_data=bool(json['hasPostData']) if 'hasPostData' in json else None, + post_data_entries=[PostDataEntry.from_json(i) for i in json['postDataEntries']] if 'postDataEntries' in json else None, mixed_content_type=security.MixedContentType.from_json(json['mixedContentType']) if 'mixedContentType' in json else None, is_link_preload=bool(json['isLinkPreload']) if 'isLinkPreload' in json else None, + trust_token_params=TrustTokenParams.from_json(json['trustTokenParams']) if 'trustTokenParams' in json else None, + is_same_site=bool(json['isSameSite']) if 'isSameSite' in json else None, ) @dataclass class SignedCertificateTimestamp: - ''' + r''' Details of a signed certificate timestamp (SCT). ''' #: Validation status. @@ -406,8 +492,9 @@ class SignedCertificateTimestamp: #: Log ID. log_id: str - #: Issuance date. - timestamp: TimeSinceEpoch + #: Issuance date. Unlike TimeSinceEpoch, this contains the number of + #: milliseconds since January 1, 1970, UTC, not the number of seconds. + timestamp: float #: Hash algorithm. hash_algorithm: str @@ -424,7 +511,7 @@ def to_json(self) -> T_JSON_DICT: json['origin'] = self.origin json['logDescription'] = self.log_description json['logId'] = self.log_id - json['timestamp'] = self.timestamp.to_json() + json['timestamp'] = self.timestamp json['hashAlgorithm'] = self.hash_algorithm json['signatureAlgorithm'] = self.signature_algorithm json['signatureData'] = self.signature_data @@ -437,7 +524,7 @@ def from_json(cls, json: T_JSON_DICT) -> SignedCertificateTimestamp: origin=str(json['origin']), log_description=str(json['logDescription']), log_id=str(json['logId']), - timestamp=TimeSinceEpoch.from_json(json['timestamp']), + timestamp=float(json['timestamp']), hash_algorithm=str(json['hashAlgorithm']), signature_algorithm=str(json['signatureAlgorithm']), signature_data=str(json['signatureData']), @@ -446,7 +533,7 @@ def from_json(cls, json: T_JSON_DICT) -> SignedCertificateTimestamp: @dataclass class SecurityDetails: - ''' + r''' Security details about a request. ''' #: Protocol name (e.g. "TLS 1.2" or "QUIC"). @@ -527,7 +614,7 @@ def from_json(cls, json: T_JSON_DICT) -> SecurityDetails: class CertificateTransparencyCompliance(enum.Enum): - ''' + r''' Whether the request complied with Certificate Transparency policy. ''' UNKNOWN = "unknown" @@ -543,7 +630,7 @@ def from_json(cls, json: str) -> CertificateTransparencyCompliance: class BlockedReason(enum.Enum): - ''' + r''' The reason why request was blocked. ''' OTHER = "other" @@ -553,7 +640,11 @@ class BlockedReason(enum.Enum): INSPECTOR = "inspector" SUBRESOURCE_FILTER = "subresource-filter" CONTENT_TYPE = "content-type" - COLLAPSED_BY_CLIENT = "collapsed-by-client" + COEP_FRAME_RESOURCE_NEEDS_COEP_HEADER = "coep-frame-resource-needs-coep-header" + COOP_SANDBOXED_IFRAME_CANNOT_NAVIGATE_TO_COOP_PAGE = "coop-sandboxed-iframe-cannot-navigate-to-coop-page" + CORP_NOT_SAME_ORIGIN = "corp-not-same-origin" + CORP_NOT_SAME_ORIGIN_AFTER_DEFAULTED_TO_SAME_ORIGIN_BY_COEP = "corp-not-same-origin-after-defaulted-to-same-origin-by-coep" + CORP_NOT_SAME_SITE = "corp-not-same-site" def to_json(self) -> str: return self.value @@ -563,9 +654,136 @@ def from_json(cls, json: str) -> BlockedReason: return cls(json) +class CorsError(enum.Enum): + r''' + The reason why request was blocked. + ''' + DISALLOWED_BY_MODE = "DisallowedByMode" + INVALID_RESPONSE = "InvalidResponse" + WILDCARD_ORIGIN_NOT_ALLOWED = "WildcardOriginNotAllowed" + MISSING_ALLOW_ORIGIN_HEADER = "MissingAllowOriginHeader" + MULTIPLE_ALLOW_ORIGIN_VALUES = "MultipleAllowOriginValues" + INVALID_ALLOW_ORIGIN_VALUE = "InvalidAllowOriginValue" + ALLOW_ORIGIN_MISMATCH = "AllowOriginMismatch" + INVALID_ALLOW_CREDENTIALS = "InvalidAllowCredentials" + CORS_DISABLED_SCHEME = "CorsDisabledScheme" + PREFLIGHT_INVALID_STATUS = "PreflightInvalidStatus" + PREFLIGHT_DISALLOWED_REDIRECT = "PreflightDisallowedRedirect" + PREFLIGHT_WILDCARD_ORIGIN_NOT_ALLOWED = "PreflightWildcardOriginNotAllowed" + PREFLIGHT_MISSING_ALLOW_ORIGIN_HEADER = "PreflightMissingAllowOriginHeader" + PREFLIGHT_MULTIPLE_ALLOW_ORIGIN_VALUES = "PreflightMultipleAllowOriginValues" + PREFLIGHT_INVALID_ALLOW_ORIGIN_VALUE = "PreflightInvalidAllowOriginValue" + PREFLIGHT_ALLOW_ORIGIN_MISMATCH = "PreflightAllowOriginMismatch" + PREFLIGHT_INVALID_ALLOW_CREDENTIALS = "PreflightInvalidAllowCredentials" + PREFLIGHT_MISSING_ALLOW_EXTERNAL = "PreflightMissingAllowExternal" + PREFLIGHT_INVALID_ALLOW_EXTERNAL = "PreflightInvalidAllowExternal" + PREFLIGHT_MISSING_ALLOW_PRIVATE_NETWORK = "PreflightMissingAllowPrivateNetwork" + PREFLIGHT_INVALID_ALLOW_PRIVATE_NETWORK = "PreflightInvalidAllowPrivateNetwork" + INVALID_ALLOW_METHODS_PREFLIGHT_RESPONSE = "InvalidAllowMethodsPreflightResponse" + INVALID_ALLOW_HEADERS_PREFLIGHT_RESPONSE = "InvalidAllowHeadersPreflightResponse" + METHOD_DISALLOWED_BY_PREFLIGHT_RESPONSE = "MethodDisallowedByPreflightResponse" + HEADER_DISALLOWED_BY_PREFLIGHT_RESPONSE = "HeaderDisallowedByPreflightResponse" + REDIRECT_CONTAINS_CREDENTIALS = "RedirectContainsCredentials" + INSECURE_PRIVATE_NETWORK = "InsecurePrivateNetwork" + INVALID_PRIVATE_NETWORK_ACCESS = "InvalidPrivateNetworkAccess" + UNEXPECTED_PRIVATE_NETWORK_ACCESS = "UnexpectedPrivateNetworkAccess" + NO_CORS_REDIRECT_MODE_NOT_FOLLOW = "NoCorsRedirectModeNotFollow" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CorsError: + return cls(json) + + @dataclass -class Response: +class CorsErrorStatus: + cors_error: CorsError + + failed_parameter: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['corsError'] = self.cors_error.to_json() + json['failedParameter'] = self.failed_parameter + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CorsErrorStatus: + return cls( + cors_error=CorsError.from_json(json['corsError']), + failed_parameter=str(json['failedParameter']), + ) + + +class ServiceWorkerResponseSource(enum.Enum): + r''' + Source of serviceworker response. + ''' + CACHE_STORAGE = "cache-storage" + HTTP_CACHE = "http-cache" + FALLBACK_CODE = "fallback-code" + NETWORK = "network" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ServiceWorkerResponseSource: + return cls(json) + + +@dataclass +class TrustTokenParams: + r''' + Determines what type of Trust Token operation is executed and + depending on the type, some additional parameters. The values + are specified in third_party/blink/renderer/core/fetch/trust_token.idl. ''' + type_: TrustTokenOperationType + + #: Only set for "token-redemption" type and determine whether + #: to request a fresh SRR or use a still valid cached SRR. + refresh_policy: str + + #: Origins of issuers from whom to request tokens or redemption + #: records. + issuers: typing.Optional[typing.List[str]] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['type'] = self.type_.to_json() + json['refreshPolicy'] = self.refresh_policy + if self.issuers is not None: + json['issuers'] = [i for i in self.issuers] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> TrustTokenParams: + return cls( + type_=TrustTokenOperationType.from_json(json['type']), + refresh_policy=str(json['refreshPolicy']), + issuers=[str(i) for i in json['issuers']] if 'issuers' in json else None, + ) + + +class TrustTokenOperationType(enum.Enum): + ISSUANCE = "Issuance" + REDEMPTION = "Redemption" + SIGNING = "Signing" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> TrustTokenOperationType: + return cls(json) + + +@dataclass +class Response: + r''' HTTP response data. ''' #: Response URL. This URL can be different from CachedResource.url in case of redirect. @@ -595,13 +813,13 @@ class Response: #: Security state of the request resource. security_state: security.SecurityState - #: HTTP response headers text. + #: HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo. headers_text: typing.Optional[str] = None #: Refined HTTP request headers that were actually transmitted over the network. request_headers: typing.Optional[Headers] = None - #: HTTP request headers text. + #: HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo. request_headers_text: typing.Optional[str] = None #: Remote IP address. @@ -622,6 +840,15 @@ class Response: #: Timing information for the given request. timing: typing.Optional[ResourceTiming] = None + #: Response source of response from ServiceWorker. + service_worker_response_source: typing.Optional[ServiceWorkerResponseSource] = None + + #: The time at which the returned response was generated. + response_time: typing.Optional[TimeSinceEpoch] = None + + #: Cache Storage Cache Name. + cache_storage_cache_name: typing.Optional[str] = None + #: Protocol used to fetch this request. protocol: typing.Optional[str] = None @@ -657,6 +884,12 @@ def to_json(self) -> T_JSON_DICT: json['fromPrefetchCache'] = self.from_prefetch_cache if self.timing is not None: json['timing'] = self.timing.to_json() + if self.service_worker_response_source is not None: + json['serviceWorkerResponseSource'] = self.service_worker_response_source.to_json() + if self.response_time is not None: + json['responseTime'] = self.response_time.to_json() + if self.cache_storage_cache_name is not None: + json['cacheStorageCacheName'] = self.cache_storage_cache_name if self.protocol is not None: json['protocol'] = self.protocol if self.security_details is not None: @@ -684,6 +917,9 @@ def from_json(cls, json: T_JSON_DICT) -> Response: from_service_worker=bool(json['fromServiceWorker']) if 'fromServiceWorker' in json else None, from_prefetch_cache=bool(json['fromPrefetchCache']) if 'fromPrefetchCache' in json else None, timing=ResourceTiming.from_json(json['timing']) if 'timing' in json else None, + service_worker_response_source=ServiceWorkerResponseSource.from_json(json['serviceWorkerResponseSource']) if 'serviceWorkerResponseSource' in json else None, + response_time=TimeSinceEpoch.from_json(json['responseTime']) if 'responseTime' in json else None, + cache_storage_cache_name=str(json['cacheStorageCacheName']) if 'cacheStorageCacheName' in json else None, protocol=str(json['protocol']) if 'protocol' in json else None, security_details=SecurityDetails.from_json(json['securityDetails']) if 'securityDetails' in json else None, ) @@ -691,7 +927,7 @@ def from_json(cls, json: T_JSON_DICT) -> Response: @dataclass class WebSocketRequest: - ''' + r''' WebSocket request data. ''' #: HTTP request headers. @@ -711,7 +947,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketRequest: @dataclass class WebSocketResponse: - ''' + r''' WebSocket response data. ''' #: HTTP response status code. @@ -759,7 +995,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketResponse: @dataclass class WebSocketFrame: - ''' + r''' WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests. ''' #: WebSocket message opcode. @@ -791,7 +1027,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketFrame: @dataclass class CachedResource: - ''' + r''' Information about the cached resource. ''' #: Resource URL. This is the url of the original network request. @@ -827,7 +1063,7 @@ def from_json(cls, json: T_JSON_DICT) -> CachedResource: @dataclass class Initiator: - ''' + r''' Information about the request initiator. ''' #: Type of this initiator. @@ -843,6 +1079,13 @@ class Initiator: #: module) (0-based). line_number: typing.Optional[float] = None + #: Initiator column number, set for Parser type or for Script type (when script is importing + #: module) (0-based). + column_number: typing.Optional[float] = None + + #: Set if another request triggered this request (e.g. preflight). + request_id: typing.Optional[RequestId] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['type'] = self.type_ @@ -852,6 +1095,10 @@ def to_json(self) -> T_JSON_DICT: json['url'] = self.url if self.line_number is not None: json['lineNumber'] = self.line_number + if self.column_number is not None: + json['columnNumber'] = self.column_number + if self.request_id is not None: + json['requestId'] = self.request_id.to_json() return json @classmethod @@ -861,12 +1108,14 @@ def from_json(cls, json: T_JSON_DICT) -> Initiator: stack=runtime.StackTrace.from_json(json['stack']) if 'stack' in json else None, url=str(json['url']) if 'url' in json else None, line_number=float(json['lineNumber']) if 'lineNumber' in json else None, + column_number=float(json['columnNumber']) if 'columnNumber' in json else None, + request_id=RequestId.from_json(json['requestId']) if 'requestId' in json else None, ) @dataclass class Cookie: - ''' + r''' Cookie object ''' #: Cookie name. @@ -896,9 +1145,30 @@ class Cookie: #: True in case of session cookie. session: bool + #: Cookie Priority + priority: CookiePriority + + #: True if cookie is SameParty. + same_party: bool + + #: Cookie source scheme type. + source_scheme: CookieSourceScheme + + #: Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. + #: An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. + #: This is a temporary ability and it will be removed in the future. + source_port: int + #: Cookie SameSite type. same_site: typing.Optional[CookieSameSite] = None + #: Cookie partition key. The site of the top-level URL the browser was visiting at the start + #: of the request to the endpoint that set the cookie. + partition_key: typing.Optional[str] = None + + #: True if cookie partition key is opaque. + partition_key_opaque: typing.Optional[bool] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['name'] = self.name @@ -910,8 +1180,16 @@ def to_json(self) -> T_JSON_DICT: json['httpOnly'] = self.http_only json['secure'] = self.secure json['session'] = self.session + json['priority'] = self.priority.to_json() + json['sameParty'] = self.same_party + json['sourceScheme'] = self.source_scheme.to_json() + json['sourcePort'] = self.source_port if self.same_site is not None: json['sameSite'] = self.same_site.to_json() + if self.partition_key is not None: + json['partitionKey'] = self.partition_key + if self.partition_key_opaque is not None: + json['partitionKeyOpaque'] = self.partition_key_opaque return json @classmethod @@ -926,18 +1204,23 @@ def from_json(cls, json: T_JSON_DICT) -> Cookie: http_only=bool(json['httpOnly']), secure=bool(json['secure']), session=bool(json['session']), + priority=CookiePriority.from_json(json['priority']), + same_party=bool(json['sameParty']), + source_scheme=CookieSourceScheme.from_json(json['sourceScheme']), + source_port=int(json['sourcePort']), same_site=CookieSameSite.from_json(json['sameSite']) if 'sameSite' in json else None, + partition_key=str(json['partitionKey']) if 'partitionKey' in json else None, + partition_key_opaque=bool(json['partitionKeyOpaque']) if 'partitionKeyOpaque' in json else None, ) class SetCookieBlockedReason(enum.Enum): - ''' + r''' Types of reasons why a cookie may not be stored from a response. ''' SECURE_ONLY = "SecureOnly" SAME_SITE_STRICT = "SameSiteStrict" SAME_SITE_LAX = "SameSiteLax" - SAME_SITE_EXTENDED = "SameSiteExtended" SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "SameSiteUnspecifiedTreatedAsLax" SAME_SITE_NONE_INSECURE = "SameSiteNoneInsecure" USER_PREFERENCES = "UserPreferences" @@ -947,6 +1230,12 @@ class SetCookieBlockedReason(enum.Enum): INVALID_DOMAIN = "InvalidDomain" INVALID_PREFIX = "InvalidPrefix" UNKNOWN_ERROR = "UnknownError" + SCHEMEFUL_SAME_SITE_STRICT = "SchemefulSameSiteStrict" + SCHEMEFUL_SAME_SITE_LAX = "SchemefulSameSiteLax" + SCHEMEFUL_SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "SchemefulSameSiteUnspecifiedTreatedAsLax" + SAME_PARTY_FROM_CROSS_PARTY_CONTEXT = "SamePartyFromCrossPartyContext" + SAME_PARTY_CONFLICTS_WITH_OTHER_ATTRIBUTES = "SamePartyConflictsWithOtherAttributes" + NAME_VALUE_PAIR_EXCEEDS_MAX_SIZE = "NameValuePairExceedsMaxSize" def to_json(self) -> str: return self.value @@ -957,7 +1246,7 @@ def from_json(cls, json: str) -> SetCookieBlockedReason: class CookieBlockedReason(enum.Enum): - ''' + r''' Types of reasons why a cookie may not be sent with a request. ''' SECURE_ONLY = "SecureOnly" @@ -965,11 +1254,15 @@ class CookieBlockedReason(enum.Enum): DOMAIN_MISMATCH = "DomainMismatch" SAME_SITE_STRICT = "SameSiteStrict" SAME_SITE_LAX = "SameSiteLax" - SAME_SITE_EXTENDED = "SameSiteExtended" SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "SameSiteUnspecifiedTreatedAsLax" SAME_SITE_NONE_INSECURE = "SameSiteNoneInsecure" USER_PREFERENCES = "UserPreferences" UNKNOWN_ERROR = "UnknownError" + SCHEMEFUL_SAME_SITE_STRICT = "SchemefulSameSiteStrict" + SCHEMEFUL_SAME_SITE_LAX = "SchemefulSameSiteLax" + SCHEMEFUL_SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "SchemefulSameSiteUnspecifiedTreatedAsLax" + SAME_PARTY_FROM_CROSS_PARTY_CONTEXT = "SamePartyFromCrossPartyContext" + NAME_VALUE_PAIR_EXCEEDS_MAX_SIZE = "NameValuePairExceedsMaxSize" def to_json(self) -> str: return self.value @@ -981,11 +1274,11 @@ def from_json(cls, json: str) -> CookieBlockedReason: @dataclass class BlockedSetCookieWithReason: - ''' + r''' A cookie which was not stored from a response with the corresponding reason. ''' - #: The reason this cookie was blocked. - blocked_reason: SetCookieBlockedReason + #: The reason(s) this cookie was blocked. + blocked_reasons: typing.List[SetCookieBlockedReason] #: The string representing this individual cookie as it would appear in the header. #: This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. @@ -998,7 +1291,7 @@ class BlockedSetCookieWithReason: def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() - json['blockedReason'] = self.blocked_reason.to_json() + json['blockedReasons'] = [i.to_json() for i in self.blocked_reasons] json['cookieLine'] = self.cookie_line if self.cookie is not None: json['cookie'] = self.cookie.to_json() @@ -1007,7 +1300,7 @@ def to_json(self) -> T_JSON_DICT: @classmethod def from_json(cls, json: T_JSON_DICT) -> BlockedSetCookieWithReason: return cls( - blocked_reason=SetCookieBlockedReason.from_json(json['blockedReason']), + blocked_reasons=[SetCookieBlockedReason.from_json(i) for i in json['blockedReasons']], cookie_line=str(json['cookieLine']), cookie=Cookie.from_json(json['cookie']) if 'cookie' in json else None, ) @@ -1015,32 +1308,32 @@ def from_json(cls, json: T_JSON_DICT) -> BlockedSetCookieWithReason: @dataclass class BlockedCookieWithReason: - ''' + r''' A cookie with was not sent with a request with the corresponding reason. ''' - #: The reason the cookie was blocked. - blocked_reason: CookieBlockedReason + #: The reason(s) the cookie was blocked. + blocked_reasons: typing.List[CookieBlockedReason] #: The cookie object representing the cookie which was not sent. cookie: Cookie def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() - json['blockedReason'] = self.blocked_reason.to_json() + json['blockedReasons'] = [i.to_json() for i in self.blocked_reasons] json['cookie'] = self.cookie.to_json() return json @classmethod def from_json(cls, json: T_JSON_DICT) -> BlockedCookieWithReason: return cls( - blocked_reason=CookieBlockedReason.from_json(json['blockedReason']), + blocked_reasons=[CookieBlockedReason.from_json(i) for i in json['blockedReasons']], cookie=Cookie.from_json(json['cookie']), ) @dataclass class CookieParam: - ''' + r''' Cookie parameter object ''' #: Cookie name. @@ -1050,7 +1343,7 @@ class CookieParam: value: str #: The request-URI to associate with the setting of the cookie. This value can affect the - #: default domain and path values of the created cookie. + #: default domain, path, source port, and source scheme values of the created cookie. url: typing.Optional[str] = None #: Cookie domain. @@ -1071,6 +1364,25 @@ class CookieParam: #: Cookie expiration date, session cookie if not set expires: typing.Optional[TimeSinceEpoch] = None + #: Cookie Priority. + priority: typing.Optional[CookiePriority] = None + + #: True if cookie is SameParty. + same_party: typing.Optional[bool] = None + + #: Cookie source scheme type. + source_scheme: typing.Optional[CookieSourceScheme] = None + + #: Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. + #: An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. + #: This is a temporary ability and it will be removed in the future. + source_port: typing.Optional[int] = None + + #: Cookie partition key. The site of the top-level URL the browser was visiting at the start + #: of the request to the endpoint that set the cookie. + #: If not set, the cookie will be set as not partitioned. + partition_key: typing.Optional[str] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['name'] = self.name @@ -1089,6 +1401,16 @@ def to_json(self) -> T_JSON_DICT: json['sameSite'] = self.same_site.to_json() if self.expires is not None: json['expires'] = self.expires.to_json() + if self.priority is not None: + json['priority'] = self.priority.to_json() + if self.same_party is not None: + json['sameParty'] = self.same_party + if self.source_scheme is not None: + json['sourceScheme'] = self.source_scheme.to_json() + if self.source_port is not None: + json['sourcePort'] = self.source_port + if self.partition_key is not None: + json['partitionKey'] = self.partition_key return json @classmethod @@ -1103,12 +1425,17 @@ def from_json(cls, json: T_JSON_DICT) -> CookieParam: http_only=bool(json['httpOnly']) if 'httpOnly' in json else None, same_site=CookieSameSite.from_json(json['sameSite']) if 'sameSite' in json else None, expires=TimeSinceEpoch.from_json(json['expires']) if 'expires' in json else None, + priority=CookiePriority.from_json(json['priority']) if 'priority' in json else None, + same_party=bool(json['sameParty']) if 'sameParty' in json else None, + source_scheme=CookieSourceScheme.from_json(json['sourceScheme']) if 'sourceScheme' in json else None, + source_port=int(json['sourcePort']) if 'sourcePort' in json else None, + partition_key=str(json['partitionKey']) if 'partitionKey' in json else None, ) @dataclass class AuthChallenge: - ''' + r''' Authorization challenge for HTTP status code 401 or 407. ''' #: Origin of the challenger. @@ -1144,7 +1471,7 @@ def from_json(cls, json: T_JSON_DICT) -> AuthChallenge: @dataclass class AuthChallengeResponse: - ''' + r''' Response to an AuthChallenge. ''' #: The decision on what to do in response to the authorization challenge. Default means @@ -1179,7 +1506,7 @@ def from_json(cls, json: T_JSON_DICT) -> AuthChallengeResponse: class InterceptionStage(enum.Enum): - ''' + r''' Stages of the interception to begin intercepting. Request will intercept before the request is sent. Response will intercept after the response is received. ''' @@ -1196,17 +1523,17 @@ def from_json(cls, json: str) -> InterceptionStage: @dataclass class RequestPattern: - ''' + r''' Request pattern for interception. ''' - #: Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is - #: backslash. Omitting is equivalent to "*". + #: Wildcards (``'*'`` -> zero or more, ``'?'`` -> exactly one) are allowed. Escape character is + #: backslash. Omitting is equivalent to ``"*"``. url_pattern: typing.Optional[str] = None #: If set, only requests for matching resource types will be intercepted. resource_type: typing.Optional[ResourceType] = None - #: Stage at wich to begin intercepting requests. Default is Request. + #: Stage at which to begin intercepting requests. Default is Request. interception_stage: typing.Optional[InterceptionStage] = None def to_json(self) -> T_JSON_DICT: @@ -1230,7 +1557,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestPattern: @dataclass class SignedExchangeSignature: - ''' + r''' Information about a signed exchange signature. https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1 ''' @@ -1294,7 +1621,7 @@ def from_json(cls, json: T_JSON_DICT) -> SignedExchangeSignature: @dataclass class SignedExchangeHeader: - ''' + r''' Information about a signed exchange header. https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation ''' @@ -1334,7 +1661,7 @@ def from_json(cls, json: T_JSON_DICT) -> SignedExchangeHeader: class SignedExchangeErrorField(enum.Enum): - ''' + r''' Field type for a signed exchange related error. ''' SIGNATURE_SIG = "signatureSig" @@ -1354,7 +1681,7 @@ def from_json(cls, json: str) -> SignedExchangeErrorField: @dataclass class SignedExchangeError: - ''' + r''' Information about a signed exchange response. ''' #: Error message. @@ -1386,7 +1713,7 @@ def from_json(cls, json: T_JSON_DICT) -> SignedExchangeError: @dataclass class SignedExchangeInfo: - ''' + r''' Information about a signed exchange response. ''' #: The outer response of signed HTTP exchange which was received from network. @@ -1422,109 +1749,516 @@ def from_json(cls, json: T_JSON_DICT) -> SignedExchangeInfo: ) -@deprecated(version="1.3") -def can_clear_browser_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: +class ContentEncoding(enum.Enum): + r''' + List of content encodings supported by the backend. ''' - Tells whether clearing browser cache is supported. + DEFLATE = "deflate" + GZIP = "gzip" + BR = "br" - .. deprecated:: 1.3 + def to_json(self) -> str: + return self.value - :returns: True if browser cache can be cleared. - ''' - cmd_dict: T_JSON_DICT = { - 'method': 'Network.canClearBrowserCache', - } - json = yield cmd_dict - return bool(json['result']) + @classmethod + def from_json(cls, json: str) -> ContentEncoding: + return cls(json) -@deprecated(version="1.3") -def can_clear_browser_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: - ''' - Tells whether clearing browser cookies is supported. +class PrivateNetworkRequestPolicy(enum.Enum): + ALLOW = "Allow" + BLOCK_FROM_INSECURE_TO_MORE_PRIVATE = "BlockFromInsecureToMorePrivate" + WARN_FROM_INSECURE_TO_MORE_PRIVATE = "WarnFromInsecureToMorePrivate" + PREFLIGHT_BLOCK = "PreflightBlock" + PREFLIGHT_WARN = "PreflightWarn" - .. deprecated:: 1.3 + def to_json(self) -> str: + return self.value - :returns: True if browser cookies can be cleared. - ''' - cmd_dict: T_JSON_DICT = { - 'method': 'Network.canClearBrowserCookies', - } - json = yield cmd_dict - return bool(json['result']) + @classmethod + def from_json(cls, json: str) -> PrivateNetworkRequestPolicy: + return cls(json) -@deprecated(version="1.3") -def can_emulate_network_conditions() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: - ''' - Tells whether emulation of network conditions is supported. +class IPAddressSpace(enum.Enum): + LOCAL = "Local" + PRIVATE = "Private" + PUBLIC = "Public" + UNKNOWN = "Unknown" - .. deprecated:: 1.3 + def to_json(self) -> str: + return self.value - :returns: True if emulation of network conditions is supported. - ''' - cmd_dict: T_JSON_DICT = { - 'method': 'Network.canEmulateNetworkConditions', - } - json = yield cmd_dict - return bool(json['result']) + @classmethod + def from_json(cls, json: str) -> IPAddressSpace: + return cls(json) -def clear_browser_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Clears browser cache. - ''' - cmd_dict: T_JSON_DICT = { - 'method': 'Network.clearBrowserCache', - } - json = yield cmd_dict +@dataclass +class ConnectTiming: + #: Timing's requestTime is a baseline in seconds, while the other numbers are ticks in + #: milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for + #: the same request (but not for redirected requests). + request_time: float + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['requestTime'] = self.request_time + return json -def clear_browser_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Clears browser cookies. - ''' - cmd_dict: T_JSON_DICT = { - 'method': 'Network.clearBrowserCookies', - } - json = yield cmd_dict + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ConnectTiming: + return cls( + request_time=float(json['requestTime']), + ) -@deprecated(version="1.3") -def continue_intercepted_request( - interception_id: InterceptionId, - error_reason: typing.Optional[ErrorReason] = None, - raw_response: typing.Optional[str] = None, - url: typing.Optional[str] = None, - method: typing.Optional[str] = None, - post_data: typing.Optional[str] = None, - headers: typing.Optional[Headers] = None, - auth_challenge_response: typing.Optional[AuthChallengeResponse] = None - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Response to Network.requestIntercepted which either modifies the request to continue with any - modifications, or blocks it, or completes it with the provided response bytes. If a network - fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted - event will be sent with the same InterceptionId. - Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead. +@dataclass +class ClientSecurityState: + initiator_is_secure_context: bool - .. deprecated:: 1.3 + initiator_ip_address_space: IPAddressSpace - **EXPERIMENTAL** + private_network_request_policy: PrivateNetworkRequestPolicy - :param interception_id: - :param error_reason: *(Optional)* If set this causes the request to fail with the given reason. Passing ```Aborted```` for requests marked with ````isNavigationRequest``` also cancels the navigation. Must not be set in response to an authChallenge. - :param raw_response: *(Optional)* If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge. - :param url: *(Optional)* If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge. - :param method: *(Optional)* If set this allows the request method to be overridden. Must not be set in response to an authChallenge. - :param post_data: *(Optional)* If set this allows postData to be set. Must not be set in response to an authChallenge. - :param headers: *(Optional)* If set this allows the request headers to be changed. Must not be set in response to an authChallenge. - :param auth_challenge_response: *(Optional)* Response to a requestIntercepted with an authChallenge. Must not be set otherwise. - ''' - params: T_JSON_DICT = dict() - params['interceptionId'] = interception_id.to_json() - if error_reason is not None: - params['errorReason'] = error_reason.to_json() + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['initiatorIsSecureContext'] = self.initiator_is_secure_context + json['initiatorIPAddressSpace'] = self.initiator_ip_address_space.to_json() + json['privateNetworkRequestPolicy'] = self.private_network_request_policy.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ClientSecurityState: + return cls( + initiator_is_secure_context=bool(json['initiatorIsSecureContext']), + initiator_ip_address_space=IPAddressSpace.from_json(json['initiatorIPAddressSpace']), + private_network_request_policy=PrivateNetworkRequestPolicy.from_json(json['privateNetworkRequestPolicy']), + ) + + +class CrossOriginOpenerPolicyValue(enum.Enum): + SAME_ORIGIN = "SameOrigin" + SAME_ORIGIN_ALLOW_POPUPS = "SameOriginAllowPopups" + UNSAFE_NONE = "UnsafeNone" + SAME_ORIGIN_PLUS_COEP = "SameOriginPlusCoep" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CrossOriginOpenerPolicyValue: + return cls(json) + + +@dataclass +class CrossOriginOpenerPolicyStatus: + value: CrossOriginOpenerPolicyValue + + report_only_value: CrossOriginOpenerPolicyValue + + reporting_endpoint: typing.Optional[str] = None + + report_only_reporting_endpoint: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['value'] = self.value.to_json() + json['reportOnlyValue'] = self.report_only_value.to_json() + if self.reporting_endpoint is not None: + json['reportingEndpoint'] = self.reporting_endpoint + if self.report_only_reporting_endpoint is not None: + json['reportOnlyReportingEndpoint'] = self.report_only_reporting_endpoint + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CrossOriginOpenerPolicyStatus: + return cls( + value=CrossOriginOpenerPolicyValue.from_json(json['value']), + report_only_value=CrossOriginOpenerPolicyValue.from_json(json['reportOnlyValue']), + reporting_endpoint=str(json['reportingEndpoint']) if 'reportingEndpoint' in json else None, + report_only_reporting_endpoint=str(json['reportOnlyReportingEndpoint']) if 'reportOnlyReportingEndpoint' in json else None, + ) + + +class CrossOriginEmbedderPolicyValue(enum.Enum): + NONE = "None" + CREDENTIALLESS = "Credentialless" + REQUIRE_CORP = "RequireCorp" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CrossOriginEmbedderPolicyValue: + return cls(json) + + +@dataclass +class CrossOriginEmbedderPolicyStatus: + value: CrossOriginEmbedderPolicyValue + + report_only_value: CrossOriginEmbedderPolicyValue + + reporting_endpoint: typing.Optional[str] = None + + report_only_reporting_endpoint: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['value'] = self.value.to_json() + json['reportOnlyValue'] = self.report_only_value.to_json() + if self.reporting_endpoint is not None: + json['reportingEndpoint'] = self.reporting_endpoint + if self.report_only_reporting_endpoint is not None: + json['reportOnlyReportingEndpoint'] = self.report_only_reporting_endpoint + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CrossOriginEmbedderPolicyStatus: + return cls( + value=CrossOriginEmbedderPolicyValue.from_json(json['value']), + report_only_value=CrossOriginEmbedderPolicyValue.from_json(json['reportOnlyValue']), + reporting_endpoint=str(json['reportingEndpoint']) if 'reportingEndpoint' in json else None, + report_only_reporting_endpoint=str(json['reportOnlyReportingEndpoint']) if 'reportOnlyReportingEndpoint' in json else None, + ) + + +@dataclass +class SecurityIsolationStatus: + coop: typing.Optional[CrossOriginOpenerPolicyStatus] = None + + coep: typing.Optional[CrossOriginEmbedderPolicyStatus] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.coop is not None: + json['coop'] = self.coop.to_json() + if self.coep is not None: + json['coep'] = self.coep.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SecurityIsolationStatus: + return cls( + coop=CrossOriginOpenerPolicyStatus.from_json(json['coop']) if 'coop' in json else None, + coep=CrossOriginEmbedderPolicyStatus.from_json(json['coep']) if 'coep' in json else None, + ) + + +class ReportStatus(enum.Enum): + r''' + The status of a Reporting API report. + ''' + QUEUED = "Queued" + PENDING = "Pending" + MARKED_FOR_REMOVAL = "MarkedForRemoval" + SUCCESS = "Success" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ReportStatus: + return cls(json) + + +class ReportId(str): + def to_json(self) -> str: + return self + + @classmethod + def from_json(cls, json: str) -> ReportId: + return cls(json) + + def __repr__(self): + return 'ReportId({})'.format(super().__repr__()) + + +@dataclass +class ReportingApiReport: + r''' + An object representing a report generated by the Reporting API. + ''' + id_: ReportId + + #: The URL of the document that triggered the report. + initiator_url: str + + #: The name of the endpoint group that should be used to deliver the report. + destination: str + + #: The type of the report (specifies the set of data that is contained in the report body). + type_: str + + #: When the report was generated. + timestamp: network.TimeSinceEpoch + + #: How many uploads deep the related request was. + depth: int + + #: The number of delivery attempts made so far, not including an active attempt. + completed_attempts: int + + body: dict + + status: ReportStatus + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['id'] = self.id_.to_json() + json['initiatorUrl'] = self.initiator_url + json['destination'] = self.destination + json['type'] = self.type_ + json['timestamp'] = self.timestamp.to_json() + json['depth'] = self.depth + json['completedAttempts'] = self.completed_attempts + json['body'] = self.body + json['status'] = self.status.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ReportingApiReport: + return cls( + id_=ReportId.from_json(json['id']), + initiator_url=str(json['initiatorUrl']), + destination=str(json['destination']), + type_=str(json['type']), + timestamp=network.TimeSinceEpoch.from_json(json['timestamp']), + depth=int(json['depth']), + completed_attempts=int(json['completedAttempts']), + body=dict(json['body']), + status=ReportStatus.from_json(json['status']), + ) + + +@dataclass +class ReportingApiEndpoint: + #: The URL of the endpoint to which reports may be delivered. + url: str + + #: Name of the endpoint group. + group_name: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['url'] = self.url + json['groupName'] = self.group_name + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ReportingApiEndpoint: + return cls( + url=str(json['url']), + group_name=str(json['groupName']), + ) + + +@dataclass +class LoadNetworkResourcePageResult: + r''' + An object providing the result of a network resource load. + ''' + success: bool + + #: Optional values used for error reporting. + net_error: typing.Optional[float] = None + + net_error_name: typing.Optional[str] = None + + http_status_code: typing.Optional[float] = None + + #: If successful, one of the following two fields holds the result. + stream: typing.Optional[io.StreamHandle] = None + + #: Response headers. + headers: typing.Optional[network.Headers] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['success'] = self.success + if self.net_error is not None: + json['netError'] = self.net_error + if self.net_error_name is not None: + json['netErrorName'] = self.net_error_name + if self.http_status_code is not None: + json['httpStatusCode'] = self.http_status_code + if self.stream is not None: + json['stream'] = self.stream.to_json() + if self.headers is not None: + json['headers'] = self.headers.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LoadNetworkResourcePageResult: + return cls( + success=bool(json['success']), + net_error=float(json['netError']) if 'netError' in json else None, + net_error_name=str(json['netErrorName']) if 'netErrorName' in json else None, + http_status_code=float(json['httpStatusCode']) if 'httpStatusCode' in json else None, + stream=io.StreamHandle.from_json(json['stream']) if 'stream' in json else None, + headers=network.Headers.from_json(json['headers']) if 'headers' in json else None, + ) + + +@dataclass +class LoadNetworkResourceOptions: + r''' + An options object that may be extended later to better support CORS, + CORB and streaming. + ''' + disable_cache: bool + + include_credentials: bool + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['disableCache'] = self.disable_cache + json['includeCredentials'] = self.include_credentials + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LoadNetworkResourceOptions: + return cls( + disable_cache=bool(json['disableCache']), + include_credentials=bool(json['includeCredentials']), + ) + + +def set_accepted_encodings( + encodings: typing.List[ContentEncoding] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted. + + **EXPERIMENTAL** + + :param encodings: List of accepted content encodings. + ''' + params: T_JSON_DICT = dict() + params['encodings'] = [i.to_json() for i in encodings] + cmd_dict: T_JSON_DICT = { + 'method': 'Network.setAcceptedEncodings', + 'params': params, + } + json = yield cmd_dict + + +def clear_accepted_encodings_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Clears accepted encodings set by setAcceptedEncodings + + **EXPERIMENTAL** + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Network.clearAcceptedEncodingsOverride', + } + json = yield cmd_dict + + +@deprecated(version="1.3") +def can_clear_browser_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: + r''' + Tells whether clearing browser cache is supported. + + .. deprecated:: 1.3 + + :returns: True if browser cache can be cleared. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Network.canClearBrowserCache', + } + json = yield cmd_dict + return bool(json['result']) + + +@deprecated(version="1.3") +def can_clear_browser_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: + r''' + Tells whether clearing browser cookies is supported. + + .. deprecated:: 1.3 + + :returns: True if browser cookies can be cleared. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Network.canClearBrowserCookies', + } + json = yield cmd_dict + return bool(json['result']) + + +@deprecated(version="1.3") +def can_emulate_network_conditions() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: + r''' + Tells whether emulation of network conditions is supported. + + .. deprecated:: 1.3 + + :returns: True if emulation of network conditions is supported. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Network.canEmulateNetworkConditions', + } + json = yield cmd_dict + return bool(json['result']) + + +def clear_browser_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Clears browser cache. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Network.clearBrowserCache', + } + json = yield cmd_dict + + +def clear_browser_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Clears browser cookies. + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Network.clearBrowserCookies', + } + json = yield cmd_dict + + +@deprecated(version="1.3") +def continue_intercepted_request( + interception_id: InterceptionId, + error_reason: typing.Optional[ErrorReason] = None, + raw_response: typing.Optional[str] = None, + url: typing.Optional[str] = None, + method: typing.Optional[str] = None, + post_data: typing.Optional[str] = None, + headers: typing.Optional[Headers] = None, + auth_challenge_response: typing.Optional[AuthChallengeResponse] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Response to Network.requestIntercepted which either modifies the request to continue with any + modifications, or blocks it, or completes it with the provided response bytes. If a network + fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted + event will be sent with the same InterceptionId. + Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead. + + .. deprecated:: 1.3 + + **EXPERIMENTAL** + + :param interception_id: + :param error_reason: *(Optional)* If set this causes the request to fail with the given reason. Passing ```Aborted```` for requests marked with ````isNavigationRequest``` also cancels the navigation. Must not be set in response to an authChallenge. + :param raw_response: *(Optional)* If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON) + :param url: *(Optional)* If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge. + :param method: *(Optional)* If set this allows the request method to be overridden. Must not be set in response to an authChallenge. + :param post_data: *(Optional)* If set this allows postData to be set. Must not be set in response to an authChallenge. + :param headers: *(Optional)* If set this allows the request headers to be changed. Must not be set in response to an authChallenge. + :param auth_challenge_response: *(Optional)* Response to a requestIntercepted with an authChallenge. Must not be set otherwise. + ''' + params: T_JSON_DICT = dict() + params['interceptionId'] = interception_id.to_json() + if error_reason is not None: + params['errorReason'] = error_reason.to_json() if raw_response is not None: params['rawResponse'] = raw_response if url is not None: @@ -1550,7 +2284,7 @@ def delete_cookies( domain: typing.Optional[str] = None, path: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Deletes browser cookies with matching name and url or domain/path pair. :param name: Name of the cookies to remove. @@ -1574,7 +2308,7 @@ def delete_cookies( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables network tracking, prevents network events from being sent to the client. ''' cmd_dict: T_JSON_DICT = { @@ -1590,7 +2324,7 @@ def emulate_network_conditions( upload_throughput: float, connection_type: typing.Optional[ConnectionType] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Activates emulation of network conditions. :param offline: True to emulate internet disconnection. @@ -1618,7 +2352,7 @@ def enable( max_resource_buffer_size: typing.Optional[int] = None, max_post_data_size: typing.Optional[int] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables network tracking, network events will now be delivered to the client. :param max_total_buffer_size: **(EXPERIMENTAL)** *(Optional)* Buffer size in bytes to use when preserving network payloads (XHRs, etc). @@ -1640,7 +2374,7 @@ def enable( def get_all_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Cookie]]: - ''' + r''' Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the ``cookies`` field. @@ -1656,7 +2390,7 @@ def get_all_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Co def get_certificate( origin: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Returns the DER-encoded certificate. **EXPERIMENTAL** @@ -1677,11 +2411,11 @@ def get_certificate( def get_cookies( urls: typing.Optional[typing.List[str]] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Cookie]]: - ''' + r''' Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in the ``cookies`` field. - :param urls: *(Optional)* The list of URLs for which applicable cookies will be fetched + :param urls: *(Optional)* The list of URLs for which applicable cookies will be fetched. If not specified, it's assumed to be set to the list containing the URLs of the page and all of its subframes. :returns: Array of cookie objects. ''' params: T_JSON_DICT = dict() @@ -1698,7 +2432,7 @@ def get_cookies( def get_response_body( request_id: RequestId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, bool]]: - ''' + r''' Returns content served for the given request. :param request_id: Identifier of the network request to get content for. @@ -1723,7 +2457,7 @@ def get_response_body( def get_request_post_data( request_id: RequestId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Returns post data sent with the request. Returns an error when no data was sent with the request. :param request_id: Identifier of the network request to get content for. @@ -1742,7 +2476,7 @@ def get_request_post_data( def get_response_body_for_interception( interception_id: InterceptionId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, bool]]: - ''' + r''' Returns content served for the given currently intercepted request. **EXPERIMENTAL** @@ -1769,7 +2503,7 @@ def get_response_body_for_interception( def take_response_body_for_interception_as_stream( interception_id: InterceptionId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,io.StreamHandle]: - ''' + r''' Returns a handle to the stream representing the response body. Note that after this command, the intercepted request can't be continued as is -- you either need to cancel it or to provide the response body. The stream only supports sequential read, IO.read will fail if the position @@ -1793,7 +2527,7 @@ def take_response_body_for_interception_as_stream( def replay_xhr( request_id: RequestId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' This method sends a new XMLHttpRequest which is identical to the original one. The following parameters should be identical: method, url, async, request body, extra headers, withCredentials attribute, user, password. @@ -1817,7 +2551,7 @@ def search_in_response_body( case_sensitive: typing.Optional[bool] = None, is_regex: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[debugger.SearchMatch]]: - ''' + r''' Searches for given string in response content. **EXPERIMENTAL** @@ -1846,7 +2580,7 @@ def search_in_response_body( def set_blocked_ur_ls( urls: typing.List[str] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Blocks URLs from loading. **EXPERIMENTAL** @@ -1865,7 +2599,7 @@ def set_blocked_ur_ls( def set_bypass_service_worker( bypass: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Toggles ignoring of service worker for each request. **EXPERIMENTAL** @@ -1884,7 +2618,7 @@ def set_bypass_service_worker( def set_cache_disabled( cache_disabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Toggles ignoring cache for each request. If ``true``, cache will not be used. :param cache_disabled: Cache disabled state. @@ -1907,21 +2641,31 @@ def set_cookie( secure: typing.Optional[bool] = None, http_only: typing.Optional[bool] = None, same_site: typing.Optional[CookieSameSite] = None, - expires: typing.Optional[TimeSinceEpoch] = None + expires: typing.Optional[TimeSinceEpoch] = None, + priority: typing.Optional[CookiePriority] = None, + same_party: typing.Optional[bool] = None, + source_scheme: typing.Optional[CookieSourceScheme] = None, + source_port: typing.Optional[int] = None, + partition_key: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: - ''' + r''' Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. :param name: Cookie name. :param value: Cookie value. - :param url: *(Optional)* The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. + :param url: *(Optional)* The request-URI to associate with the setting of the cookie. This value can affect the default domain, path, source port, and source scheme values of the created cookie. :param domain: *(Optional)* Cookie domain. :param path: *(Optional)* Cookie path. :param secure: *(Optional)* True if cookie is secure. :param http_only: *(Optional)* True if cookie is http-only. :param same_site: *(Optional)* Cookie SameSite type. :param expires: *(Optional)* Cookie expiration date, session cookie if not set - :returns: True if successfully set cookie. + :param priority: **(EXPERIMENTAL)** *(Optional)* Cookie Priority type. + :param same_party: **(EXPERIMENTAL)** *(Optional)* True if cookie is SameParty. + :param source_scheme: **(EXPERIMENTAL)** *(Optional)* Cookie source scheme type. + :param source_port: **(EXPERIMENTAL)** *(Optional)* Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future. + :param partition_key: **(EXPERIMENTAL)** *(Optional)* Cookie partition key. The site of the top-level URL the browser was visiting at the start of the request to the endpoint that set the cookie. If not set, the cookie will be set as not partitioned. + :returns: Always set to true. If an error occurs, the response indicates protocol error. ''' params: T_JSON_DICT = dict() params['name'] = name @@ -1940,6 +2684,16 @@ def set_cookie( params['sameSite'] = same_site.to_json() if expires is not None: params['expires'] = expires.to_json() + if priority is not None: + params['priority'] = priority.to_json() + if same_party is not None: + params['sameParty'] = same_party + if source_scheme is not None: + params['sourceScheme'] = source_scheme.to_json() + if source_port is not None: + params['sourcePort'] = source_port + if partition_key is not None: + params['partitionKey'] = partition_key cmd_dict: T_JSON_DICT = { 'method': 'Network.setCookie', 'params': params, @@ -1951,7 +2705,7 @@ def set_cookie( def set_cookies( cookies: typing.List[CookieParam] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets given cookies. :param cookies: Cookies to be set. @@ -1965,40 +2719,37 @@ def set_cookies( json = yield cmd_dict -def set_data_size_limits_for_test( - max_total_size: int, - max_resource_size: int +def set_extra_http_headers( + headers: Headers ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - For testing. - - **EXPERIMENTAL** + r''' + Specifies whether to always send extra HTTP headers with the requests from this page. - :param max_total_size: Maximum total buffer size. - :param max_resource_size: Maximum per-resource size. + :param headers: Map with extra HTTP headers. ''' params: T_JSON_DICT = dict() - params['maxTotalSize'] = max_total_size - params['maxResourceSize'] = max_resource_size + params['headers'] = headers.to_json() cmd_dict: T_JSON_DICT = { - 'method': 'Network.setDataSizeLimitsForTest', + 'method': 'Network.setExtraHTTPHeaders', 'params': params, } json = yield cmd_dict -def set_extra_http_headers( - headers: Headers +def set_attach_debug_stack( + enabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Specifies whether to always send extra HTTP headers with the requests from this page. + r''' + Specifies whether to attach a page script stack id in requests - :param headers: Map with extra HTTP headers. + **EXPERIMENTAL** + + :param enabled: Whether to attach a page script stack for debugging purpose. ''' params: T_JSON_DICT = dict() - params['headers'] = headers.to_json() + params['enabled'] = enabled cmd_dict: T_JSON_DICT = { - 'method': 'Network.setExtraHTTPHeaders', + 'method': 'Network.setAttachDebugStack', 'params': params, } json = yield cmd_dict @@ -2008,7 +2759,7 @@ def set_extra_http_headers( def set_request_interception( patterns: typing.List[RequestPattern] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets the requests to intercept that match the provided patterns and optionally resource types. Deprecated, please use Fetch.enable instead. @@ -2030,14 +2781,16 @@ def set_request_interception( def set_user_agent_override( user_agent: str, accept_language: typing.Optional[str] = None, - platform: typing.Optional[str] = None + platform: typing.Optional[str] = None, + user_agent_metadata: typing.Optional[emulation.UserAgentMetadata] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Allows overriding user agent with the given string. :param user_agent: User agent to use. :param accept_language: *(Optional)* Browser langugage to emulate. :param platform: *(Optional)* The platform navigator.platform should return. + :param user_agent_metadata: **(EXPERIMENTAL)** *(Optional)* To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData ''' params: T_JSON_DICT = dict() params['userAgent'] = user_agent @@ -2045,6 +2798,8 @@ def set_user_agent_override( params['acceptLanguage'] = accept_language if platform is not None: params['platform'] = platform + if user_agent_metadata is not None: + params['userAgentMetadata'] = user_agent_metadata.to_json() cmd_dict: T_JSON_DICT = { 'method': 'Network.setUserAgentOverride', 'params': params, @@ -2052,10 +2807,80 @@ def set_user_agent_override( json = yield cmd_dict +def get_security_isolation_status( + frame_id: typing.Optional[page.FrameId] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SecurityIsolationStatus]: + r''' + Returns information about the COEP/COOP isolation status. + + **EXPERIMENTAL** + + :param frame_id: *(Optional)* If no frameId is provided, the status of the target is provided. + :returns: + ''' + params: T_JSON_DICT = dict() + if frame_id is not None: + params['frameId'] = frame_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Network.getSecurityIsolationStatus', + 'params': params, + } + json = yield cmd_dict + return SecurityIsolationStatus.from_json(json['status']) + + +def enable_reporting_api( + enable: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client. + Enabling triggers 'reportingApiReportAdded' for all existing reports. + + **EXPERIMENTAL** + + :param enable: Whether to enable or disable events for the Reporting API + ''' + params: T_JSON_DICT = dict() + params['enable'] = enable + cmd_dict: T_JSON_DICT = { + 'method': 'Network.enableReportingApi', + 'params': params, + } + json = yield cmd_dict + + +def load_network_resource( + url: str, + options: LoadNetworkResourceOptions, + frame_id: typing.Optional[page.FrameId] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,LoadNetworkResourcePageResult]: + r''' + Fetches the resource and returns the content. + + **EXPERIMENTAL** + + :param frame_id: *(Optional)* Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets. + :param url: URL of the resource to get content for. + :param options: Options for the request. + :returns: + ''' + params: T_JSON_DICT = dict() + if frame_id is not None: + params['frameId'] = frame_id.to_json() + params['url'] = url + params['options'] = options.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Network.loadNetworkResource', + 'params': params, + } + json = yield cmd_dict + return LoadNetworkResourcePageResult.from_json(json['resource']) + + @event_class('Network.dataReceived') @dataclass class DataReceived: - ''' + r''' Fired when data chunk was received over the network. ''' #: Request identifier. @@ -2080,7 +2905,7 @@ def from_json(cls, json: T_JSON_DICT) -> DataReceived: @event_class('Network.eventSourceMessageReceived') @dataclass class EventSourceMessageReceived: - ''' + r''' Fired when EventSource message is received. ''' #: Request identifier. @@ -2108,7 +2933,7 @@ def from_json(cls, json: T_JSON_DICT) -> EventSourceMessageReceived: @event_class('Network.loadingFailed') @dataclass class LoadingFailed: - ''' + r''' Fired when HTTP request has failed to load. ''' #: Request identifier. @@ -2123,6 +2948,8 @@ class LoadingFailed: canceled: typing.Optional[bool] #: The reason why loading was blocked, if any. blocked_reason: typing.Optional[BlockedReason] + #: The reason why loading was blocked by CORS, if any. + cors_error_status: typing.Optional[CorsErrorStatus] @classmethod def from_json(cls, json: T_JSON_DICT) -> LoadingFailed: @@ -2132,14 +2959,15 @@ def from_json(cls, json: T_JSON_DICT) -> LoadingFailed: type_=ResourceType.from_json(json['type']), error_text=str(json['errorText']), canceled=bool(json['canceled']) if 'canceled' in json else None, - blocked_reason=BlockedReason.from_json(json['blockedReason']) if 'blockedReason' in json else None + blocked_reason=BlockedReason.from_json(json['blockedReason']) if 'blockedReason' in json else None, + cors_error_status=CorsErrorStatus.from_json(json['corsErrorStatus']) if 'corsErrorStatus' in json else None ) @event_class('Network.loadingFinished') @dataclass class LoadingFinished: - ''' + r''' Fired when HTTP request has finished loading. ''' #: Request identifier. @@ -2166,7 +2994,7 @@ def from_json(cls, json: T_JSON_DICT) -> LoadingFinished: @event_class('Network.requestIntercepted') @dataclass class RequestIntercepted: - ''' + r''' **EXPERIMENTAL** Details of an intercepted HTTP request, which must be either allowed, blocked, modified or @@ -2226,7 +3054,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestIntercepted: @event_class('Network.requestServedFromCache') @dataclass class RequestServedFromCache: - ''' + r''' Fired if request ended up loading from cache. ''' #: Request identifier. @@ -2242,7 +3070,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestServedFromCache: @event_class('Network.requestWillBeSent') @dataclass class RequestWillBeSent: - ''' + r''' Fired when page is about to send HTTP request. ''' #: Request identifier. @@ -2259,6 +3087,10 @@ class RequestWillBeSent: wall_time: TimeSinceEpoch #: Request initiator. initiator: Initiator + #: In the case that redirectResponse is populated, this flag indicates whether + #: requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted + #: for the request which was just redirected. + redirect_has_extra_info: typing.Optional[bool] #: Redirect response data. redirect_response: typing.Optional[Response] #: Type of this resource. @@ -2278,6 +3110,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestWillBeSent: timestamp=MonotonicTime.from_json(json['timestamp']), wall_time=TimeSinceEpoch.from_json(json['wallTime']), initiator=Initiator.from_json(json['initiator']), + redirect_has_extra_info=bool(json['redirectHasExtraInfo']) if 'redirectHasExtraInfo' in json else None, redirect_response=Response.from_json(json['redirectResponse']) if 'redirectResponse' in json else None, type_=ResourceType.from_json(json['type']) if 'type' in json else None, frame_id=page.FrameId.from_json(json['frameId']) if 'frameId' in json else None, @@ -2288,7 +3121,7 @@ def from_json(cls, json: T_JSON_DICT) -> RequestWillBeSent: @event_class('Network.resourceChangedPriority') @dataclass class ResourceChangedPriority: - ''' + r''' **EXPERIMENTAL** Fired when resource loading priority is changed @@ -2312,7 +3145,7 @@ def from_json(cls, json: T_JSON_DICT) -> ResourceChangedPriority: @event_class('Network.signedExchangeReceived') @dataclass class SignedExchangeReceived: - ''' + r''' **EXPERIMENTAL** Fired when a signed exchange was received over the network @@ -2333,7 +3166,7 @@ def from_json(cls, json: T_JSON_DICT) -> SignedExchangeReceived: @event_class('Network.responseReceived') @dataclass class ResponseReceived: - ''' + r''' Fired when HTTP response is available. ''' #: Request identifier. @@ -2346,6 +3179,9 @@ class ResponseReceived: type_: ResourceType #: Response data. response: Response + #: Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be + #: or were emitted for this request. + has_extra_info: typing.Optional[bool] #: Frame identifier. frame_id: typing.Optional[page.FrameId] @@ -2357,6 +3193,7 @@ def from_json(cls, json: T_JSON_DICT) -> ResponseReceived: timestamp=MonotonicTime.from_json(json['timestamp']), type_=ResourceType.from_json(json['type']), response=Response.from_json(json['response']), + has_extra_info=bool(json['hasExtraInfo']) if 'hasExtraInfo' in json else None, frame_id=page.FrameId.from_json(json['frameId']) if 'frameId' in json else None ) @@ -2364,7 +3201,7 @@ def from_json(cls, json: T_JSON_DICT) -> ResponseReceived: @event_class('Network.webSocketClosed') @dataclass class WebSocketClosed: - ''' + r''' Fired when WebSocket is closed. ''' #: Request identifier. @@ -2383,7 +3220,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketClosed: @event_class('Network.webSocketCreated') @dataclass class WebSocketCreated: - ''' + r''' Fired upon WebSocket creation. ''' #: Request identifier. @@ -2405,7 +3242,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketCreated: @event_class('Network.webSocketFrameError') @dataclass class WebSocketFrameError: - ''' + r''' Fired when WebSocket message error occurs. ''' #: Request identifier. @@ -2427,7 +3264,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketFrameError: @event_class('Network.webSocketFrameReceived') @dataclass class WebSocketFrameReceived: - ''' + r''' Fired when WebSocket message is received. ''' #: Request identifier. @@ -2449,7 +3286,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketFrameReceived: @event_class('Network.webSocketFrameSent') @dataclass class WebSocketFrameSent: - ''' + r''' Fired when WebSocket message is sent. ''' #: Request identifier. @@ -2471,7 +3308,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketFrameSent: @event_class('Network.webSocketHandshakeResponseReceived') @dataclass class WebSocketHandshakeResponseReceived: - ''' + r''' Fired when WebSocket handshake response becomes available. ''' #: Request identifier. @@ -2493,7 +3330,7 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketHandshakeResponseReceived: @event_class('Network.webSocketWillSendHandshakeRequest') @dataclass class WebSocketWillSendHandshakeRequest: - ''' + r''' Fired when WebSocket is about to initiate handshake. ''' #: Request identifier. @@ -2515,10 +3352,73 @@ def from_json(cls, json: T_JSON_DICT) -> WebSocketWillSendHandshakeRequest: ) +@event_class('Network.webTransportCreated') +@dataclass +class WebTransportCreated: + r''' + Fired upon WebTransport creation. + ''' + #: WebTransport identifier. + transport_id: RequestId + #: WebTransport request URL. + url: str + #: Timestamp. + timestamp: MonotonicTime + #: Request initiator. + initiator: typing.Optional[Initiator] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> WebTransportCreated: + return cls( + transport_id=RequestId.from_json(json['transportId']), + url=str(json['url']), + timestamp=MonotonicTime.from_json(json['timestamp']), + initiator=Initiator.from_json(json['initiator']) if 'initiator' in json else None + ) + + +@event_class('Network.webTransportConnectionEstablished') +@dataclass +class WebTransportConnectionEstablished: + r''' + Fired when WebTransport handshake is finished. + ''' + #: WebTransport identifier. + transport_id: RequestId + #: Timestamp. + timestamp: MonotonicTime + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> WebTransportConnectionEstablished: + return cls( + transport_id=RequestId.from_json(json['transportId']), + timestamp=MonotonicTime.from_json(json['timestamp']) + ) + + +@event_class('Network.webTransportClosed') +@dataclass +class WebTransportClosed: + r''' + Fired when WebTransport is disposed. + ''' + #: WebTransport identifier. + transport_id: RequestId + #: Timestamp. + timestamp: MonotonicTime + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> WebTransportClosed: + return cls( + transport_id=RequestId.from_json(json['transportId']), + timestamp=MonotonicTime.from_json(json['timestamp']) + ) + + @event_class('Network.requestWillBeSentExtraInfo') @dataclass class RequestWillBeSentExtraInfo: - ''' + r''' **EXPERIMENTAL** Fired when additional information about a requestWillBeSent event is available from the @@ -2528,25 +3428,31 @@ class RequestWillBeSentExtraInfo: ''' #: Request identifier. Used to match this information to an existing requestWillBeSent event. request_id: RequestId - #: A list of cookies which will not be sent with this request along with corresponding reasons - #: for blocking. - blocked_cookies: typing.List[BlockedCookieWithReason] + #: A list of cookies potentially associated to the requested URL. This includes both cookies sent with + #: the request and the ones not sent; the latter are distinguished by having blockedReason field set. + associated_cookies: typing.List[BlockedCookieWithReason] #: Raw request headers as they will be sent over the wire. headers: Headers + #: Connection timing information for the request. + connect_timing: ConnectTiming + #: The client security state set for the request. + client_security_state: typing.Optional[ClientSecurityState] @classmethod def from_json(cls, json: T_JSON_DICT) -> RequestWillBeSentExtraInfo: return cls( request_id=RequestId.from_json(json['requestId']), - blocked_cookies=[BlockedCookieWithReason.from_json(i) for i in json['blockedCookies']], - headers=Headers.from_json(json['headers']) + associated_cookies=[BlockedCookieWithReason.from_json(i) for i in json['associatedCookies']], + headers=Headers.from_json(json['headers']), + connect_timing=ConnectTiming.from_json(json['connectTiming']), + client_security_state=ClientSecurityState.from_json(json['clientSecurityState']) if 'clientSecurityState' in json else None ) @event_class('Network.responseReceivedExtraInfo') @dataclass class ResponseReceivedExtraInfo: - ''' + r''' **EXPERIMENTAL** Fired when additional information about a responseReceived event is available from the network @@ -2561,6 +3467,13 @@ class ResponseReceivedExtraInfo: blocked_cookies: typing.List[BlockedSetCookieWithReason] #: Raw response headers as they were received over the wire. headers: Headers + #: The IP address space of the resource. The address space can only be determined once the transport + #: established the connection, so we can't send it in ``requestWillBeSentExtraInfo``. + resource_ip_address_space: IPAddressSpace + #: The status code of the response. This is useful in cases the request failed and no responseReceived + #: event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code + #: for cached requests, where the status in responseReceived is a 200 and this will be 304. + status_code: int #: Raw response header text as it was received over the wire. The raw text may not always be #: available, such as in the case of HTTP/2 or QUIC. headers_text: typing.Optional[str] @@ -2571,5 +3484,198 @@ def from_json(cls, json: T_JSON_DICT) -> ResponseReceivedExtraInfo: request_id=RequestId.from_json(json['requestId']), blocked_cookies=[BlockedSetCookieWithReason.from_json(i) for i in json['blockedCookies']], headers=Headers.from_json(json['headers']), + resource_ip_address_space=IPAddressSpace.from_json(json['resourceIPAddressSpace']), + status_code=int(json['statusCode']), headers_text=str(json['headersText']) if 'headersText' in json else None ) + + +@event_class('Network.trustTokenOperationDone') +@dataclass +class TrustTokenOperationDone: + r''' + **EXPERIMENTAL** + + Fired exactly once for each Trust Token operation. Depending on + the type of the operation and whether the operation succeeded or + failed, the event is fired before the corresponding request was sent + or after the response was received. + ''' + #: Detailed success or error status of the operation. + #: 'AlreadyExists' also signifies a successful operation, as the result + #: of the operation already exists und thus, the operation was abort + #: preemptively (e.g. a cache hit). + status: str + type_: TrustTokenOperationType + request_id: RequestId + #: Top level origin. The context in which the operation was attempted. + top_level_origin: typing.Optional[str] + #: Origin of the issuer in case of a "Issuance" or "Redemption" operation. + issuer_origin: typing.Optional[str] + #: The number of obtained Trust Tokens on a successful "Issuance" operation. + issued_token_count: typing.Optional[int] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> TrustTokenOperationDone: + return cls( + status=str(json['status']), + type_=TrustTokenOperationType.from_json(json['type']), + request_id=RequestId.from_json(json['requestId']), + top_level_origin=str(json['topLevelOrigin']) if 'topLevelOrigin' in json else None, + issuer_origin=str(json['issuerOrigin']) if 'issuerOrigin' in json else None, + issued_token_count=int(json['issuedTokenCount']) if 'issuedTokenCount' in json else None + ) + + +@event_class('Network.subresourceWebBundleMetadataReceived') +@dataclass +class SubresourceWebBundleMetadataReceived: + r''' + **EXPERIMENTAL** + + Fired once when parsing the .wbn file has succeeded. + The event contains the information about the web bundle contents. + ''' + #: Request identifier. Used to match this information to another event. + request_id: RequestId + #: A list of URLs of resources in the subresource Web Bundle. + urls: typing.List[str] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SubresourceWebBundleMetadataReceived: + return cls( + request_id=RequestId.from_json(json['requestId']), + urls=[str(i) for i in json['urls']] + ) + + +@event_class('Network.subresourceWebBundleMetadataError') +@dataclass +class SubresourceWebBundleMetadataError: + r''' + **EXPERIMENTAL** + + Fired once when parsing the .wbn file has failed. + ''' + #: Request identifier. Used to match this information to another event. + request_id: RequestId + #: Error message + error_message: str + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SubresourceWebBundleMetadataError: + return cls( + request_id=RequestId.from_json(json['requestId']), + error_message=str(json['errorMessage']) + ) + + +@event_class('Network.subresourceWebBundleInnerResponseParsed') +@dataclass +class SubresourceWebBundleInnerResponseParsed: + r''' + **EXPERIMENTAL** + + Fired when handling requests for resources within a .wbn file. + Note: this will only be fired for resources that are requested by the webpage. + ''' + #: Request identifier of the subresource request + inner_request_id: RequestId + #: URL of the subresource resource. + inner_request_url: str + #: Bundle request identifier. Used to match this information to another event. + #: This made be absent in case when the instrumentation was enabled only + #: after webbundle was parsed. + bundle_request_id: typing.Optional[RequestId] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SubresourceWebBundleInnerResponseParsed: + return cls( + inner_request_id=RequestId.from_json(json['innerRequestId']), + inner_request_url=str(json['innerRequestURL']), + bundle_request_id=RequestId.from_json(json['bundleRequestId']) if 'bundleRequestId' in json else None + ) + + +@event_class('Network.subresourceWebBundleInnerResponseError') +@dataclass +class SubresourceWebBundleInnerResponseError: + r''' + **EXPERIMENTAL** + + Fired when request for resources within a .wbn file failed. + ''' + #: Request identifier of the subresource request + inner_request_id: RequestId + #: URL of the subresource resource. + inner_request_url: str + #: Error message + error_message: str + #: Bundle request identifier. Used to match this information to another event. + #: This made be absent in case when the instrumentation was enabled only + #: after webbundle was parsed. + bundle_request_id: typing.Optional[RequestId] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SubresourceWebBundleInnerResponseError: + return cls( + inner_request_id=RequestId.from_json(json['innerRequestId']), + inner_request_url=str(json['innerRequestURL']), + error_message=str(json['errorMessage']), + bundle_request_id=RequestId.from_json(json['bundleRequestId']) if 'bundleRequestId' in json else None + ) + + +@event_class('Network.reportingApiReportAdded') +@dataclass +class ReportingApiReportAdded: + r''' + **EXPERIMENTAL** + + Is sent whenever a new report is added. + And after 'enableReportingApi' for all existing reports. + ''' + report: ReportingApiReport + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ReportingApiReportAdded: + return cls( + report=ReportingApiReport.from_json(json['report']) + ) + + +@event_class('Network.reportingApiReportUpdated') +@dataclass +class ReportingApiReportUpdated: + r''' + **EXPERIMENTAL** + + + ''' + report: ReportingApiReport + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ReportingApiReportUpdated: + return cls( + report=ReportingApiReport.from_json(json['report']) + ) + + +@event_class('Network.reportingApiEndpointsChangedForOrigin') +@dataclass +class ReportingApiEndpointsChangedForOrigin: + r''' + **EXPERIMENTAL** + + + ''' + #: Origin of the document(s) which configured the endpoints. + origin: str + endpoints: typing.List[ReportingApiEndpoint] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ReportingApiEndpointsChangedForOrigin: + return cls( + origin=str(json['origin']), + endpoints=[ReportingApiEndpoint.from_json(i) for i in json['endpoints']] + ) diff --git a/cdp/overlay.py b/cdp/overlay.py index 38229b8..18f428e 100644 --- a/cdp/overlay.py +++ b/cdp/overlay.py @@ -14,11 +14,335 @@ from . import dom from . import page from . import runtime +from deprecated.sphinx import deprecated # type: ignore @dataclass -class HighlightConfig: +class SourceOrderConfig: + r''' + Configuration data for drawing the source order of an elements children. ''' + #: the color to outline the givent element in. + parent_outline_color: dom.RGBA + + #: the color to outline the child elements in. + child_outline_color: dom.RGBA + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['parentOutlineColor'] = self.parent_outline_color.to_json() + json['childOutlineColor'] = self.child_outline_color.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SourceOrderConfig: + return cls( + parent_outline_color=dom.RGBA.from_json(json['parentOutlineColor']), + child_outline_color=dom.RGBA.from_json(json['childOutlineColor']), + ) + + +@dataclass +class GridHighlightConfig: + r''' + Configuration data for the highlighting of Grid elements. + ''' + #: Whether the extension lines from grid cells to the rulers should be shown (default: false). + show_grid_extension_lines: typing.Optional[bool] = None + + #: Show Positive line number labels (default: false). + show_positive_line_numbers: typing.Optional[bool] = None + + #: Show Negative line number labels (default: false). + show_negative_line_numbers: typing.Optional[bool] = None + + #: Show area name labels (default: false). + show_area_names: typing.Optional[bool] = None + + #: Show line name labels (default: false). + show_line_names: typing.Optional[bool] = None + + #: Show track size labels (default: false). + show_track_sizes: typing.Optional[bool] = None + + #: The grid container border highlight color (default: transparent). + grid_border_color: typing.Optional[dom.RGBA] = None + + #: The cell border color (default: transparent). Deprecated, please use rowLineColor and columnLineColor instead. + cell_border_color: typing.Optional[dom.RGBA] = None + + #: The row line color (default: transparent). + row_line_color: typing.Optional[dom.RGBA] = None + + #: The column line color (default: transparent). + column_line_color: typing.Optional[dom.RGBA] = None + + #: Whether the grid border is dashed (default: false). + grid_border_dash: typing.Optional[bool] = None + + #: Whether the cell border is dashed (default: false). Deprecated, please us rowLineDash and columnLineDash instead. + cell_border_dash: typing.Optional[bool] = None + + #: Whether row lines are dashed (default: false). + row_line_dash: typing.Optional[bool] = None + + #: Whether column lines are dashed (default: false). + column_line_dash: typing.Optional[bool] = None + + #: The row gap highlight fill color (default: transparent). + row_gap_color: typing.Optional[dom.RGBA] = None + + #: The row gap hatching fill color (default: transparent). + row_hatch_color: typing.Optional[dom.RGBA] = None + + #: The column gap highlight fill color (default: transparent). + column_gap_color: typing.Optional[dom.RGBA] = None + + #: The column gap hatching fill color (default: transparent). + column_hatch_color: typing.Optional[dom.RGBA] = None + + #: The named grid areas border color (Default: transparent). + area_border_color: typing.Optional[dom.RGBA] = None + + #: The grid container background color (Default: transparent). + grid_background_color: typing.Optional[dom.RGBA] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.show_grid_extension_lines is not None: + json['showGridExtensionLines'] = self.show_grid_extension_lines + if self.show_positive_line_numbers is not None: + json['showPositiveLineNumbers'] = self.show_positive_line_numbers + if self.show_negative_line_numbers is not None: + json['showNegativeLineNumbers'] = self.show_negative_line_numbers + if self.show_area_names is not None: + json['showAreaNames'] = self.show_area_names + if self.show_line_names is not None: + json['showLineNames'] = self.show_line_names + if self.show_track_sizes is not None: + json['showTrackSizes'] = self.show_track_sizes + if self.grid_border_color is not None: + json['gridBorderColor'] = self.grid_border_color.to_json() + if self.cell_border_color is not None: + json['cellBorderColor'] = self.cell_border_color.to_json() + if self.row_line_color is not None: + json['rowLineColor'] = self.row_line_color.to_json() + if self.column_line_color is not None: + json['columnLineColor'] = self.column_line_color.to_json() + if self.grid_border_dash is not None: + json['gridBorderDash'] = self.grid_border_dash + if self.cell_border_dash is not None: + json['cellBorderDash'] = self.cell_border_dash + if self.row_line_dash is not None: + json['rowLineDash'] = self.row_line_dash + if self.column_line_dash is not None: + json['columnLineDash'] = self.column_line_dash + if self.row_gap_color is not None: + json['rowGapColor'] = self.row_gap_color.to_json() + if self.row_hatch_color is not None: + json['rowHatchColor'] = self.row_hatch_color.to_json() + if self.column_gap_color is not None: + json['columnGapColor'] = self.column_gap_color.to_json() + if self.column_hatch_color is not None: + json['columnHatchColor'] = self.column_hatch_color.to_json() + if self.area_border_color is not None: + json['areaBorderColor'] = self.area_border_color.to_json() + if self.grid_background_color is not None: + json['gridBackgroundColor'] = self.grid_background_color.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> GridHighlightConfig: + return cls( + show_grid_extension_lines=bool(json['showGridExtensionLines']) if 'showGridExtensionLines' in json else None, + show_positive_line_numbers=bool(json['showPositiveLineNumbers']) if 'showPositiveLineNumbers' in json else None, + show_negative_line_numbers=bool(json['showNegativeLineNumbers']) if 'showNegativeLineNumbers' in json else None, + show_area_names=bool(json['showAreaNames']) if 'showAreaNames' in json else None, + show_line_names=bool(json['showLineNames']) if 'showLineNames' in json else None, + show_track_sizes=bool(json['showTrackSizes']) if 'showTrackSizes' in json else None, + grid_border_color=dom.RGBA.from_json(json['gridBorderColor']) if 'gridBorderColor' in json else None, + cell_border_color=dom.RGBA.from_json(json['cellBorderColor']) if 'cellBorderColor' in json else None, + row_line_color=dom.RGBA.from_json(json['rowLineColor']) if 'rowLineColor' in json else None, + column_line_color=dom.RGBA.from_json(json['columnLineColor']) if 'columnLineColor' in json else None, + grid_border_dash=bool(json['gridBorderDash']) if 'gridBorderDash' in json else None, + cell_border_dash=bool(json['cellBorderDash']) if 'cellBorderDash' in json else None, + row_line_dash=bool(json['rowLineDash']) if 'rowLineDash' in json else None, + column_line_dash=bool(json['columnLineDash']) if 'columnLineDash' in json else None, + row_gap_color=dom.RGBA.from_json(json['rowGapColor']) if 'rowGapColor' in json else None, + row_hatch_color=dom.RGBA.from_json(json['rowHatchColor']) if 'rowHatchColor' in json else None, + column_gap_color=dom.RGBA.from_json(json['columnGapColor']) if 'columnGapColor' in json else None, + column_hatch_color=dom.RGBA.from_json(json['columnHatchColor']) if 'columnHatchColor' in json else None, + area_border_color=dom.RGBA.from_json(json['areaBorderColor']) if 'areaBorderColor' in json else None, + grid_background_color=dom.RGBA.from_json(json['gridBackgroundColor']) if 'gridBackgroundColor' in json else None, + ) + + +@dataclass +class FlexContainerHighlightConfig: + r''' + Configuration data for the highlighting of Flex container elements. + ''' + #: The style of the container border + container_border: typing.Optional[LineStyle] = None + + #: The style of the separator between lines + line_separator: typing.Optional[LineStyle] = None + + #: The style of the separator between items + item_separator: typing.Optional[LineStyle] = None + + #: Style of content-distribution space on the main axis (justify-content). + main_distributed_space: typing.Optional[BoxStyle] = None + + #: Style of content-distribution space on the cross axis (align-content). + cross_distributed_space: typing.Optional[BoxStyle] = None + + #: Style of empty space caused by row gaps (gap/row-gap). + row_gap_space: typing.Optional[BoxStyle] = None + + #: Style of empty space caused by columns gaps (gap/column-gap). + column_gap_space: typing.Optional[BoxStyle] = None + + #: Style of the self-alignment line (align-items). + cross_alignment: typing.Optional[LineStyle] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.container_border is not None: + json['containerBorder'] = self.container_border.to_json() + if self.line_separator is not None: + json['lineSeparator'] = self.line_separator.to_json() + if self.item_separator is not None: + json['itemSeparator'] = self.item_separator.to_json() + if self.main_distributed_space is not None: + json['mainDistributedSpace'] = self.main_distributed_space.to_json() + if self.cross_distributed_space is not None: + json['crossDistributedSpace'] = self.cross_distributed_space.to_json() + if self.row_gap_space is not None: + json['rowGapSpace'] = self.row_gap_space.to_json() + if self.column_gap_space is not None: + json['columnGapSpace'] = self.column_gap_space.to_json() + if self.cross_alignment is not None: + json['crossAlignment'] = self.cross_alignment.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> FlexContainerHighlightConfig: + return cls( + container_border=LineStyle.from_json(json['containerBorder']) if 'containerBorder' in json else None, + line_separator=LineStyle.from_json(json['lineSeparator']) if 'lineSeparator' in json else None, + item_separator=LineStyle.from_json(json['itemSeparator']) if 'itemSeparator' in json else None, + main_distributed_space=BoxStyle.from_json(json['mainDistributedSpace']) if 'mainDistributedSpace' in json else None, + cross_distributed_space=BoxStyle.from_json(json['crossDistributedSpace']) if 'crossDistributedSpace' in json else None, + row_gap_space=BoxStyle.from_json(json['rowGapSpace']) if 'rowGapSpace' in json else None, + column_gap_space=BoxStyle.from_json(json['columnGapSpace']) if 'columnGapSpace' in json else None, + cross_alignment=LineStyle.from_json(json['crossAlignment']) if 'crossAlignment' in json else None, + ) + + +@dataclass +class FlexItemHighlightConfig: + r''' + Configuration data for the highlighting of Flex item elements. + ''' + #: Style of the box representing the item's base size + base_size_box: typing.Optional[BoxStyle] = None + + #: Style of the border around the box representing the item's base size + base_size_border: typing.Optional[LineStyle] = None + + #: Style of the arrow representing if the item grew or shrank + flexibility_arrow: typing.Optional[LineStyle] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.base_size_box is not None: + json['baseSizeBox'] = self.base_size_box.to_json() + if self.base_size_border is not None: + json['baseSizeBorder'] = self.base_size_border.to_json() + if self.flexibility_arrow is not None: + json['flexibilityArrow'] = self.flexibility_arrow.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> FlexItemHighlightConfig: + return cls( + base_size_box=BoxStyle.from_json(json['baseSizeBox']) if 'baseSizeBox' in json else None, + base_size_border=LineStyle.from_json(json['baseSizeBorder']) if 'baseSizeBorder' in json else None, + flexibility_arrow=LineStyle.from_json(json['flexibilityArrow']) if 'flexibilityArrow' in json else None, + ) + + +@dataclass +class LineStyle: + r''' + Style information for drawing a line. + ''' + #: The color of the line (default: transparent) + color: typing.Optional[dom.RGBA] = None + + #: The line pattern (default: solid) + pattern: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.color is not None: + json['color'] = self.color.to_json() + if self.pattern is not None: + json['pattern'] = self.pattern + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LineStyle: + return cls( + color=dom.RGBA.from_json(json['color']) if 'color' in json else None, + pattern=str(json['pattern']) if 'pattern' in json else None, + ) + + +@dataclass +class BoxStyle: + r''' + Style information for drawing a box. + ''' + #: The background color for the box (default: transparent) + fill_color: typing.Optional[dom.RGBA] = None + + #: The hatching color for the box (default: transparent) + hatch_color: typing.Optional[dom.RGBA] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.fill_color is not None: + json['fillColor'] = self.fill_color.to_json() + if self.hatch_color is not None: + json['hatchColor'] = self.hatch_color.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> BoxStyle: + return cls( + fill_color=dom.RGBA.from_json(json['fillColor']) if 'fillColor' in json else None, + hatch_color=dom.RGBA.from_json(json['hatchColor']) if 'hatchColor' in json else None, + ) + + +class ContrastAlgorithm(enum.Enum): + AA = "aa" + AAA = "aaa" + APCA = "apca" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ContrastAlgorithm: + return cls(json) + + +@dataclass +class HighlightConfig: + r''' Configuration data for the highlighting of page elements. ''' #: Whether the node info tooltip should be shown (default: false). @@ -30,6 +354,9 @@ class HighlightConfig: #: Whether the rulers should be shown (default: false). show_rulers: typing.Optional[bool] = None + #: Whether the a11y info should be shown (default: true). + show_accessibility_info: typing.Optional[bool] = None + #: Whether the extension lines from node to the rulers should be shown (default: false). show_extension_lines: typing.Optional[bool] = None @@ -57,6 +384,24 @@ class HighlightConfig: #: The grid layout color (default: transparent). css_grid_color: typing.Optional[dom.RGBA] = None + #: The color format used to format color styles (default: hex). + color_format: typing.Optional[ColorFormat] = None + + #: The grid layout highlight configuration (default: all transparent). + grid_highlight_config: typing.Optional[GridHighlightConfig] = None + + #: The flex container highlight configuration (default: all transparent). + flex_container_highlight_config: typing.Optional[FlexContainerHighlightConfig] = None + + #: The flex item highlight configuration (default: all transparent). + flex_item_highlight_config: typing.Optional[FlexItemHighlightConfig] = None + + #: The contrast algorithm to use for the contrast ratio (default: aa). + contrast_algorithm: typing.Optional[ContrastAlgorithm] = None + + #: The container query container highlight configuration (default: all transparent). + container_query_container_highlight_config: typing.Optional[ContainerQueryContainerHighlightConfig] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() if self.show_info is not None: @@ -65,6 +410,8 @@ def to_json(self) -> T_JSON_DICT: json['showStyles'] = self.show_styles if self.show_rulers is not None: json['showRulers'] = self.show_rulers + if self.show_accessibility_info is not None: + json['showAccessibilityInfo'] = self.show_accessibility_info if self.show_extension_lines is not None: json['showExtensionLines'] = self.show_extension_lines if self.content_color is not None: @@ -83,6 +430,18 @@ def to_json(self) -> T_JSON_DICT: json['shapeMarginColor'] = self.shape_margin_color.to_json() if self.css_grid_color is not None: json['cssGridColor'] = self.css_grid_color.to_json() + if self.color_format is not None: + json['colorFormat'] = self.color_format.to_json() + if self.grid_highlight_config is not None: + json['gridHighlightConfig'] = self.grid_highlight_config.to_json() + if self.flex_container_highlight_config is not None: + json['flexContainerHighlightConfig'] = self.flex_container_highlight_config.to_json() + if self.flex_item_highlight_config is not None: + json['flexItemHighlightConfig'] = self.flex_item_highlight_config.to_json() + if self.contrast_algorithm is not None: + json['contrastAlgorithm'] = self.contrast_algorithm.to_json() + if self.container_query_container_highlight_config is not None: + json['containerQueryContainerHighlightConfig'] = self.container_query_container_highlight_config.to_json() return json @classmethod @@ -91,6 +450,7 @@ def from_json(cls, json: T_JSON_DICT) -> HighlightConfig: show_info=bool(json['showInfo']) if 'showInfo' in json else None, show_styles=bool(json['showStyles']) if 'showStyles' in json else None, show_rulers=bool(json['showRulers']) if 'showRulers' in json else None, + show_accessibility_info=bool(json['showAccessibilityInfo']) if 'showAccessibilityInfo' in json else None, show_extension_lines=bool(json['showExtensionLines']) if 'showExtensionLines' in json else None, content_color=dom.RGBA.from_json(json['contentColor']) if 'contentColor' in json else None, padding_color=dom.RGBA.from_json(json['paddingColor']) if 'paddingColor' in json else None, @@ -100,6 +460,260 @@ def from_json(cls, json: T_JSON_DICT) -> HighlightConfig: shape_color=dom.RGBA.from_json(json['shapeColor']) if 'shapeColor' in json else None, shape_margin_color=dom.RGBA.from_json(json['shapeMarginColor']) if 'shapeMarginColor' in json else None, css_grid_color=dom.RGBA.from_json(json['cssGridColor']) if 'cssGridColor' in json else None, + color_format=ColorFormat.from_json(json['colorFormat']) if 'colorFormat' in json else None, + grid_highlight_config=GridHighlightConfig.from_json(json['gridHighlightConfig']) if 'gridHighlightConfig' in json else None, + flex_container_highlight_config=FlexContainerHighlightConfig.from_json(json['flexContainerHighlightConfig']) if 'flexContainerHighlightConfig' in json else None, + flex_item_highlight_config=FlexItemHighlightConfig.from_json(json['flexItemHighlightConfig']) if 'flexItemHighlightConfig' in json else None, + contrast_algorithm=ContrastAlgorithm.from_json(json['contrastAlgorithm']) if 'contrastAlgorithm' in json else None, + container_query_container_highlight_config=ContainerQueryContainerHighlightConfig.from_json(json['containerQueryContainerHighlightConfig']) if 'containerQueryContainerHighlightConfig' in json else None, + ) + + +class ColorFormat(enum.Enum): + RGB = "rgb" + HSL = "hsl" + HEX_ = "hex" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ColorFormat: + return cls(json) + + +@dataclass +class GridNodeHighlightConfig: + r''' + Configurations for Persistent Grid Highlight + ''' + #: A descriptor for the highlight appearance. + grid_highlight_config: GridHighlightConfig + + #: Identifier of the node to highlight. + node_id: dom.NodeId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['gridHighlightConfig'] = self.grid_highlight_config.to_json() + json['nodeId'] = self.node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> GridNodeHighlightConfig: + return cls( + grid_highlight_config=GridHighlightConfig.from_json(json['gridHighlightConfig']), + node_id=dom.NodeId.from_json(json['nodeId']), + ) + + +@dataclass +class FlexNodeHighlightConfig: + #: A descriptor for the highlight appearance of flex containers. + flex_container_highlight_config: FlexContainerHighlightConfig + + #: Identifier of the node to highlight. + node_id: dom.NodeId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['flexContainerHighlightConfig'] = self.flex_container_highlight_config.to_json() + json['nodeId'] = self.node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> FlexNodeHighlightConfig: + return cls( + flex_container_highlight_config=FlexContainerHighlightConfig.from_json(json['flexContainerHighlightConfig']), + node_id=dom.NodeId.from_json(json['nodeId']), + ) + + +@dataclass +class ScrollSnapContainerHighlightConfig: + #: The style of the snapport border (default: transparent) + snapport_border: typing.Optional[LineStyle] = None + + #: The style of the snap area border (default: transparent) + snap_area_border: typing.Optional[LineStyle] = None + + #: The margin highlight fill color (default: transparent). + scroll_margin_color: typing.Optional[dom.RGBA] = None + + #: The padding highlight fill color (default: transparent). + scroll_padding_color: typing.Optional[dom.RGBA] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.snapport_border is not None: + json['snapportBorder'] = self.snapport_border.to_json() + if self.snap_area_border is not None: + json['snapAreaBorder'] = self.snap_area_border.to_json() + if self.scroll_margin_color is not None: + json['scrollMarginColor'] = self.scroll_margin_color.to_json() + if self.scroll_padding_color is not None: + json['scrollPaddingColor'] = self.scroll_padding_color.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ScrollSnapContainerHighlightConfig: + return cls( + snapport_border=LineStyle.from_json(json['snapportBorder']) if 'snapportBorder' in json else None, + snap_area_border=LineStyle.from_json(json['snapAreaBorder']) if 'snapAreaBorder' in json else None, + scroll_margin_color=dom.RGBA.from_json(json['scrollMarginColor']) if 'scrollMarginColor' in json else None, + scroll_padding_color=dom.RGBA.from_json(json['scrollPaddingColor']) if 'scrollPaddingColor' in json else None, + ) + + +@dataclass +class ScrollSnapHighlightConfig: + #: A descriptor for the highlight appearance of scroll snap containers. + scroll_snap_container_highlight_config: ScrollSnapContainerHighlightConfig + + #: Identifier of the node to highlight. + node_id: dom.NodeId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['scrollSnapContainerHighlightConfig'] = self.scroll_snap_container_highlight_config.to_json() + json['nodeId'] = self.node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ScrollSnapHighlightConfig: + return cls( + scroll_snap_container_highlight_config=ScrollSnapContainerHighlightConfig.from_json(json['scrollSnapContainerHighlightConfig']), + node_id=dom.NodeId.from_json(json['nodeId']), + ) + + +@dataclass +class HingeConfig: + r''' + Configuration for dual screen hinge + ''' + #: A rectangle represent hinge + rect: dom.Rect + + #: The content box highlight fill color (default: a dark color). + content_color: typing.Optional[dom.RGBA] = None + + #: The content box highlight outline color (default: transparent). + outline_color: typing.Optional[dom.RGBA] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['rect'] = self.rect.to_json() + if self.content_color is not None: + json['contentColor'] = self.content_color.to_json() + if self.outline_color is not None: + json['outlineColor'] = self.outline_color.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> HingeConfig: + return cls( + rect=dom.Rect.from_json(json['rect']), + content_color=dom.RGBA.from_json(json['contentColor']) if 'contentColor' in json else None, + outline_color=dom.RGBA.from_json(json['outlineColor']) if 'outlineColor' in json else None, + ) + + +@dataclass +class ContainerQueryHighlightConfig: + #: A descriptor for the highlight appearance of container query containers. + container_query_container_highlight_config: ContainerQueryContainerHighlightConfig + + #: Identifier of the container node to highlight. + node_id: dom.NodeId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['containerQueryContainerHighlightConfig'] = self.container_query_container_highlight_config.to_json() + json['nodeId'] = self.node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ContainerQueryHighlightConfig: + return cls( + container_query_container_highlight_config=ContainerQueryContainerHighlightConfig.from_json(json['containerQueryContainerHighlightConfig']), + node_id=dom.NodeId.from_json(json['nodeId']), + ) + + +@dataclass +class ContainerQueryContainerHighlightConfig: + #: The style of the container border. + container_border: typing.Optional[LineStyle] = None + + #: The style of the descendants' borders. + descendant_border: typing.Optional[LineStyle] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.container_border is not None: + json['containerBorder'] = self.container_border.to_json() + if self.descendant_border is not None: + json['descendantBorder'] = self.descendant_border.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> ContainerQueryContainerHighlightConfig: + return cls( + container_border=LineStyle.from_json(json['containerBorder']) if 'containerBorder' in json else None, + descendant_border=LineStyle.from_json(json['descendantBorder']) if 'descendantBorder' in json else None, + ) + + +@dataclass +class IsolatedElementHighlightConfig: + #: A descriptor for the highlight appearance of an element in isolation mode. + isolation_mode_highlight_config: IsolationModeHighlightConfig + + #: Identifier of the isolated element to highlight. + node_id: dom.NodeId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['isolationModeHighlightConfig'] = self.isolation_mode_highlight_config.to_json() + json['nodeId'] = self.node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> IsolatedElementHighlightConfig: + return cls( + isolation_mode_highlight_config=IsolationModeHighlightConfig.from_json(json['isolationModeHighlightConfig']), + node_id=dom.NodeId.from_json(json['nodeId']), + ) + + +@dataclass +class IsolationModeHighlightConfig: + #: The fill color of the resizers (default: transparent). + resizer_color: typing.Optional[dom.RGBA] = None + + #: The fill color for resizer handles (default: transparent). + resizer_handle_color: typing.Optional[dom.RGBA] = None + + #: The fill color for the mask covering non-isolated elements (default: transparent). + mask_color: typing.Optional[dom.RGBA] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.resizer_color is not None: + json['resizerColor'] = self.resizer_color.to_json() + if self.resizer_handle_color is not None: + json['resizerHandleColor'] = self.resizer_handle_color.to_json() + if self.mask_color is not None: + json['maskColor'] = self.mask_color.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> IsolationModeHighlightConfig: + return cls( + resizer_color=dom.RGBA.from_json(json['resizerColor']) if 'resizerColor' in json else None, + resizer_handle_color=dom.RGBA.from_json(json['resizerHandleColor']) if 'resizerHandleColor' in json else None, + mask_color=dom.RGBA.from_json(json['maskColor']) if 'maskColor' in json else None, ) @@ -119,7 +733,7 @@ def from_json(cls, json: str) -> InspectMode: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -129,7 +743,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -141,14 +755,18 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_highlight_object_for_test( node_id: dom.NodeId, include_distance: typing.Optional[bool] = None, - include_style: typing.Optional[bool] = None + include_style: typing.Optional[bool] = None, + color_format: typing.Optional[ColorFormat] = None, + show_accessibility_info: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]: - ''' + r''' For testing. :param node_id: Id of the node to get highlight object for. :param include_distance: *(Optional)* Whether to include distance info. :param include_style: *(Optional)* Whether to include style info. + :param color_format: *(Optional)* The color format to get config with (default: hex). + :param show_accessibility_info: *(Optional)* Whether to show accessibility info (default: true). :returns: Highlight data for the node. ''' params: T_JSON_DICT = dict() @@ -157,6 +775,10 @@ def get_highlight_object_for_test( params['includeDistance'] = include_distance if include_style is not None: params['includeStyle'] = include_style + if color_format is not None: + params['colorFormat'] = color_format.to_json() + if show_accessibility_info is not None: + params['showAccessibilityInfo'] = show_accessibility_info cmd_dict: T_JSON_DICT = { 'method': 'Overlay.getHighlightObjectForTest', 'params': params, @@ -165,8 +787,46 @@ def get_highlight_object_for_test( return dict(json['highlight']) -def hide_highlight() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: +def get_grid_highlight_objects_for_test( + node_ids: typing.List[dom.NodeId] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]: + r''' + For Persistent Grid testing. + + :param node_ids: Ids of the node to get highlight object for. + :returns: Grid Highlight data for the node ids provided. + ''' + params: T_JSON_DICT = dict() + params['nodeIds'] = [i.to_json() for i in node_ids] + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.getGridHighlightObjectsForTest', + 'params': params, + } + json = yield cmd_dict + return dict(json['highlights']) + + +def get_source_order_highlight_object_for_test( + node_id: dom.NodeId + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]: + r''' + For Source Order Viewer testing. + + :param node_id: Id of the node to highlight. + :returns: Source order highlight data for the node id provided. ''' + params: T_JSON_DICT = dict() + params['nodeId'] = node_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.getSourceOrderHighlightObjectForTest', + 'params': params, + } + json = yield cmd_dict + return dict(json['highlight']) + + +def hide_highlight() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Hides any highlight. ''' cmd_dict: T_JSON_DICT = { @@ -175,13 +835,19 @@ def hide_highlight() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict +@deprecated(version="1.3") def highlight_frame( frame_id: page.FrameId, content_color: typing.Optional[dom.RGBA] = None, content_outline_color: typing.Optional[dom.RGBA] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Highlights owner element of the frame with given id. + Deprecated: Doesn't work reliablity and cannot be fixed due to process + separatation (the owner node might be in a different process). Determine + the owner node in the client and use highlightNode. + + .. deprecated:: 1.3 :param frame_id: Identifier of the frame to highlight. :param content_color: *(Optional)* The content box highlight fill color (default: transparent). @@ -207,7 +873,7 @@ def highlight_node( object_id: typing.Optional[runtime.RemoteObjectId] = None, selector: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified. @@ -239,7 +905,7 @@ def highlight_quad( color: typing.Optional[dom.RGBA] = None, outline_color: typing.Optional[dom.RGBA] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Highlights given quad. Coordinates are absolute with respect to the main frame viewport. :param quad: Quad to highlight @@ -267,7 +933,7 @@ def highlight_rect( color: typing.Optional[dom.RGBA] = None, outline_color: typing.Optional[dom.RGBA] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. :param x: X coordinate @@ -293,11 +959,41 @@ def highlight_rect( json = yield cmd_dict +def highlight_source_order( + source_order_config: SourceOrderConfig, + node_id: typing.Optional[dom.NodeId] = None, + backend_node_id: typing.Optional[dom.BackendNodeId] = None, + object_id: typing.Optional[runtime.RemoteObjectId] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + 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. + + :param source_order_config: A descriptor for the appearance of the overlay drawing. + :param node_id: *(Optional)* Identifier of the node to highlight. + :param backend_node_id: *(Optional)* Identifier of the backend node to highlight. + :param object_id: *(Optional)* JavaScript object id of the node to be highlighted. + ''' + params: T_JSON_DICT = dict() + params['sourceOrderConfig'] = source_order_config.to_json() + if node_id is not None: + params['nodeId'] = node_id.to_json() + if backend_node_id is not None: + params['backendNodeId'] = backend_node_id.to_json() + if object_id is not None: + params['objectId'] = object_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.highlightSourceOrder', + 'params': params, + } + json = yield cmd_dict + + def set_inspect_mode( mode: InspectMode, highlight_config: typing.Optional[HighlightConfig] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspectNodeRequested' event upon element selection. @@ -318,7 +1014,7 @@ def set_inspect_mode( def set_show_ad_highlights( show: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Highlights owner element of all frames detected to be ads. :param show: True for showing ad highlights @@ -335,7 +1031,7 @@ def set_show_ad_highlights( def set_paused_in_debugger_message( message: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param message: *(Optional)* The message to display, also triggers resume and step over controls. ''' params: T_JSON_DICT = dict() @@ -351,7 +1047,7 @@ def set_paused_in_debugger_message( def set_show_debug_borders( show: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Requests that backend shows debug borders on layers :param show: True for showing debug borders @@ -368,7 +1064,7 @@ def set_show_debug_borders( def set_show_fps_counter( show: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Requests that backend shows the FPS counter :param show: True for showing the FPS counter @@ -382,10 +1078,72 @@ def set_show_fps_counter( json = yield cmd_dict +def set_show_grid_overlays( + grid_node_highlight_configs: typing.List[GridNodeHighlightConfig] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Highlight multiple elements with the CSS Grid overlay. + + :param grid_node_highlight_configs: An array of node identifiers and descriptors for the highlight appearance. + ''' + params: T_JSON_DICT = dict() + params['gridNodeHighlightConfigs'] = [i.to_json() for i in grid_node_highlight_configs] + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.setShowGridOverlays', + 'params': params, + } + json = yield cmd_dict + + +def set_show_flex_overlays( + flex_node_highlight_configs: typing.List[FlexNodeHighlightConfig] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + :param flex_node_highlight_configs: An array of node identifiers and descriptors for the highlight appearance. + ''' + params: T_JSON_DICT = dict() + params['flexNodeHighlightConfigs'] = [i.to_json() for i in flex_node_highlight_configs] + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.setShowFlexOverlays', + 'params': params, + } + json = yield cmd_dict + + +def set_show_scroll_snap_overlays( + scroll_snap_highlight_configs: typing.List[ScrollSnapHighlightConfig] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + :param scroll_snap_highlight_configs: An array of node identifiers and descriptors for the highlight appearance. + ''' + params: T_JSON_DICT = dict() + params['scrollSnapHighlightConfigs'] = [i.to_json() for i in scroll_snap_highlight_configs] + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.setShowScrollSnapOverlays', + 'params': params, + } + json = yield cmd_dict + + +def set_show_container_query_overlays( + container_query_highlight_configs: typing.List[ContainerQueryHighlightConfig] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + :param container_query_highlight_configs: An array of node identifiers and descriptors for the highlight appearance. + ''' + params: T_JSON_DICT = dict() + params['containerQueryHighlightConfigs'] = [i.to_json() for i in container_query_highlight_configs] + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.setShowContainerQueryOverlays', + 'params': params, + } + json = yield cmd_dict + + def set_show_paint_rects( result: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Requests that backend shows paint rectangles :param result: True for showing paint rectangles @@ -402,7 +1160,7 @@ def set_show_paint_rects( def set_show_layout_shift_regions( result: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Requests that backend shows layout shift regions :param result: True for showing layout shift regions @@ -419,7 +1177,7 @@ def set_show_layout_shift_regions( def set_show_scroll_bottleneck_rects( show: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Requests that backend shows scroll bottleneck rects :param show: True for showing scroll bottleneck rects @@ -436,7 +1194,7 @@ def set_show_scroll_bottleneck_rects( def set_show_hit_test_borders( show: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Requests that backend shows hit-test borders on layers :param show: True for showing hit-test borders @@ -450,10 +1208,27 @@ def set_show_hit_test_borders( json = yield cmd_dict -def set_show_viewport_size_on_resize( +def set_show_web_vitals( show: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Request that backend shows an overlay with web vital metrics. + + :param show: ''' + params: T_JSON_DICT = dict() + params['show'] = show + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.setShowWebVitals', + 'params': params, + } + json = yield cmd_dict + + +def set_show_viewport_size_on_resize( + show: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Paints viewport size upon main frame resize. :param show: Whether to paint size or not. @@ -467,10 +1242,45 @@ def set_show_viewport_size_on_resize( json = yield cmd_dict +def set_show_hinge( + hinge_config: typing.Optional[HingeConfig] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Add a dual screen device hinge + + :param hinge_config: *(Optional)* hinge data, null means hideHinge + ''' + params: T_JSON_DICT = dict() + if hinge_config is not None: + params['hingeConfig'] = hinge_config.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.setShowHinge', + 'params': params, + } + json = yield cmd_dict + + +def set_show_isolated_elements( + isolated_element_highlight_configs: typing.List[IsolatedElementHighlightConfig] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Show elements in isolation mode with overlays. + + :param isolated_element_highlight_configs: An array of node identifiers and descriptors for the highlight appearance. + ''' + params: T_JSON_DICT = dict() + params['isolatedElementHighlightConfigs'] = [i.to_json() for i in isolated_element_highlight_configs] + cmd_dict: T_JSON_DICT = { + 'method': 'Overlay.setShowIsolatedElements', + 'params': params, + } + json = yield cmd_dict + + @event_class('Overlay.inspectNodeRequested') @dataclass class InspectNodeRequested: - ''' + r''' Fired when the node should be inspected. This happens after call to ``setInspectMode`` or when user manually inspects an element. ''' @@ -487,7 +1297,7 @@ def from_json(cls, json: T_JSON_DICT) -> InspectNodeRequested: @event_class('Overlay.nodeHighlightRequested') @dataclass class NodeHighlightRequested: - ''' + r''' Fired when the node should be highlighted. This happens after call to ``setInspectMode``. ''' node_id: dom.NodeId @@ -502,7 +1312,7 @@ def from_json(cls, json: T_JSON_DICT) -> NodeHighlightRequested: @event_class('Overlay.screenshotRequested') @dataclass class ScreenshotRequested: - ''' + r''' Fired when user asks to capture screenshot of some area on the page. ''' #: Viewport to capture, in device independent pixels (dip). @@ -518,7 +1328,7 @@ def from_json(cls, json: T_JSON_DICT) -> ScreenshotRequested: @event_class('Overlay.inspectModeCanceled') @dataclass class InspectModeCanceled: - ''' + r''' Fired when user cancels the inspect mode. ''' diff --git a/cdp/page.py b/cdp/page.py index 6eff865..74f892b 100644 --- a/cdp/page.py +++ b/cdp/page.py @@ -21,7 +21,7 @@ class FrameId(str): - ''' + r''' Unique frame identifier. ''' def to_json(self) -> str: @@ -35,13 +35,392 @@ def __repr__(self): return 'FrameId({})'.format(super().__repr__()) +class AdFrameType(enum.Enum): + r''' + Indicates whether a frame has been identified as an ad. + ''' + NONE = "none" + CHILD = "child" + ROOT = "root" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> AdFrameType: + return cls(json) + + +class AdFrameExplanation(enum.Enum): + PARENT_IS_AD = "ParentIsAd" + CREATED_BY_AD_SCRIPT = "CreatedByAdScript" + MATCHED_BLOCKING_RULE = "MatchedBlockingRule" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> AdFrameExplanation: + return cls(json) + + @dataclass -class Frame: +class AdFrameStatus: + r''' + Indicates whether a frame has been identified as an ad and why. + ''' + ad_frame_type: AdFrameType + + explanations: typing.Optional[typing.List[AdFrameExplanation]] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['adFrameType'] = self.ad_frame_type.to_json() + if self.explanations is not None: + json['explanations'] = [i.to_json() for i in self.explanations] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AdFrameStatus: + return cls( + ad_frame_type=AdFrameType.from_json(json['adFrameType']), + explanations=[AdFrameExplanation.from_json(i) for i in json['explanations']] if 'explanations' in json else None, + ) + + +class SecureContextType(enum.Enum): + r''' + Indicates whether the frame is a secure context and why it is the case. + ''' + SECURE = "Secure" + SECURE_LOCALHOST = "SecureLocalhost" + INSECURE_SCHEME = "InsecureScheme" + INSECURE_ANCESTOR = "InsecureAncestor" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> SecureContextType: + return cls(json) + + +class CrossOriginIsolatedContextType(enum.Enum): + r''' + Indicates whether the frame is cross-origin isolated and why it is the case. + ''' + ISOLATED = "Isolated" + NOT_ISOLATED = "NotIsolated" + NOT_ISOLATED_FEATURE_DISABLED = "NotIsolatedFeatureDisabled" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> CrossOriginIsolatedContextType: + return cls(json) + + +class GatedAPIFeatures(enum.Enum): + SHARED_ARRAY_BUFFERS = "SharedArrayBuffers" + SHARED_ARRAY_BUFFERS_TRANSFER_ALLOWED = "SharedArrayBuffersTransferAllowed" + PERFORMANCE_MEASURE_MEMORY = "PerformanceMeasureMemory" + PERFORMANCE_PROFILE = "PerformanceProfile" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> GatedAPIFeatures: + return cls(json) + + +class PermissionsPolicyFeature(enum.Enum): + r''' + All Permissions Policy features. This enum should match the one defined + in third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5. + ''' + ACCELEROMETER = "accelerometer" + AMBIENT_LIGHT_SENSOR = "ambient-light-sensor" + ATTRIBUTION_REPORTING = "attribution-reporting" + AUTOPLAY = "autoplay" + CAMERA = "camera" + CH_DPR = "ch-dpr" + CH_DEVICE_MEMORY = "ch-device-memory" + CH_DOWNLINK = "ch-downlink" + CH_ECT = "ch-ect" + CH_PREFERS_COLOR_SCHEME = "ch-prefers-color-scheme" + CH_RTT = "ch-rtt" + CH_UA = "ch-ua" + CH_UA_ARCH = "ch-ua-arch" + CH_UA_BITNESS = "ch-ua-bitness" + CH_UA_PLATFORM = "ch-ua-platform" + CH_UA_MODEL = "ch-ua-model" + CH_UA_MOBILE = "ch-ua-mobile" + CH_UA_FULL_VERSION = "ch-ua-full-version" + CH_UA_FULL_VERSION_LIST = "ch-ua-full-version-list" + CH_UA_PLATFORM_VERSION = "ch-ua-platform-version" + CH_UA_REDUCED = "ch-ua-reduced" + CH_VIEWPORT_HEIGHT = "ch-viewport-height" + CH_VIEWPORT_WIDTH = "ch-viewport-width" + CH_WIDTH = "ch-width" + CLIPBOARD_READ = "clipboard-read" + CLIPBOARD_WRITE = "clipboard-write" + CROSS_ORIGIN_ISOLATED = "cross-origin-isolated" + DIRECT_SOCKETS = "direct-sockets" + DISPLAY_CAPTURE = "display-capture" + DOCUMENT_DOMAIN = "document-domain" + ENCRYPTED_MEDIA = "encrypted-media" + EXECUTION_WHILE_OUT_OF_VIEWPORT = "execution-while-out-of-viewport" + EXECUTION_WHILE_NOT_RENDERED = "execution-while-not-rendered" + FOCUS_WITHOUT_USER_ACTIVATION = "focus-without-user-activation" + FULLSCREEN = "fullscreen" + FROBULATE = "frobulate" + GAMEPAD = "gamepad" + GEOLOCATION = "geolocation" + GYROSCOPE = "gyroscope" + HID = "hid" + IDLE_DETECTION = "idle-detection" + INTEREST_COHORT = "interest-cohort" + JOIN_AD_INTEREST_GROUP = "join-ad-interest-group" + KEYBOARD_MAP = "keyboard-map" + MAGNETOMETER = "magnetometer" + MICROPHONE = "microphone" + MIDI = "midi" + OTP_CREDENTIALS = "otp-credentials" + PAYMENT = "payment" + PICTURE_IN_PICTURE = "picture-in-picture" + PUBLICKEY_CREDENTIALS_GET = "publickey-credentials-get" + RUN_AD_AUCTION = "run-ad-auction" + SCREEN_WAKE_LOCK = "screen-wake-lock" + SERIAL = "serial" + SHARED_AUTOFILL = "shared-autofill" + STORAGE_ACCESS_API = "storage-access-api" + SYNC_XHR = "sync-xhr" + TRUST_TOKEN_REDEMPTION = "trust-token-redemption" + USB = "usb" + VERTICAL_SCROLL = "vertical-scroll" + WEB_SHARE = "web-share" + WINDOW_PLACEMENT = "window-placement" + XR_SPATIAL_TRACKING = "xr-spatial-tracking" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> PermissionsPolicyFeature: + return cls(json) + + +class PermissionsPolicyBlockReason(enum.Enum): + r''' + Reason for a permissions policy feature to be disabled. + ''' + HEADER = "Header" + IFRAME_ATTRIBUTE = "IframeAttribute" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> PermissionsPolicyBlockReason: + return cls(json) + + +@dataclass +class PermissionsPolicyBlockLocator: + frame_id: FrameId + + block_reason: PermissionsPolicyBlockReason + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['frameId'] = self.frame_id.to_json() + json['blockReason'] = self.block_reason.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PermissionsPolicyBlockLocator: + return cls( + frame_id=FrameId.from_json(json['frameId']), + block_reason=PermissionsPolicyBlockReason.from_json(json['blockReason']), + ) + + +@dataclass +class PermissionsPolicyFeatureState: + feature: PermissionsPolicyFeature + + allowed: bool + + locator: typing.Optional[PermissionsPolicyBlockLocator] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['feature'] = self.feature.to_json() + json['allowed'] = self.allowed + if self.locator is not None: + json['locator'] = self.locator.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PermissionsPolicyFeatureState: + return cls( + feature=PermissionsPolicyFeature.from_json(json['feature']), + allowed=bool(json['allowed']), + locator=PermissionsPolicyBlockLocator.from_json(json['locator']) if 'locator' in json else None, + ) + + +class OriginTrialTokenStatus(enum.Enum): + r''' + Origin Trial(https://www.chromium.org/blink/origin-trials) support. + Status for an Origin Trial token. + ''' + SUCCESS = "Success" + NOT_SUPPORTED = "NotSupported" + INSECURE = "Insecure" + EXPIRED = "Expired" + WRONG_ORIGIN = "WrongOrigin" + INVALID_SIGNATURE = "InvalidSignature" + MALFORMED = "Malformed" + WRONG_VERSION = "WrongVersion" + FEATURE_DISABLED = "FeatureDisabled" + TOKEN_DISABLED = "TokenDisabled" + FEATURE_DISABLED_FOR_USER = "FeatureDisabledForUser" + UNKNOWN_TRIAL = "UnknownTrial" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> OriginTrialTokenStatus: + return cls(json) + + +class OriginTrialStatus(enum.Enum): + r''' + Status for an Origin Trial. ''' + ENABLED = "Enabled" + VALID_TOKEN_NOT_PROVIDED = "ValidTokenNotProvided" + OS_NOT_SUPPORTED = "OSNotSupported" + TRIAL_NOT_ALLOWED = "TrialNotAllowed" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> OriginTrialStatus: + return cls(json) + + +class OriginTrialUsageRestriction(enum.Enum): + NONE = "None" + SUBSET = "Subset" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> OriginTrialUsageRestriction: + return cls(json) + + +@dataclass +class OriginTrialToken: + origin: str + + match_sub_domains: bool + + trial_name: str + + expiry_time: network.TimeSinceEpoch + + is_third_party: bool + + usage_restriction: OriginTrialUsageRestriction + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['origin'] = self.origin + json['matchSubDomains'] = self.match_sub_domains + json['trialName'] = self.trial_name + json['expiryTime'] = self.expiry_time.to_json() + json['isThirdParty'] = self.is_third_party + json['usageRestriction'] = self.usage_restriction.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> OriginTrialToken: + return cls( + origin=str(json['origin']), + match_sub_domains=bool(json['matchSubDomains']), + trial_name=str(json['trialName']), + expiry_time=network.TimeSinceEpoch.from_json(json['expiryTime']), + is_third_party=bool(json['isThirdParty']), + usage_restriction=OriginTrialUsageRestriction.from_json(json['usageRestriction']), + ) + + +@dataclass +class OriginTrialTokenWithStatus: + raw_token_text: str + + status: OriginTrialTokenStatus + + #: ``parsedToken`` is present only when the token is extractable and + #: parsable. + parsed_token: typing.Optional[OriginTrialToken] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['rawTokenText'] = self.raw_token_text + json['status'] = self.status.to_json() + if self.parsed_token is not None: + json['parsedToken'] = self.parsed_token.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> OriginTrialTokenWithStatus: + return cls( + raw_token_text=str(json['rawTokenText']), + status=OriginTrialTokenStatus.from_json(json['status']), + parsed_token=OriginTrialToken.from_json(json['parsedToken']) if 'parsedToken' in json else None, + ) + + +@dataclass +class OriginTrial: + trial_name: str + + status: OriginTrialStatus + + tokens_with_status: typing.List[OriginTrialTokenWithStatus] + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['trialName'] = self.trial_name + json['status'] = self.status.to_json() + json['tokensWithStatus'] = [i.to_json() for i in self.tokens_with_status] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> OriginTrial: + return cls( + trial_name=str(json['trialName']), + status=OriginTrialStatus.from_json(json['status']), + tokens_with_status=[OriginTrialTokenWithStatus.from_json(i) for i in json['tokensWithStatus']], + ) + + +@dataclass +class Frame: + r''' Information about the Frame on the page. ''' #: Frame unique identifier. - id_: str + id_: FrameId #: Identifier of the loader associated with this frame. loader_id: network.LoaderId @@ -49,14 +428,29 @@ class Frame: #: Frame document's URL without fragment. url: str + #: Frame document's registered domain, taking the public suffixes list into account. + #: Extracted from the Frame's url. + #: Example URLs: http://www.google.com/file.html -> "google.com" + #: http://a.b.co.uk/file.html -> "b.co.uk" + domain_and_registry: str + #: Frame document's security origin. security_origin: str #: Frame document's mimeType as determined by the browser. mime_type: str + #: Indicates whether the main document is a secure context and explains why that is the case. + secure_context_type: SecureContextType + + #: Indicates whether this is a cross origin isolated context. + cross_origin_isolated_context_type: CrossOriginIsolatedContextType + + #: Indicated which gated APIs / features are available. + gated_api_features: typing.List[GatedAPIFeatures] + #: Parent frame identifier. - parent_id: typing.Optional[str] = None + parent_id: typing.Optional[FrameId] = None #: Frame's name as specified in the tag. name: typing.Optional[str] = None @@ -67,41 +461,55 @@ class Frame: #: If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment. unreachable_url: typing.Optional[str] = None + #: Indicates whether this frame was tagged as an ad and why. + ad_frame_status: typing.Optional[AdFrameStatus] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() - json['id'] = self.id_ + json['id'] = self.id_.to_json() json['loaderId'] = self.loader_id.to_json() json['url'] = self.url + json['domainAndRegistry'] = self.domain_and_registry json['securityOrigin'] = self.security_origin json['mimeType'] = self.mime_type + json['secureContextType'] = self.secure_context_type.to_json() + json['crossOriginIsolatedContextType'] = self.cross_origin_isolated_context_type.to_json() + json['gatedAPIFeatures'] = [i.to_json() for i in self.gated_api_features] if self.parent_id is not None: - json['parentId'] = self.parent_id + json['parentId'] = self.parent_id.to_json() if self.name is not None: json['name'] = self.name if self.url_fragment is not None: json['urlFragment'] = self.url_fragment if self.unreachable_url is not None: json['unreachableUrl'] = self.unreachable_url + if self.ad_frame_status is not None: + json['adFrameStatus'] = self.ad_frame_status.to_json() return json @classmethod def from_json(cls, json: T_JSON_DICT) -> Frame: return cls( - id_=str(json['id']), + id_=FrameId.from_json(json['id']), loader_id=network.LoaderId.from_json(json['loaderId']), url=str(json['url']), + domain_and_registry=str(json['domainAndRegistry']), security_origin=str(json['securityOrigin']), mime_type=str(json['mimeType']), - parent_id=str(json['parentId']) if 'parentId' in json else None, + secure_context_type=SecureContextType.from_json(json['secureContextType']), + cross_origin_isolated_context_type=CrossOriginIsolatedContextType.from_json(json['crossOriginIsolatedContextType']), + gated_api_features=[GatedAPIFeatures.from_json(i) for i in json['gatedAPIFeatures']], + parent_id=FrameId.from_json(json['parentId']) if 'parentId' in json else None, name=str(json['name']) if 'name' in json else None, url_fragment=str(json['urlFragment']) if 'urlFragment' in json else None, unreachable_url=str(json['unreachableUrl']) if 'unreachableUrl' in json else None, + ad_frame_status=AdFrameStatus.from_json(json['adFrameStatus']) if 'adFrameStatus' in json else None, ) @dataclass class FrameResource: - ''' + r''' Information about the Resource on the page. ''' #: Resource URL. @@ -155,7 +563,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameResource: @dataclass class FrameResourceTree: - ''' + r''' Information about the Frame hierarchy along with their cached resources. ''' #: Frame information for this tree item. @@ -186,7 +594,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameResourceTree: @dataclass class FrameTree: - ''' + r''' Information about the Frame hierarchy. ''' #: Frame information for this tree item. @@ -211,7 +619,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameTree: class ScriptIdentifier(str): - ''' + r''' Unique script identifier. ''' def to_json(self) -> str: @@ -226,7 +634,7 @@ def __repr__(self): class TransitionType(enum.Enum): - ''' + r''' Transition type. ''' LINK = "link" @@ -253,7 +661,7 @@ def from_json(cls, json: str) -> TransitionType: @dataclass class NavigationEntry: - ''' + r''' Navigation history entry. ''' #: Unique id of the navigation history entry. @@ -293,7 +701,7 @@ def from_json(cls, json: T_JSON_DICT) -> NavigationEntry: @dataclass class ScreencastFrameMetadata: - ''' + r''' Screencast frame metadata. ''' #: Top offset in DIP. @@ -343,7 +751,7 @@ def from_json(cls, json: T_JSON_DICT) -> ScreencastFrameMetadata: class DialogType(enum.Enum): - ''' + r''' Javascript dialog type. ''' ALERT = "alert" @@ -361,7 +769,7 @@ def from_json(cls, json: str) -> DialogType: @dataclass class AppManifestError: - ''' + r''' Error while paring app manifest. ''' #: Error message. @@ -395,8 +803,28 @@ def from_json(cls, json: T_JSON_DICT) -> AppManifestError: @dataclass -class LayoutViewport: +class AppManifestParsedProperties: + r''' + Parsed app manifest properties. ''' + #: Computed scope value + scope: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['scope'] = self.scope + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AppManifestParsedProperties: + return cls( + scope=str(json['scope']), + ) + + +@dataclass +class LayoutViewport: + r''' Layout viewport position and dimensions. ''' #: Horizontal offset relative to the document (CSS pixels). @@ -431,7 +859,7 @@ def from_json(cls, json: T_JSON_DICT) -> LayoutViewport: @dataclass class VisualViewport: - ''' + r''' Visual viewport position, dimensions, and scale. ''' #: Horizontal offset relative to the layout viewport (CSS pixels). @@ -487,7 +915,7 @@ def from_json(cls, json: T_JSON_DICT) -> VisualViewport: @dataclass class Viewport: - ''' + r''' Viewport for capturing screenshot. ''' #: X offset in device independent pixels (dip). @@ -527,7 +955,7 @@ def from_json(cls, json: T_JSON_DICT) -> Viewport: @dataclass class FontFamilies: - ''' + r''' Generic font families collection. ''' #: The standard font-family. @@ -582,55 +1010,381 @@ def from_json(cls, json: T_JSON_DICT) -> FontFamilies: ) -@dataclass -class FontSizes: - ''' - Default font sizes. +@dataclass +class FontSizes: + r''' + Default font sizes. + ''' + #: Default standard font size. + standard: typing.Optional[int] = None + + #: Default fixed font size. + fixed: typing.Optional[int] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + if self.standard is not None: + json['standard'] = self.standard + if self.fixed is not None: + json['fixed'] = self.fixed + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> FontSizes: + return cls( + standard=int(json['standard']) if 'standard' in json else None, + fixed=int(json['fixed']) if 'fixed' in json else None, + ) + + +class ClientNavigationReason(enum.Enum): + FORM_SUBMISSION_GET = "formSubmissionGet" + FORM_SUBMISSION_POST = "formSubmissionPost" + HTTP_HEADER_REFRESH = "httpHeaderRefresh" + SCRIPT_INITIATED = "scriptInitiated" + META_TAG_REFRESH = "metaTagRefresh" + PAGE_BLOCK_INTERSTITIAL = "pageBlockInterstitial" + RELOAD = "reload" + ANCHOR_CLICK = "anchorClick" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ClientNavigationReason: + return cls(json) + + +class ClientNavigationDisposition(enum.Enum): + CURRENT_TAB = "currentTab" + NEW_TAB = "newTab" + NEW_WINDOW = "newWindow" + DOWNLOAD = "download" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ClientNavigationDisposition: + return cls(json) + + +@dataclass +class InstallabilityErrorArgument: + #: Argument name (e.g. name:'minimum-icon-size-in-pixels'). + name: str + + #: Argument value (e.g. value:'64'). + value: str + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['name'] = self.name + json['value'] = self.value + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> InstallabilityErrorArgument: + return cls( + name=str(json['name']), + value=str(json['value']), + ) + + +@dataclass +class InstallabilityError: + r''' + The installability error + ''' + #: The error id (e.g. 'manifest-missing-suitable-icon'). + error_id: str + + #: The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}). + error_arguments: typing.List[InstallabilityErrorArgument] + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['errorId'] = self.error_id + json['errorArguments'] = [i.to_json() for i in self.error_arguments] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> InstallabilityError: + return cls( + error_id=str(json['errorId']), + error_arguments=[InstallabilityErrorArgument.from_json(i) for i in json['errorArguments']], + ) + + +class ReferrerPolicy(enum.Enum): + r''' + The referring-policy used for the navigation. + ''' + NO_REFERRER = "noReferrer" + NO_REFERRER_WHEN_DOWNGRADE = "noReferrerWhenDowngrade" + ORIGIN = "origin" + ORIGIN_WHEN_CROSS_ORIGIN = "originWhenCrossOrigin" + SAME_ORIGIN = "sameOrigin" + STRICT_ORIGIN = "strictOrigin" + STRICT_ORIGIN_WHEN_CROSS_ORIGIN = "strictOriginWhenCrossOrigin" + UNSAFE_URL = "unsafeUrl" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ReferrerPolicy: + return cls(json) + + +@dataclass +class CompilationCacheParams: + r''' + Per-script compilation cache parameters for ``Page.produceCompilationCache`` + ''' + #: The URL of the script to produce a compilation cache entry for. + url: str + + #: A hint to the backend whether eager compilation is recommended. + #: (the actual compilation mode used is upon backend discretion). + eager: typing.Optional[bool] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['url'] = self.url + if self.eager is not None: + json['eager'] = self.eager + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CompilationCacheParams: + return cls( + url=str(json['url']), + eager=bool(json['eager']) if 'eager' in json else None, + ) + + +class NavigationType(enum.Enum): + r''' + The type of a frameNavigated event. + ''' + NAVIGATION = "Navigation" + BACK_FORWARD_CACHE_RESTORE = "BackForwardCacheRestore" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> NavigationType: + return cls(json) + + +class BackForwardCacheNotRestoredReason(enum.Enum): + r''' + List of not restored reasons for back-forward cache. + ''' + NOT_MAIN_FRAME = "NotMainFrame" + BACK_FORWARD_CACHE_DISABLED = "BackForwardCacheDisabled" + RELATED_ACTIVE_CONTENTS_EXIST = "RelatedActiveContentsExist" + HTTP_STATUS_NOT_OK = "HTTPStatusNotOK" + SCHEME_NOT_HTTP_OR_HTTPS = "SchemeNotHTTPOrHTTPS" + LOADING = "Loading" + WAS_GRANTED_MEDIA_ACCESS = "WasGrantedMediaAccess" + DISABLE_FOR_RENDER_FRAME_HOST_CALLED = "DisableForRenderFrameHostCalled" + DOMAIN_NOT_ALLOWED = "DomainNotAllowed" + HTTP_METHOD_NOT_GET = "HTTPMethodNotGET" + SUBFRAME_IS_NAVIGATING = "SubframeIsNavigating" + TIMEOUT = "Timeout" + CACHE_LIMIT = "CacheLimit" + JAVA_SCRIPT_EXECUTION = "JavaScriptExecution" + RENDERER_PROCESS_KILLED = "RendererProcessKilled" + RENDERER_PROCESS_CRASHED = "RendererProcessCrashed" + GRANTED_MEDIA_STREAM_ACCESS = "GrantedMediaStreamAccess" + SCHEDULER_TRACKED_FEATURE_USED = "SchedulerTrackedFeatureUsed" + CONFLICTING_BROWSING_INSTANCE = "ConflictingBrowsingInstance" + CACHE_FLUSHED = "CacheFlushed" + SERVICE_WORKER_VERSION_ACTIVATION = "ServiceWorkerVersionActivation" + SESSION_RESTORED = "SessionRestored" + SERVICE_WORKER_POST_MESSAGE = "ServiceWorkerPostMessage" + ENTERED_BACK_FORWARD_CACHE_BEFORE_SERVICE_WORKER_HOST_ADDED = "EnteredBackForwardCacheBeforeServiceWorkerHostAdded" + RENDER_FRAME_HOST_REUSED_SAME_SITE = "RenderFrameHostReused_SameSite" + RENDER_FRAME_HOST_REUSED_CROSS_SITE = "RenderFrameHostReused_CrossSite" + SERVICE_WORKER_CLAIM = "ServiceWorkerClaim" + IGNORE_EVENT_AND_EVICT = "IgnoreEventAndEvict" + HAVE_INNER_CONTENTS = "HaveInnerContents" + TIMEOUT_PUTTING_IN_CACHE = "TimeoutPuttingInCache" + BACK_FORWARD_CACHE_DISABLED_BY_LOW_MEMORY = "BackForwardCacheDisabledByLowMemory" + BACK_FORWARD_CACHE_DISABLED_BY_COMMAND_LINE = "BackForwardCacheDisabledByCommandLine" + NETWORK_REQUEST_DATAPIPE_DRAINED_AS_BYTES_CONSUMER = "NetworkRequestDatapipeDrainedAsBytesConsumer" + NETWORK_REQUEST_REDIRECTED = "NetworkRequestRedirected" + NETWORK_REQUEST_TIMEOUT = "NetworkRequestTimeout" + NETWORK_EXCEEDS_BUFFER_LIMIT = "NetworkExceedsBufferLimit" + NAVIGATION_CANCELLED_WHILE_RESTORING = "NavigationCancelledWhileRestoring" + NOT_MOST_RECENT_NAVIGATION_ENTRY = "NotMostRecentNavigationEntry" + BACK_FORWARD_CACHE_DISABLED_FOR_PRERENDER = "BackForwardCacheDisabledForPrerender" + USER_AGENT_OVERRIDE_DIFFERS = "UserAgentOverrideDiffers" + FOREGROUND_CACHE_LIMIT = "ForegroundCacheLimit" + BROWSING_INSTANCE_NOT_SWAPPED = "BrowsingInstanceNotSwapped" + BACK_FORWARD_CACHE_DISABLED_FOR_DELEGATE = "BackForwardCacheDisabledForDelegate" + OPT_IN_UNLOAD_HEADER_NOT_PRESENT = "OptInUnloadHeaderNotPresent" + UNLOAD_HANDLER_EXISTS_IN_MAIN_FRAME = "UnloadHandlerExistsInMainFrame" + UNLOAD_HANDLER_EXISTS_IN_SUB_FRAME = "UnloadHandlerExistsInSubFrame" + SERVICE_WORKER_UNREGISTRATION = "ServiceWorkerUnregistration" + CACHE_CONTROL_NO_STORE = "CacheControlNoStore" + CACHE_CONTROL_NO_STORE_COOKIE_MODIFIED = "CacheControlNoStoreCookieModified" + CACHE_CONTROL_NO_STORE_HTTP_ONLY_COOKIE_MODIFIED = "CacheControlNoStoreHTTPOnlyCookieModified" + NO_RESPONSE_HEAD = "NoResponseHead" + UNKNOWN = "Unknown" + ACTIVATION_NAVIGATIONS_DISALLOWED_FOR_BUG1234857 = "ActivationNavigationsDisallowedForBug1234857" + WEB_SOCKET = "WebSocket" + WEB_TRANSPORT = "WebTransport" + WEB_RTC = "WebRTC" + MAIN_RESOURCE_HAS_CACHE_CONTROL_NO_STORE = "MainResourceHasCacheControlNoStore" + MAIN_RESOURCE_HAS_CACHE_CONTROL_NO_CACHE = "MainResourceHasCacheControlNoCache" + SUBRESOURCE_HAS_CACHE_CONTROL_NO_STORE = "SubresourceHasCacheControlNoStore" + SUBRESOURCE_HAS_CACHE_CONTROL_NO_CACHE = "SubresourceHasCacheControlNoCache" + CONTAINS_PLUGINS = "ContainsPlugins" + DOCUMENT_LOADED = "DocumentLoaded" + DEDICATED_WORKER_OR_WORKLET = "DedicatedWorkerOrWorklet" + OUTSTANDING_NETWORK_REQUEST_OTHERS = "OutstandingNetworkRequestOthers" + OUTSTANDING_INDEXED_DB_TRANSACTION = "OutstandingIndexedDBTransaction" + REQUESTED_NOTIFICATIONS_PERMISSION = "RequestedNotificationsPermission" + REQUESTED_MIDI_PERMISSION = "RequestedMIDIPermission" + REQUESTED_AUDIO_CAPTURE_PERMISSION = "RequestedAudioCapturePermission" + REQUESTED_VIDEO_CAPTURE_PERMISSION = "RequestedVideoCapturePermission" + REQUESTED_BACK_FORWARD_CACHE_BLOCKED_SENSORS = "RequestedBackForwardCacheBlockedSensors" + REQUESTED_BACKGROUND_WORK_PERMISSION = "RequestedBackgroundWorkPermission" + BROADCAST_CHANNEL = "BroadcastChannel" + INDEXED_DB_CONNECTION = "IndexedDBConnection" + WEB_XR = "WebXR" + SHARED_WORKER = "SharedWorker" + WEB_LOCKS = "WebLocks" + WEB_HID = "WebHID" + WEB_SHARE = "WebShare" + REQUESTED_STORAGE_ACCESS_GRANT = "RequestedStorageAccessGrant" + WEB_NFC = "WebNfc" + OUTSTANDING_NETWORK_REQUEST_FETCH = "OutstandingNetworkRequestFetch" + OUTSTANDING_NETWORK_REQUEST_XHR = "OutstandingNetworkRequestXHR" + APP_BANNER = "AppBanner" + PRINTING = "Printing" + WEB_DATABASE = "WebDatabase" + PICTURE_IN_PICTURE = "PictureInPicture" + PORTAL = "Portal" + SPEECH_RECOGNIZER = "SpeechRecognizer" + IDLE_MANAGER = "IdleManager" + PAYMENT_MANAGER = "PaymentManager" + SPEECH_SYNTHESIS = "SpeechSynthesis" + KEYBOARD_LOCK = "KeyboardLock" + WEB_OTP_SERVICE = "WebOTPService" + OUTSTANDING_NETWORK_REQUEST_DIRECT_SOCKET = "OutstandingNetworkRequestDirectSocket" + INJECTED_JAVASCRIPT = "InjectedJavascript" + INJECTED_STYLE_SHEET = "InjectedStyleSheet" + DUMMY = "Dummy" + CONTENT_SECURITY_HANDLER = "ContentSecurityHandler" + CONTENT_WEB_AUTHENTICATION_API = "ContentWebAuthenticationAPI" + CONTENT_FILE_CHOOSER = "ContentFileChooser" + CONTENT_SERIAL = "ContentSerial" + CONTENT_FILE_SYSTEM_ACCESS = "ContentFileSystemAccess" + CONTENT_MEDIA_DEVICES_DISPATCHER_HOST = "ContentMediaDevicesDispatcherHost" + CONTENT_WEB_BLUETOOTH = "ContentWebBluetooth" + CONTENT_WEB_USB = "ContentWebUSB" + CONTENT_MEDIA_SESSION = "ContentMediaSession" + CONTENT_MEDIA_SESSION_SERVICE = "ContentMediaSessionService" + CONTENT_SCREEN_READER = "ContentScreenReader" + EMBEDDER_POPUP_BLOCKER_TAB_HELPER = "EmbedderPopupBlockerTabHelper" + EMBEDDER_SAFE_BROWSING_TRIGGERED_POPUP_BLOCKER = "EmbedderSafeBrowsingTriggeredPopupBlocker" + EMBEDDER_SAFE_BROWSING_THREAT_DETAILS = "EmbedderSafeBrowsingThreatDetails" + EMBEDDER_APP_BANNER_MANAGER = "EmbedderAppBannerManager" + EMBEDDER_DOM_DISTILLER_VIEWER_SOURCE = "EmbedderDomDistillerViewerSource" + EMBEDDER_DOM_DISTILLER_SELF_DELETING_REQUEST_DELEGATE = "EmbedderDomDistillerSelfDeletingRequestDelegate" + EMBEDDER_OOM_INTERVENTION_TAB_HELPER = "EmbedderOomInterventionTabHelper" + EMBEDDER_OFFLINE_PAGE = "EmbedderOfflinePage" + EMBEDDER_CHROME_PASSWORD_MANAGER_CLIENT_BIND_CREDENTIAL_MANAGER = "EmbedderChromePasswordManagerClientBindCredentialManager" + EMBEDDER_PERMISSION_REQUEST_MANAGER = "EmbedderPermissionRequestManager" + EMBEDDER_MODAL_DIALOG = "EmbedderModalDialog" + EMBEDDER_EXTENSIONS = "EmbedderExtensions" + EMBEDDER_EXTENSION_MESSAGING = "EmbedderExtensionMessaging" + EMBEDDER_EXTENSION_MESSAGING_FOR_OPEN_PORT = "EmbedderExtensionMessagingForOpenPort" + EMBEDDER_EXTENSION_SENT_MESSAGE_TO_CACHED_FRAME = "EmbedderExtensionSentMessageToCachedFrame" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> BackForwardCacheNotRestoredReason: + return cls(json) + + +class BackForwardCacheNotRestoredReasonType(enum.Enum): + r''' + Types of not restored reasons for back-forward cache. ''' - #: Default standard font size. - standard: typing.Optional[int] = None + SUPPORT_PENDING = "SupportPending" + PAGE_SUPPORT_NEEDED = "PageSupportNeeded" + CIRCUMSTANTIAL = "Circumstantial" - #: Default fixed font size. - fixed: typing.Optional[int] = None + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> BackForwardCacheNotRestoredReasonType: + return cls(json) + + +@dataclass +class BackForwardCacheNotRestoredExplanation: + #: Type of the reason + type_: BackForwardCacheNotRestoredReasonType + + #: Not restored reason + reason: BackForwardCacheNotRestoredReason def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() - if self.standard is not None: - json['standard'] = self.standard - if self.fixed is not None: - json['fixed'] = self.fixed + json['type'] = self.type_.to_json() + json['reason'] = self.reason.to_json() return json @classmethod - def from_json(cls, json: T_JSON_DICT) -> FontSizes: + def from_json(cls, json: T_JSON_DICT) -> BackForwardCacheNotRestoredExplanation: return cls( - standard=int(json['standard']) if 'standard' in json else None, - fixed=int(json['fixed']) if 'fixed' in json else None, + type_=BackForwardCacheNotRestoredReasonType.from_json(json['type']), + reason=BackForwardCacheNotRestoredReason.from_json(json['reason']), ) -class ClientNavigationReason(enum.Enum): - FORM_SUBMISSION_GET = "formSubmissionGet" - FORM_SUBMISSION_POST = "formSubmissionPost" - HTTP_HEADER_REFRESH = "httpHeaderRefresh" - SCRIPT_INITIATED = "scriptInitiated" - META_TAG_REFRESH = "metaTagRefresh" - PAGE_BLOCK_INTERSTITIAL = "pageBlockInterstitial" - RELOAD = "reload" +@dataclass +class BackForwardCacheNotRestoredExplanationTree: + #: URL of each frame + url: str - def to_json(self) -> str: - return self.value + #: Not restored reasons of each frame + explanations: typing.List[BackForwardCacheNotRestoredExplanation] + + #: Array of children frame + children: typing.List[BackForwardCacheNotRestoredExplanationTree] + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['url'] = self.url + json['explanations'] = [i.to_json() for i in self.explanations] + json['children'] = [i.to_json() for i in self.children] + return json @classmethod - def from_json(cls, json: str) -> ClientNavigationReason: - return cls(json) + def from_json(cls, json: T_JSON_DICT) -> BackForwardCacheNotRestoredExplanationTree: + return cls( + url=str(json['url']), + explanations=[BackForwardCacheNotRestoredExplanation.from_json(i) for i in json['explanations']], + children=[BackForwardCacheNotRestoredExplanationTree.from_json(i) for i in json['children']], + ) @deprecated(version="1.3") def add_script_to_evaluate_on_load( script_source: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,ScriptIdentifier]: - ''' + r''' Deprecated, please use addScriptToEvaluateOnNewDocument instead. .. deprecated:: 1.3 @@ -652,19 +1406,23 @@ def add_script_to_evaluate_on_load( def add_script_to_evaluate_on_new_document( source: str, - world_name: typing.Optional[str] = None + world_name: typing.Optional[str] = None, + include_command_line_api: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,ScriptIdentifier]: - ''' + r''' Evaluates given script in every frame upon creation (before loading frame's scripts). :param source: :param world_name: **(EXPERIMENTAL)** *(Optional)* If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted. + :param include_command_line_api: **(EXPERIMENTAL)** *(Optional)* Specifies whether command line API should be available to the script, defaults to false. :returns: Identifier of the added script. ''' params: T_JSON_DICT = dict() params['source'] = source if world_name is not None: params['worldName'] = world_name + if include_command_line_api is not None: + params['includeCommandLineAPI'] = include_command_line_api cmd_dict: T_JSON_DICT = { 'method': 'Page.addScriptToEvaluateOnNewDocument', 'params': params, @@ -674,7 +1432,7 @@ def add_script_to_evaluate_on_new_document( def bring_to_front() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Brings page to front (activates tab). ''' cmd_dict: T_JSON_DICT = { @@ -687,16 +1445,18 @@ def capture_screenshot( format_: typing.Optional[str] = None, quality: typing.Optional[int] = None, clip: typing.Optional[Viewport] = None, - from_surface: typing.Optional[bool] = None + from_surface: typing.Optional[bool] = None, + capture_beyond_viewport: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Capture page screenshot. :param format_: *(Optional)* Image compression format (defaults to png). :param quality: *(Optional)* Compression quality from range [0..100] (jpeg only). :param clip: *(Optional)* Capture the screenshot of a given region only. :param from_surface: **(EXPERIMENTAL)** *(Optional)* Capture the screenshot from the surface, rather than the view. Defaults to true. - :returns: Base64-encoded image data. + :param capture_beyond_viewport: **(EXPERIMENTAL)** *(Optional)* Capture the screenshot beyond the viewport. Defaults to false. + :returns: Base64-encoded image data. (Encoded as a base64 string when passed over JSON) ''' params: T_JSON_DICT = dict() if format_ is not None: @@ -707,6 +1467,8 @@ def capture_screenshot( params['clip'] = clip.to_json() if from_surface is not None: params['fromSurface'] = from_surface + if capture_beyond_viewport is not None: + params['captureBeyondViewport'] = capture_beyond_viewport cmd_dict: T_JSON_DICT = { 'method': 'Page.captureScreenshot', 'params': params, @@ -718,7 +1480,7 @@ def capture_screenshot( def capture_snapshot( format_: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles. @@ -740,8 +1502,8 @@ def capture_snapshot( @deprecated(version="1.3") def clear_device_metrics_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Clears the overriden device metrics. + r''' + Clears the overridden device metrics. .. deprecated:: 1.3 @@ -755,7 +1517,7 @@ def clear_device_metrics_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT, @deprecated(version="1.3") def clear_device_orientation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears the overridden Device Orientation. .. deprecated:: 1.3 @@ -770,8 +1532,8 @@ def clear_device_orientation_override() -> typing.Generator[T_JSON_DICT,T_JSON_D @deprecated(version="1.3") def clear_geolocation_override() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Clears the overriden Geolocation Position and Error. + r''' + Clears the overridden Geolocation Position and Error. .. deprecated:: 1.3 ''' @@ -786,7 +1548,7 @@ def create_isolated_world( world_name: typing.Optional[str] = None, grant_univeral_access: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.ExecutionContextId]: - ''' + r''' Creates an isolated world for the given frame. :param frame_id: Id of the frame in which the isolated world should be created. @@ -813,7 +1575,7 @@ def delete_cookie( cookie_name: str, url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Deletes browser cookie with given name, domain and path. .. deprecated:: 1.3 @@ -834,7 +1596,7 @@ def delete_cookie( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables page domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -844,7 +1606,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables page domain notifications. ''' cmd_dict: T_JSON_DICT = { @@ -853,8 +1615,8 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict -def get_app_manifest() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, typing.List[AppManifestError], typing.Optional[str]]]: - ''' +def get_app_manifest() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, typing.List[AppManifestError], typing.Optional[str], typing.Optional[AppManifestParsedProperties]]]: + r''' :returns: A tuple with the following items: @@ -862,6 +1624,7 @@ def get_app_manifest() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[ 0. **url** - Manifest location. 1. **errors** - 2. **data** - *(Optional)* Manifest content. + 3. **parsed** - *(Optional)* Parsed manifest properties ''' cmd_dict: T_JSON_DICT = { 'method': 'Page.getAppManifest', @@ -870,12 +1633,13 @@ def get_app_manifest() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[ return ( str(json['url']), [AppManifestError.from_json(i) for i in json['errors']], - str(json['data']) if 'data' in json else None + str(json['data']) if 'data' in json else None, + AppManifestParsedProperties.from_json(json['parsed']) if 'parsed' in json else None ) -def get_installability_errors() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' +def get_installability_errors() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[InstallabilityError]]: + r''' **EXPERIMENTAL** @@ -886,12 +1650,49 @@ def get_installability_errors() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typi 'method': 'Page.getInstallabilityErrors', } json = yield cmd_dict - return [str(i) for i in json['errors']] + return [InstallabilityError.from_json(i) for i in json['installabilityErrors']] + + +def get_manifest_icons() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Optional[str]]: + r''' + + + **EXPERIMENTAL** + + :returns: + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Page.getManifestIcons', + } + json = yield cmd_dict + return str(json['primaryIcon']) if 'primaryIcon' in json else None + + +def get_app_id() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[str], typing.Optional[str]]]: + r''' + Returns the unique (PWA) app id. + Only returns values if the feature flag 'WebAppEnableManifestId' is enabled + + **EXPERIMENTAL** + + :returns: A tuple with the following items: + + 0. **appId** - *(Optional)* App id, either from manifest's id attribute or computed from start_url + 1. **recommendedId** - *(Optional)* Recommendation for manifest's id attribute to match current id computed from start_url + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Page.getAppId', + } + json = yield cmd_dict + return ( + str(json['appId']) if 'appId' in json else None, + str(json['recommendedId']) if 'recommendedId' in json else None + ) @deprecated(version="1.3") def get_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[network.Cookie]]: - ''' + r''' Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the ``cookies`` field. @@ -909,7 +1710,7 @@ def get_cookies() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[networ def get_frame_tree() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,FrameTree]: - ''' + r''' Returns present frame tree structure. :returns: Present frame tree structure. @@ -921,15 +1722,18 @@ def get_frame_tree() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,FrameTree]: return FrameTree.from_json(json['frameTree']) -def get_layout_metrics() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[LayoutViewport, VisualViewport, dom.Rect]]: - ''' +def get_layout_metrics() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[LayoutViewport, VisualViewport, dom.Rect, LayoutViewport, VisualViewport, dom.Rect]]: + r''' Returns metrics relating to the layouting of the page, such as viewport bounds/scale. :returns: A tuple with the following items: - 0. **layoutViewport** - Metrics relating to the layout viewport. - 1. **visualViewport** - Metrics relating to the visual viewport. - 2. **contentSize** - Size of scrollable area. + 0. **layoutViewport** - Deprecated metrics relating to the layout viewport. Can be in DP or in CSS pixels depending on the ``enable-use-zoom-for-dsf`` flag. Use ``cssLayoutViewport`` instead. + 1. **visualViewport** - Deprecated metrics relating to the visual viewport. Can be in DP or in CSS pixels depending on the ``enable-use-zoom-for-dsf`` flag. Use ``cssVisualViewport`` instead. + 2. **contentSize** - Deprecated size of scrollable area. Can be in DP or in CSS pixels depending on the ``enable-use-zoom-for-dsf`` flag. Use ``cssContentSize`` instead. + 3. **cssLayoutViewport** - Metrics relating to the layout viewport in CSS pixels. + 4. **cssVisualViewport** - Metrics relating to the visual viewport in CSS pixels. + 5. **cssContentSize** - Size of scrollable area in CSS pixels. ''' cmd_dict: T_JSON_DICT = { 'method': 'Page.getLayoutMetrics', @@ -938,12 +1742,15 @@ def get_layout_metrics() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tupl return ( LayoutViewport.from_json(json['layoutViewport']), VisualViewport.from_json(json['visualViewport']), - dom.Rect.from_json(json['contentSize']) + dom.Rect.from_json(json['contentSize']), + LayoutViewport.from_json(json['cssLayoutViewport']), + VisualViewport.from_json(json['cssVisualViewport']), + dom.Rect.from_json(json['cssContentSize']) ) def get_navigation_history() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[int, typing.List[NavigationEntry]]]: - ''' + r''' Returns navigation history for the current page. :returns: A tuple with the following items: @@ -962,7 +1769,7 @@ def get_navigation_history() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing. def reset_navigation_history() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Resets navigation history for the current page. ''' cmd_dict: T_JSON_DICT = { @@ -975,7 +1782,7 @@ def get_resource_content( frame_id: FrameId, url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, bool]]: - ''' + r''' Returns content of the given resource. **EXPERIMENTAL** @@ -1002,7 +1809,7 @@ def get_resource_content( def get_resource_tree() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,FrameResourceTree]: - ''' + r''' Returns present frame / resource tree structure. **EXPERIMENTAL** @@ -1020,7 +1827,7 @@ def handle_java_script_dialog( accept: bool, prompt_text: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload). :param accept: Whether to accept or dismiss the dialog. @@ -1041,15 +1848,17 @@ def navigate( url: str, referrer: typing.Optional[str] = None, transition_type: typing.Optional[TransitionType] = None, - frame_id: typing.Optional[FrameId] = None + frame_id: typing.Optional[FrameId] = None, + referrer_policy: typing.Optional[ReferrerPolicy] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[FrameId, typing.Optional[network.LoaderId], typing.Optional[str]]]: - ''' + r''' Navigates current page to the given URL. :param url: URL to navigate the page to. :param referrer: *(Optional)* Referrer URL. :param transition_type: *(Optional)* Intended transition type. :param frame_id: *(Optional)* Frame id to navigate, if not specified navigates the top frame. + :param referrer_policy: **(EXPERIMENTAL)** *(Optional)* Referrer-policy used for the navigation. :returns: A tuple with the following items: 0. **frameId** - Frame id that has navigated (or failed to navigate) @@ -1064,6 +1873,8 @@ def navigate( params['transitionType'] = transition_type.to_json() if frame_id is not None: params['frameId'] = frame_id.to_json() + if referrer_policy is not None: + params['referrerPolicy'] = referrer_policy.to_json() cmd_dict: T_JSON_DICT = { 'method': 'Page.navigate', 'params': params, @@ -1079,7 +1890,7 @@ def navigate( def navigate_to_history_entry( entry_id: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Navigates current page to the given history entry. :param entry_id: Unique id of the entry to navigate to. @@ -1111,7 +1922,7 @@ def print_to_pdf( prefer_css_page_size: typing.Optional[bool] = None, transfer_mode: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, typing.Optional[io.StreamHandle]]]: - ''' + r''' Print page as PDF. :param landscape: *(Optional)* Paper orientation. Defaults to false. @@ -1132,7 +1943,7 @@ def print_to_pdf( :param transfer_mode: **(EXPERIMENTAL)** *(Optional)* return as stream :returns: A tuple with the following items: - 0. **data** - Base64-encoded pdf data. Empty if `` returnAsStream` is specified. + 0. **data** - Base64-encoded pdf data. Empty if `` returnAsStream` is specified. (Encoded as a base64 string when passed over JSON) 1. **stream** - *(Optional)* A handle of the stream that holds resulting PDF data. ''' params: T_JSON_DICT = dict() @@ -1183,7 +1994,7 @@ def reload( ignore_cache: typing.Optional[bool] = None, script_to_evaluate_on_load: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Reloads given page optionally ignoring the cache. :param ignore_cache: *(Optional)* If true, browser cache is ignored (as if the user pressed Shift+refresh). @@ -1205,7 +2016,7 @@ def reload( def remove_script_to_evaluate_on_load( identifier: ScriptIdentifier ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Deprecated, please use removeScriptToEvaluateOnNewDocument instead. .. deprecated:: 1.3 @@ -1226,7 +2037,7 @@ def remove_script_to_evaluate_on_load( def remove_script_to_evaluate_on_new_document( identifier: ScriptIdentifier ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes given script from the list. :param identifier: @@ -1243,7 +2054,7 @@ def remove_script_to_evaluate_on_new_document( def screencast_frame_ack( session_id: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Acknowledges that a screencast frame has been received by the frontend. **EXPERIMENTAL** @@ -1266,7 +2077,7 @@ def search_in_resource( case_sensitive: typing.Optional[bool] = None, is_regex: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[debugger.SearchMatch]]: - ''' + r''' Searches for given string in resource content. **EXPERIMENTAL** @@ -1297,7 +2108,7 @@ def search_in_resource( def set_ad_blocking_enabled( enabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enable Chrome's experimental ad filter on all sites. **EXPERIMENTAL** @@ -1316,7 +2127,7 @@ def set_ad_blocking_enabled( def set_bypass_csp( enabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enable page Content Security Policy by-passing. **EXPERIMENTAL** @@ -1332,6 +2143,48 @@ def set_bypass_csp( json = yield cmd_dict +def get_permissions_policy_state( + frame_id: FrameId + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[PermissionsPolicyFeatureState]]: + r''' + Get Permissions Policy state on given frame. + + **EXPERIMENTAL** + + :param frame_id: + :returns: + ''' + params: T_JSON_DICT = dict() + params['frameId'] = frame_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Page.getPermissionsPolicyState', + 'params': params, + } + json = yield cmd_dict + return [PermissionsPolicyFeatureState.from_json(i) for i in json['states']] + + +def get_origin_trials( + frame_id: FrameId + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[OriginTrial]]: + r''' + Get Origin Trials on given frame. + + **EXPERIMENTAL** + + :param frame_id: + :returns: + ''' + params: T_JSON_DICT = dict() + params['frameId'] = frame_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Page.getOriginTrials', + 'params': params, + } + json = yield cmd_dict + return [OriginTrial.from_json(i) for i in json['originTrials']] + + @deprecated(version="1.3") def set_device_metrics_override( width: int, @@ -1347,7 +2200,7 @@ def set_device_metrics_override( screen_orientation: typing.Optional[emulation.ScreenOrientation] = None, viewport: typing.Optional[Viewport] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results). @@ -1403,7 +2256,7 @@ def set_device_orientation_override( beta: float, gamma: float ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides the Device Orientation. .. deprecated:: 1.3 @@ -1428,7 +2281,7 @@ def set_device_orientation_override( def set_font_families( font_families: FontFamilies ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Set generic font families. **EXPERIMENTAL** @@ -1447,7 +2300,7 @@ def set_font_families( def set_font_sizes( font_sizes: FontSizes ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Set default font sizes. **EXPERIMENTAL** @@ -1467,7 +2320,7 @@ def set_document_content( frame_id: FrameId, html: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets given markup as the document's HTML. :param frame_id: Frame id to set HTML for. @@ -1483,17 +2336,20 @@ def set_document_content( json = yield cmd_dict +@deprecated(version="1.3") def set_download_behavior( behavior: str, download_path: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Set the behavior when downloading a file. + .. deprecated:: 1.3 + **EXPERIMENTAL** :param behavior: Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). - :param download_path: *(Optional)* The default path to save downloaded files to. This is requred if behavior is set to 'allow' + :param download_path: *(Optional)* The default path to save downloaded files to. This is required if behavior is set to 'allow' ''' params: T_JSON_DICT = dict() params['behavior'] = behavior @@ -1512,7 +2368,7 @@ def set_geolocation_override( longitude: typing.Optional[float] = None, accuracy: typing.Optional[float] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable. @@ -1539,7 +2395,7 @@ def set_geolocation_override( def set_lifecycle_events_enabled( enabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Controls whether page will emit lifecycle events. **EXPERIMENTAL** @@ -1560,7 +2416,7 @@ def set_touch_emulation_enabled( enabled: bool, configuration: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Toggles mouse event-based touch event emulation. .. deprecated:: 1.3 @@ -1588,7 +2444,7 @@ def start_screencast( max_height: typing.Optional[int] = None, every_nth_frame: typing.Optional[int] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Starts sending each frame using the ``screencastFrame`` event. **EXPERIMENTAL** @@ -1618,7 +2474,7 @@ def start_screencast( def stop_loading() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Force the page stop all navigations and pending resource fetches. ''' cmd_dict: T_JSON_DICT = { @@ -1628,7 +2484,7 @@ def stop_loading() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def crash() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Crashes renderer on the IO thread, generates minidumps. **EXPERIMENTAL** @@ -1640,7 +2496,7 @@ def crash() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def close() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Tries to close page, running its beforeunload hooks, if any. **EXPERIMENTAL** @@ -1654,7 +2510,7 @@ def close() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def set_web_lifecycle_state( state: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Tries to update the web lifecycle state of the page. It will transition the page to the given state according to: https://github.com/WICG/web-lifecycle/ @@ -1673,7 +2529,7 @@ def set_web_lifecycle_state( def stop_screencast() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Stops sending each frame in the ``screencastFrame``. **EXPERIMENTAL** @@ -1684,20 +2540,25 @@ def stop_screencast() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict -def set_produce_compilation_cache( - enabled: bool +def produce_compilation_cache( + scripts: typing.List[CompilationCacheParams] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Forces compilation cache to be generated for every subresource script. + r''' + Requests backend to produce compilation cache for the specified scripts. + ``scripts`` are appeneded to the list of scripts for which the cache + would be produced. The list may be reset during page navigation. + When script with a matching URL is encountered, the cache is optionally + produced upon backend discretion, based on internal heuristics. + See also: ``Page.compilationCacheProduced``. **EXPERIMENTAL** - :param enabled: + :param scripts: ''' params: T_JSON_DICT = dict() - params['enabled'] = enabled + params['scripts'] = [i.to_json() for i in scripts] cmd_dict: T_JSON_DICT = { - 'method': 'Page.setProduceCompilationCache', + 'method': 'Page.produceCompilationCache', 'params': params, } json = yield cmd_dict @@ -1707,14 +2568,14 @@ def add_compilation_cache( url: str, data: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation. **EXPERIMENTAL** :param url: - :param data: Base64-encoded data + :param data: Base64-encoded data (Encoded as a base64 string when passed over JSON) ''' params: T_JSON_DICT = dict() params['url'] = url @@ -1727,7 +2588,7 @@ def add_compilation_cache( def clear_compilation_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears seeded compilation cache. **EXPERIMENTAL** @@ -1738,11 +2599,31 @@ def clear_compilation_cache() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict +def set_spc_transaction_mode( + mode: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Sets the Secure Payment Confirmation transaction mode. + https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode + + **EXPERIMENTAL** + + :param mode: + ''' + params: T_JSON_DICT = dict() + params['mode'] = mode + cmd_dict: T_JSON_DICT = { + 'method': 'Page.setSPCTransactionMode', + 'params': params, + } + json = yield cmd_dict + + def generate_test_report( message: str, group: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Generates a report for testing. **EXPERIMENTAL** @@ -1762,7 +2643,7 @@ def generate_test_report( def wait_for_debugger() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger. **EXPERIMENTAL** @@ -1776,11 +2657,10 @@ def wait_for_debugger() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def set_intercept_file_chooser_dialog( enabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Intercept file chooser requests and transfer control to protocol clients. When file chooser interception is enabled, native file chooser dialog is not shown. Instead, a protocol event ``Page.fileChooserOpened`` is emitted. - File chooser can be handled with ``page.handleFileChooser`` command. **EXPERIMENTAL** @@ -1795,29 +2675,6 @@ def set_intercept_file_chooser_dialog( json = yield cmd_dict -def handle_file_chooser( - action: str, - files: typing.Optional[typing.List[str]] = None - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' - Accepts or cancels an intercepted file chooser dialog. - - **EXPERIMENTAL** - - :param action: - :param files: *(Optional)* Array of absolute file paths to set, only respected with ```accept``` action. - ''' - params: T_JSON_DICT = dict() - params['action'] = action - if files is not None: - params['files'] = [i for i in files] - cmd_dict: T_JSON_DICT = { - 'method': 'Page.handleFileChooser', - 'params': params, - } - json = yield cmd_dict - - @event_class('Page.domContentEventFired') @dataclass class DomContentEventFired: @@ -1833,14 +2690,21 @@ def from_json(cls, json: T_JSON_DICT) -> DomContentEventFired: @event_class('Page.fileChooserOpened') @dataclass class FileChooserOpened: - ''' + r''' Emitted only when ``page.interceptFileChooser`` is enabled. ''' + #: Id of the frame containing input node. + frame_id: FrameId + #: Input node id. + backend_node_id: dom.BackendNodeId + #: Input mode. mode: str @classmethod def from_json(cls, json: T_JSON_DICT) -> FileChooserOpened: return cls( + frame_id=FrameId.from_json(json['frameId']), + backend_node_id=dom.BackendNodeId.from_json(json['backendNodeId']), mode=str(json['mode']) ) @@ -1848,7 +2712,7 @@ def from_json(cls, json: T_JSON_DICT) -> FileChooserOpened: @event_class('Page.frameAttached') @dataclass class FrameAttached: - ''' + r''' Fired when frame has been attached to its parent. ''' #: Id of the frame that has been attached. @@ -1871,7 +2735,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameAttached: @event_class('Page.frameClearedScheduledNavigation') @dataclass class FrameClearedScheduledNavigation: - ''' + r''' Fired when frame no longer has a scheduled navigation. ''' #: Id of the frame that has cleared its scheduled navigation. @@ -1887,30 +2751,52 @@ def from_json(cls, json: T_JSON_DICT) -> FrameClearedScheduledNavigation: @event_class('Page.frameDetached') @dataclass class FrameDetached: - ''' + r''' Fired when frame has been detached from its parent. ''' #: Id of the frame that has been detached. frame_id: FrameId + reason: str @classmethod def from_json(cls, json: T_JSON_DICT) -> FrameDetached: return cls( - frame_id=FrameId.from_json(json['frameId']) + frame_id=FrameId.from_json(json['frameId']), + reason=str(json['reason']) ) @event_class('Page.frameNavigated') @dataclass class FrameNavigated: - ''' + r''' Fired once navigation of the frame has completed. Frame is now associated with the new loader. ''' #: Frame object. frame: Frame + type_: NavigationType @classmethod def from_json(cls, json: T_JSON_DICT) -> FrameNavigated: + return cls( + frame=Frame.from_json(json['frame']), + type_=NavigationType.from_json(json['type']) + ) + + +@event_class('Page.documentOpened') +@dataclass +class DocumentOpened: + r''' + **EXPERIMENTAL** + + Fired when opening document to write to. + ''' + #: Frame object. + frame: Frame + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DocumentOpened: return cls( frame=Frame.from_json(json['frame']) ) @@ -1919,7 +2805,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameNavigated: @event_class('Page.frameResized') @dataclass class FrameResized: - ''' + r''' **EXPERIMENTAL** @@ -1936,7 +2822,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameResized: @event_class('Page.frameRequestedNavigation') @dataclass class FrameRequestedNavigation: - ''' + r''' **EXPERIMENTAL** Fired when a renderer-initiated navigation is requested. @@ -1948,13 +2834,16 @@ class FrameRequestedNavigation: reason: ClientNavigationReason #: The destination URL for the requested navigation. url: str + #: The disposition for the navigation. + disposition: ClientNavigationDisposition @classmethod def from_json(cls, json: T_JSON_DICT) -> FrameRequestedNavigation: return cls( frame_id=FrameId.from_json(json['frameId']), reason=ClientNavigationReason.from_json(json['reason']), - url=str(json['url']) + url=str(json['url']), + disposition=ClientNavigationDisposition.from_json(json['disposition']) ) @@ -1962,7 +2851,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameRequestedNavigation: @event_class('Page.frameScheduledNavigation') @dataclass class FrameScheduledNavigation: - ''' + r''' Fired when frame schedules a potential navigation. ''' #: Id of the frame that has scheduled a navigation. @@ -1971,7 +2860,7 @@ class FrameScheduledNavigation: #: guaranteed to start. delay: float #: The reason for the navigation. - reason: str + reason: ClientNavigationReason #: The destination URL for the scheduled navigation. url: str @@ -1980,7 +2869,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameScheduledNavigation: return cls( frame_id=FrameId.from_json(json['frameId']), delay=float(json['delay']), - reason=str(json['reason']), + reason=ClientNavigationReason.from_json(json['reason']), url=str(json['url']) ) @@ -1988,7 +2877,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameScheduledNavigation: @event_class('Page.frameStartedLoading') @dataclass class FrameStartedLoading: - ''' + r''' **EXPERIMENTAL** Fired when frame has started loading. @@ -2006,7 +2895,7 @@ def from_json(cls, json: T_JSON_DICT) -> FrameStartedLoading: @event_class('Page.frameStoppedLoading') @dataclass class FrameStoppedLoading: - ''' + r''' **EXPERIMENTAL** Fired when frame has stopped loading. @@ -2021,31 +2910,68 @@ def from_json(cls, json: T_JSON_DICT) -> FrameStoppedLoading: ) +@deprecated(version="1.3") @event_class('Page.downloadWillBegin') @dataclass class DownloadWillBegin: - ''' + r''' **EXPERIMENTAL** Fired when page is about to start a download. + Deprecated. Use Browser.downloadWillBegin instead. ''' #: Id of the frame that caused download to begin. frame_id: FrameId + #: Global unique identifier of the download. + guid: str #: URL of the resource being downloaded. url: str + #: Suggested file name of the resource (the actual name of the file saved on disk may differ). + suggested_filename: str @classmethod def from_json(cls, json: T_JSON_DICT) -> DownloadWillBegin: return cls( frame_id=FrameId.from_json(json['frameId']), - url=str(json['url']) + guid=str(json['guid']), + url=str(json['url']), + suggested_filename=str(json['suggestedFilename']) + ) + + +@deprecated(version="1.3") +@event_class('Page.downloadProgress') +@dataclass +class DownloadProgress: + r''' + **EXPERIMENTAL** + + Fired when download makes progress. Last call has ``done`` == true. + Deprecated. Use Browser.downloadProgress instead. + ''' + #: Global unique identifier of the download. + guid: str + #: Total expected bytes to download. + total_bytes: float + #: Total bytes received. + received_bytes: float + #: Download status. + state: str + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> DownloadProgress: + return cls( + guid=str(json['guid']), + total_bytes=float(json['totalBytes']), + received_bytes=float(json['receivedBytes']), + state=str(json['state']) ) @event_class('Page.interstitialHidden') @dataclass class InterstitialHidden: - ''' + r''' Fired when interstitial page was hidden ''' @@ -2060,7 +2986,7 @@ def from_json(cls, json: T_JSON_DICT) -> InterstitialHidden: @event_class('Page.interstitialShown') @dataclass class InterstitialShown: - ''' + r''' Fired when interstitial page was shown ''' @@ -2075,7 +3001,7 @@ def from_json(cls, json: T_JSON_DICT) -> InterstitialShown: @event_class('Page.javascriptDialogClosed') @dataclass class JavascriptDialogClosed: - ''' + r''' Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed. ''' @@ -2095,7 +3021,7 @@ def from_json(cls, json: T_JSON_DICT) -> JavascriptDialogClosed: @event_class('Page.javascriptDialogOpening') @dataclass class JavascriptDialogOpening: - ''' + r''' Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open. ''' @@ -2126,7 +3052,7 @@ def from_json(cls, json: T_JSON_DICT) -> JavascriptDialogOpening: @event_class('Page.lifecycleEvent') @dataclass class LifecycleEvent: - ''' + r''' Fired for top level page lifecycle events such as navigation, load, paint, etc. ''' #: Id of the frame. @@ -2146,6 +3072,36 @@ def from_json(cls, json: T_JSON_DICT) -> LifecycleEvent: ) +@event_class('Page.backForwardCacheNotUsed') +@dataclass +class BackForwardCacheNotUsed: + r''' + **EXPERIMENTAL** + + Fired for failed bfcache history navigations if BackForwardCache feature is enabled. Do + not assume any ordering with the Page.frameNavigated event. This event is fired only for + main-frame history navigation where the document changes (non-same-document navigations), + when bfcache navigation fails. + ''' + #: The loader id for the associated navgation. + loader_id: network.LoaderId + #: The frame id of the associated frame. + frame_id: FrameId + #: Array of reasons why the page could not be cached. This must not be empty. + not_restored_explanations: typing.List[BackForwardCacheNotRestoredExplanation] + #: Tree structure of reasons why the page could not be cached for each frame. + not_restored_explanations_tree: typing.Optional[BackForwardCacheNotRestoredExplanationTree] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> BackForwardCacheNotUsed: + return cls( + loader_id=network.LoaderId.from_json(json['loaderId']), + frame_id=FrameId.from_json(json['frameId']), + not_restored_explanations=[BackForwardCacheNotRestoredExplanation.from_json(i) for i in json['notRestoredExplanations']], + not_restored_explanations_tree=BackForwardCacheNotRestoredExplanationTree.from_json(json['notRestoredExplanationsTree']) if 'notRestoredExplanationsTree' in json else None + ) + + @event_class('Page.loadEventFired') @dataclass class LoadEventFired: @@ -2161,7 +3117,7 @@ def from_json(cls, json: T_JSON_DICT) -> LoadEventFired: @event_class('Page.navigatedWithinDocument') @dataclass class NavigatedWithinDocument: - ''' + r''' **EXPERIMENTAL** Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation. @@ -2182,12 +3138,12 @@ def from_json(cls, json: T_JSON_DICT) -> NavigatedWithinDocument: @event_class('Page.screencastFrame') @dataclass class ScreencastFrame: - ''' + r''' **EXPERIMENTAL** Compressed image data requested by the ``startScreencast``. ''' - #: Base64-encoded compressed image. + #: Base64-encoded compressed image. (Encoded as a base64 string when passed over JSON) data: str #: Screencast frame metadata. metadata: ScreencastFrameMetadata @@ -2206,7 +3162,7 @@ def from_json(cls, json: T_JSON_DICT) -> ScreencastFrame: @event_class('Page.screencastVisibilityChanged') @dataclass class ScreencastVisibilityChanged: - ''' + r''' **EXPERIMENTAL** Fired when the page with currently enabled screencast was shown or hidden . @@ -2224,7 +3180,7 @@ def from_json(cls, json: T_JSON_DICT) -> ScreencastVisibilityChanged: @event_class('Page.windowOpen') @dataclass class WindowOpen: - ''' + r''' Fired when a new window is going to be opened, via window.open(), link click, form submission, etc. ''' @@ -2250,14 +3206,14 @@ def from_json(cls, json: T_JSON_DICT) -> WindowOpen: @event_class('Page.compilationCacheProduced') @dataclass class CompilationCacheProduced: - ''' + r''' **EXPERIMENTAL** Issued for every compilation cache generated. Is only available if Page.setGenerateCompilationCache is enabled. ''' url: str - #: Base64-encoded data + #: Base64-encoded data (Encoded as a base64 string when passed over JSON) data: str @classmethod diff --git a/cdp/performance.py b/cdp/performance.py index d229797..c17341c 100644 --- a/cdp/performance.py +++ b/cdp/performance.py @@ -12,9 +12,12 @@ import typing +from deprecated.sphinx import deprecated # type: ignore + + @dataclass class Metric: - ''' + r''' Run-time execution metric. ''' #: Metric name. @@ -38,7 +41,7 @@ def from_json(cls, json: T_JSON_DICT) -> Metric: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disable collecting and reporting metrics. ''' cmd_dict: T_JSON_DICT = { @@ -47,24 +50,35 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict -def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' +def enable( + time_domain: typing.Optional[str] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Enable collecting and reporting metrics. + + :param time_domain: *(Optional)* Time domain to use for collecting and reporting duration metrics. ''' + params: T_JSON_DICT = dict() + if time_domain is not None: + params['timeDomain'] = time_domain cmd_dict: T_JSON_DICT = { 'method': 'Performance.enable', + 'params': params, } json = yield cmd_dict +@deprecated(version="1.3") def set_time_domain( time_domain: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets time domain to use for collecting and reporting duration metrics. Note that this must be called before enabling metrics collection. Calling this method while metrics collection is enabled returns an error. + .. deprecated:: 1.3 + **EXPERIMENTAL** :param time_domain: Time domain @@ -79,7 +93,7 @@ def set_time_domain( def get_metrics() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Metric]]: - ''' + r''' Retrieve current values of run-time metrics. :returns: Current values for run-time metrics. @@ -94,7 +108,7 @@ def get_metrics() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Metric @event_class('Performance.metrics') @dataclass class Metrics: - ''' + r''' Current values of the metrics. ''' #: Current values of the metrics. diff --git a/cdp/performance_timeline.py b/cdp/performance_timeline.py new file mode 100644 index 0000000..0006460 --- /dev/null +++ b/cdp/performance_timeline.py @@ -0,0 +1,200 @@ +# DO NOT EDIT THIS FILE! +# +# This file is generated from the CDP specification. If you need to make +# changes, edit the generator and regenerate all of the modules. +# +# CDP domain: PerformanceTimeline (experimental) + +from __future__ import annotations +from cdp.util import event_class, T_JSON_DICT +from dataclasses import dataclass +import enum +import typing + +from . import dom +from . import network +from . import page + + +@dataclass +class LargestContentfulPaint: + r''' + See https://github.com/WICG/LargestContentfulPaint and largest_contentful_paint.idl + ''' + render_time: network.TimeSinceEpoch + + load_time: network.TimeSinceEpoch + + #: The number of pixels being painted. + size: float + + #: The id attribute of the element, if available. + element_id: typing.Optional[str] = None + + #: The URL of the image (may be trimmed). + url: typing.Optional[str] = None + + node_id: typing.Optional[dom.BackendNodeId] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['renderTime'] = self.render_time.to_json() + json['loadTime'] = self.load_time.to_json() + json['size'] = self.size + if self.element_id is not None: + json['elementId'] = self.element_id + if self.url is not None: + json['url'] = self.url + if self.node_id is not None: + json['nodeId'] = self.node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LargestContentfulPaint: + return cls( + render_time=network.TimeSinceEpoch.from_json(json['renderTime']), + load_time=network.TimeSinceEpoch.from_json(json['loadTime']), + size=float(json['size']), + element_id=str(json['elementId']) if 'elementId' in json else None, + url=str(json['url']) if 'url' in json else None, + node_id=dom.BackendNodeId.from_json(json['nodeId']) if 'nodeId' in json else None, + ) + + +@dataclass +class LayoutShiftAttribution: + previous_rect: dom.Rect + + current_rect: dom.Rect + + node_id: typing.Optional[dom.BackendNodeId] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['previousRect'] = self.previous_rect.to_json() + json['currentRect'] = self.current_rect.to_json() + if self.node_id is not None: + json['nodeId'] = self.node_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LayoutShiftAttribution: + return cls( + previous_rect=dom.Rect.from_json(json['previousRect']), + current_rect=dom.Rect.from_json(json['currentRect']), + node_id=dom.BackendNodeId.from_json(json['nodeId']) if 'nodeId' in json else None, + ) + + +@dataclass +class LayoutShift: + r''' + See https://wicg.github.io/layout-instability/#sec-layout-shift and layout_shift.idl + ''' + #: Score increment produced by this event. + value: float + + had_recent_input: bool + + last_input_time: network.TimeSinceEpoch + + sources: typing.List[LayoutShiftAttribution] + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['value'] = self.value + json['hadRecentInput'] = self.had_recent_input + json['lastInputTime'] = self.last_input_time.to_json() + json['sources'] = [i.to_json() for i in self.sources] + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> LayoutShift: + return cls( + value=float(json['value']), + had_recent_input=bool(json['hadRecentInput']), + last_input_time=network.TimeSinceEpoch.from_json(json['lastInputTime']), + sources=[LayoutShiftAttribution.from_json(i) for i in json['sources']], + ) + + +@dataclass +class TimelineEvent: + #: Identifies the frame that this event is related to. Empty for non-frame targets. + frame_id: page.FrameId + + #: The event type, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype + #: This determines which of the optional "details" fiedls is present. + type_: str + + #: Name may be empty depending on the type. + name: str + + #: Time in seconds since Epoch, monotonically increasing within document lifetime. + time: network.TimeSinceEpoch + + #: Event duration, if applicable. + duration: typing.Optional[float] = None + + lcp_details: typing.Optional[LargestContentfulPaint] = None + + layout_shift_details: typing.Optional[LayoutShift] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['frameId'] = self.frame_id.to_json() + json['type'] = self.type_ + json['name'] = self.name + json['time'] = self.time.to_json() + if self.duration is not None: + json['duration'] = self.duration + if self.lcp_details is not None: + json['lcpDetails'] = self.lcp_details.to_json() + if self.layout_shift_details is not None: + json['layoutShiftDetails'] = self.layout_shift_details.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> TimelineEvent: + return cls( + frame_id=page.FrameId.from_json(json['frameId']), + type_=str(json['type']), + name=str(json['name']), + time=network.TimeSinceEpoch.from_json(json['time']), + duration=float(json['duration']) if 'duration' in json else None, + lcp_details=LargestContentfulPaint.from_json(json['lcpDetails']) if 'lcpDetails' in json else None, + layout_shift_details=LayoutShift.from_json(json['layoutShiftDetails']) if 'layoutShiftDetails' in json else None, + ) + + +def enable( + event_types: typing.List[str] + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Previously buffered events would be reported before method returns. + See also: timelineEventAdded + + :param event_types: The types of event to report, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype The specified filter overrides any previous filters, passing empty filter disables recording. Note that not all types exposed to the web platform are currently supported. + ''' + params: T_JSON_DICT = dict() + params['eventTypes'] = [i for i in event_types] + cmd_dict: T_JSON_DICT = { + 'method': 'PerformanceTimeline.enable', + 'params': params, + } + json = yield cmd_dict + + +@event_class('PerformanceTimeline.timelineEventAdded') +@dataclass +class TimelineEventAdded: + r''' + Sent when a performance timeline event is added. See reportPerformanceTimeline method. + ''' + event: TimelineEvent + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> TimelineEventAdded: + return cls( + event=TimelineEvent.from_json(json['event']) + ) diff --git a/cdp/profiler.py b/cdp/profiler.py index 3dd748a..162db8c 100644 --- a/cdp/profiler.py +++ b/cdp/profiler.py @@ -17,7 +17,7 @@ @dataclass class ProfileNode: - ''' + r''' Profile node. Holds callsite information, execution statistics and child nodes. ''' #: Unique id of the node. @@ -67,7 +67,7 @@ def from_json(cls, json: T_JSON_DICT) -> ProfileNode: @dataclass class Profile: - ''' + r''' Profile. ''' #: The list of profile nodes. First item is the root node. @@ -110,7 +110,7 @@ def from_json(cls, json: T_JSON_DICT) -> Profile: @dataclass class PositionTickInfo: - ''' + r''' Specifies a number of samples attributed to a certain source position. ''' #: Source line number (1-based). @@ -135,7 +135,7 @@ def from_json(cls, json: T_JSON_DICT) -> PositionTickInfo: @dataclass class CoverageRange: - ''' + r''' Coverage data for a source range. ''' #: JavaScript script source offset for the range start. @@ -165,7 +165,7 @@ def from_json(cls, json: T_JSON_DICT) -> CoverageRange: @dataclass class FunctionCoverage: - ''' + r''' Coverage data for a JavaScript function. ''' #: JavaScript function name. @@ -195,7 +195,7 @@ def from_json(cls, json: T_JSON_DICT) -> FunctionCoverage: @dataclass class ScriptCoverage: - ''' + r''' Coverage data for a JavaScript script. ''' #: JavaScript script id. @@ -225,7 +225,7 @@ def from_json(cls, json: T_JSON_DICT) -> ScriptCoverage: @dataclass class TypeObject: - ''' + r''' Describes a type collected during runtime. ''' #: Name of a type collected with type profiling. @@ -245,7 +245,7 @@ def from_json(cls, json: T_JSON_DICT) -> TypeObject: @dataclass class TypeProfileEntry: - ''' + r''' Source offset and types for a parameter or return value. ''' #: Source offset of the parameter or end of function for return values. @@ -270,7 +270,7 @@ def from_json(cls, json: T_JSON_DICT) -> TypeProfileEntry: @dataclass class ScriptTypeProfile: - ''' + r''' Type profile data collected during runtime for a JavaScript script. ''' #: JavaScript script id. @@ -315,7 +315,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_best_effort_coverage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[ScriptCoverage]]: - ''' + r''' Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. @@ -331,7 +331,7 @@ def get_best_effort_coverage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typin def set_sampling_interval( interval: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. :param interval: New sampling interval in microseconds. @@ -355,30 +355,36 @@ def start() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def start_precise_coverage( call_count: typing.Optional[bool] = None, - detailed: typing.Optional[bool] = None - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + detailed: typing.Optional[bool] = None, + allow_triggered_updates: typing.Optional[bool] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]: + r''' Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. :param call_count: *(Optional)* Collect accurate call counts beyond simple 'covered' or 'not covered'. :param detailed: *(Optional)* Collect block-based coverage. + :param allow_triggered_updates: *(Optional)* Allow the backend to send updates on its own initiative + :returns: Monotonically increasing time (in seconds) when the coverage update was taken in the backend. ''' params: T_JSON_DICT = dict() if call_count is not None: params['callCount'] = call_count if detailed is not None: params['detailed'] = detailed + if allow_triggered_updates is not None: + params['allowTriggeredUpdates'] = allow_triggered_updates cmd_dict: T_JSON_DICT = { 'method': 'Profiler.startPreciseCoverage', 'params': params, } json = yield cmd_dict + return float(json['timestamp']) def start_type_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enable type profile. **EXPERIMENTAL** @@ -390,7 +396,7 @@ def start_type_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def stop() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Profile]: - ''' + r''' :returns: Recorded profile. @@ -403,7 +409,7 @@ def stop() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Profile]: def stop_precise_coverage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. ''' @@ -414,7 +420,7 @@ def stop_precise_coverage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def stop_type_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disable type profile. Disabling releases type profile data collected so far. **EXPERIMENTAL** @@ -425,22 +431,28 @@ def stop_type_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: json = yield cmd_dict -def take_precise_coverage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[ScriptCoverage]]: - ''' +def take_precise_coverage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[ScriptCoverage], float]]: + r''' Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - :returns: Coverage data for the current isolate. + :returns: A tuple with the following items: + + 0. **result** - Coverage data for the current isolate. + 1. **timestamp** - Monotonically increasing time (in seconds) when the coverage update was taken in the backend. ''' cmd_dict: T_JSON_DICT = { 'method': 'Profiler.takePreciseCoverage', } json = yield cmd_dict - return [ScriptCoverage.from_json(i) for i in json['result']] + return ( + [ScriptCoverage.from_json(i) for i in json['result']], + float(json['timestamp']) + ) def take_type_profile() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[ScriptTypeProfile]]: - ''' + r''' Collect type profile. **EXPERIMENTAL** @@ -477,7 +489,7 @@ def from_json(cls, json: T_JSON_DICT) -> ConsoleProfileFinished: @event_class('Profiler.consoleProfileStarted') @dataclass class ConsoleProfileStarted: - ''' + r''' Sent when new profile recording is started using console.profile() call. ''' id_: str @@ -493,3 +505,30 @@ def from_json(cls, json: T_JSON_DICT) -> ConsoleProfileStarted: location=debugger.Location.from_json(json['location']), title=str(json['title']) if 'title' in json else None ) + + +@event_class('Profiler.preciseCoverageDeltaUpdate') +@dataclass +class PreciseCoverageDeltaUpdate: + r''' + **EXPERIMENTAL** + + Reports coverage delta since the last poll (either from an event like this, or from + ``takePreciseCoverage`` for the current isolate. May only be sent if precise code + coverage has been started. This event can be trigged by the embedder to, for example, + trigger collection of coverage data immediately at a certain point in time. + ''' + #: Monotonically increasing time (in seconds) when the coverage update was taken in the backend. + timestamp: float + #: Identifier for distinguishing coverage events. + occasion: str + #: Coverage data for the current isolate. + result: typing.List[ScriptCoverage] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> PreciseCoverageDeltaUpdate: + return cls( + timestamp=float(json['timestamp']), + occasion=str(json['occasion']), + result=[ScriptCoverage.from_json(i) for i in json['result']] + ) diff --git a/cdp/runtime.py b/cdp/runtime.py index 0a22db6..a6cbbcc 100644 --- a/cdp/runtime.py +++ b/cdp/runtime.py @@ -13,7 +13,7 @@ class ScriptId(str): - ''' + r''' Unique script identifier. ''' def to_json(self) -> str: @@ -28,7 +28,7 @@ def __repr__(self): class RemoteObjectId(str): - ''' + r''' Unique object identifier. ''' def to_json(self) -> str: @@ -43,7 +43,7 @@ def __repr__(self): class UnserializableValue(str): - ''' + r''' Primitive value which cannot be JSON-stringified. Includes values ``-0``, ``NaN``, ``Infinity``, ``-Infinity``, and bigint literals. ''' @@ -60,13 +60,15 @@ def __repr__(self): @dataclass class RemoteObject: - ''' + r''' Mirror object referencing original JavaScript object. ''' #: Object type. type_: str #: Object subtype hint. Specified for ``object`` type values only. + #: NOTE: If you change anything here, make sure to also update + #: ``subtype`` in ``ObjectPreview`` and ``PropertyPreview`` below. subtype: typing.Optional[str] = None #: Object class (constructor) name. Specified for ``object`` type values only. @@ -154,7 +156,7 @@ def from_json(cls, json: T_JSON_DICT) -> CustomPreview: @dataclass class ObjectPreview: - ''' + r''' Object containing abbreviated remote object value. ''' #: Object type. @@ -265,7 +267,7 @@ def from_json(cls, json: T_JSON_DICT) -> EntryPreview: @dataclass class PropertyDescriptor: - ''' + r''' Object property descriptor. ''' #: Property name or symbol description. @@ -341,7 +343,7 @@ def from_json(cls, json: T_JSON_DICT) -> PropertyDescriptor: @dataclass class InternalPropertyDescriptor: - ''' + r''' Object internal property descriptor. This property isn't normally visible in JavaScript code. ''' #: Conventional property name. @@ -367,32 +369,47 @@ def from_json(cls, json: T_JSON_DICT) -> InternalPropertyDescriptor: @dataclass class PrivatePropertyDescriptor: - ''' + r''' Object private field descriptor. ''' #: Private property name. name: str #: The value associated with the private property. - value: RemoteObject + value: typing.Optional[RemoteObject] = None + + #: A function which serves as a getter for the private property, + #: or ``undefined`` if there is no getter (accessor descriptors only). + get: typing.Optional[RemoteObject] = None + + #: A function which serves as a setter for the private property, + #: or ``undefined`` if there is no setter (accessor descriptors only). + set_: typing.Optional[RemoteObject] = None def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['name'] = self.name - json['value'] = self.value.to_json() + if self.value is not None: + json['value'] = self.value.to_json() + if self.get is not None: + json['get'] = self.get.to_json() + if self.set_ is not None: + json['set'] = self.set_.to_json() return json @classmethod def from_json(cls, json: T_JSON_DICT) -> PrivatePropertyDescriptor: return cls( name=str(json['name']), - value=RemoteObject.from_json(json['value']), + value=RemoteObject.from_json(json['value']) if 'value' in json else None, + get=RemoteObject.from_json(json['get']) if 'get' in json else None, + set_=RemoteObject.from_json(json['set']) if 'set' in json else None, ) @dataclass class CallArgument: - ''' + r''' Represents function call argument. Either remote object id ``objectId``, primitive ``value``, unserializable primitive value or neither of (for undefined) them should be specified. ''' @@ -425,7 +442,7 @@ def from_json(cls, json: T_JSON_DICT) -> CallArgument: class ExecutionContextId(int): - ''' + r''' Id of an execution context. ''' def to_json(self) -> int: @@ -441,7 +458,7 @@ def __repr__(self): @dataclass class ExecutionContextDescription: - ''' + r''' Description of an isolated world. ''' #: Unique id of the execution context. It can be used to specify in which execution context @@ -454,6 +471,11 @@ class ExecutionContextDescription: #: Human readable name describing given context. name: str + #: A system-unique execution context identifier. Unlike the id, this is unique across + #: multiple processes, so can be reliably used to identify specific context while backend + #: performs a cross-process navigation. + unique_id: str + #: Embedder-specific auxiliary data. aux_data: typing.Optional[dict] = None @@ -462,6 +484,7 @@ def to_json(self) -> T_JSON_DICT: json['id'] = self.id_.to_json() json['origin'] = self.origin json['name'] = self.name + json['uniqueId'] = self.unique_id if self.aux_data is not None: json['auxData'] = self.aux_data return json @@ -472,13 +495,14 @@ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextDescription: id_=ExecutionContextId.from_json(json['id']), origin=str(json['origin']), name=str(json['name']), + unique_id=str(json['uniqueId']), aux_data=dict(json['auxData']) if 'auxData' in json else None, ) @dataclass class ExceptionDetails: - ''' + r''' Detailed information about exception (or error) that was thrown during script compilation or execution. ''' @@ -509,6 +533,11 @@ class ExceptionDetails: #: Identifier of the context where exception happened. execution_context_id: typing.Optional[ExecutionContextId] = None + #: Dictionary with entries of meta data that the client associated + #: with this exception, such as information about associated network + #: requests, etc. + exception_meta_data: typing.Optional[dict] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['exceptionId'] = self.exception_id @@ -525,6 +554,8 @@ def to_json(self) -> T_JSON_DICT: json['exception'] = self.exception.to_json() if self.execution_context_id is not None: json['executionContextId'] = self.execution_context_id.to_json() + if self.exception_meta_data is not None: + json['exceptionMetaData'] = self.exception_meta_data return json @classmethod @@ -539,11 +570,12 @@ def from_json(cls, json: T_JSON_DICT) -> ExceptionDetails: stack_trace=StackTrace.from_json(json['stackTrace']) if 'stackTrace' in json else None, exception=RemoteObject.from_json(json['exception']) if 'exception' in json else None, execution_context_id=ExecutionContextId.from_json(json['executionContextId']) if 'executionContextId' in json else None, + exception_meta_data=dict(json['exceptionMetaData']) if 'exceptionMetaData' in json else None, ) class Timestamp(float): - ''' + r''' Number of milliseconds since epoch. ''' def to_json(self) -> float: @@ -558,7 +590,7 @@ def __repr__(self): class TimeDelta(float): - ''' + r''' Number of milliseconds. ''' def to_json(self) -> float: @@ -574,7 +606,7 @@ def __repr__(self): @dataclass class CallFrame: - ''' + r''' Stack entry for runtime errors and assertions. ''' #: JavaScript function name. @@ -614,7 +646,7 @@ def from_json(cls, json: T_JSON_DICT) -> CallFrame: @dataclass class StackTrace: - ''' + r''' Call frames for assertions or error messages. ''' #: JavaScript function name. @@ -652,7 +684,7 @@ def from_json(cls, json: T_JSON_DICT) -> StackTrace: class UniqueDebuggerId(str): - ''' + r''' Unique identifier of current debugger. ''' def to_json(self) -> str: @@ -668,7 +700,7 @@ def __repr__(self): @dataclass class StackTraceId: - ''' + r''' If ``debuggerId`` is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See ``Runtime.StackTrace`` and ``Debugger.paused`` for usages. ''' @@ -696,7 +728,7 @@ def await_promise( return_by_value: typing.Optional[bool] = None, generate_preview: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]: - ''' + r''' Add handler to promise with given promise object id. :param promise_object_id: Identifier of the promise. @@ -734,9 +766,10 @@ def call_function_on( user_gesture: typing.Optional[bool] = None, await_promise: typing.Optional[bool] = None, execution_context_id: typing.Optional[ExecutionContextId] = None, - object_group: typing.Optional[str] = None + object_group: typing.Optional[str] = None, + throw_on_side_effect: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]: - ''' + r''' Calls function with given declaration on the given object. Object group of the result is inherited from the target object. @@ -750,6 +783,7 @@ def call_function_on( :param await_promise: *(Optional)* Whether execution should ````await``` for resulting value and return once awaited promise is resolved. :param execution_context_id: *(Optional)* Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. :param object_group: *(Optional)* Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. + :param throw_on_side_effect: **(EXPERIMENTAL)** *(Optional)* Whether to throw an exception if side effect cannot be ruled out during evaluation. :returns: A tuple with the following items: 0. **result** - Call result. @@ -775,6 +809,8 @@ def call_function_on( params['executionContextId'] = execution_context_id.to_json() if object_group is not None: params['objectGroup'] = object_group + if throw_on_side_effect is not None: + params['throwOnSideEffect'] = throw_on_side_effect cmd_dict: T_JSON_DICT = { 'method': 'Runtime.callFunctionOn', 'params': params, @@ -792,7 +828,7 @@ def compile_script( persist_script: bool, execution_context_id: typing.Optional[ExecutionContextId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[ScriptId], typing.Optional[ExceptionDetails]]]: - ''' + r''' Compiles expression. :param expression: Expression to compile. @@ -822,7 +858,7 @@ def compile_script( def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables reporting of execution contexts creation. ''' cmd_dict: T_JSON_DICT = { @@ -832,7 +868,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def discard_console_entries() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Discards collected exceptions and console API calls. ''' cmd_dict: T_JSON_DICT = { @@ -842,7 +878,7 @@ def discard_console_entries() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables reporting of execution contexts creation by means of ``executionContextCreated`` event. When the reporting gets enabled the event will be sent immediately for each existing execution context. @@ -864,22 +900,30 @@ def evaluate( user_gesture: typing.Optional[bool] = None, await_promise: typing.Optional[bool] = None, throw_on_side_effect: typing.Optional[bool] = None, - timeout: typing.Optional[TimeDelta] = None + timeout: typing.Optional[TimeDelta] = None, + disable_breaks: typing.Optional[bool] = None, + repl_mode: typing.Optional[bool] = None, + allow_unsafe_eval_blocked_by_csp: typing.Optional[bool] = None, + unique_context_id: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]: - ''' + r''' Evaluates expression on global object. :param expression: Expression to evaluate. :param object_group: *(Optional)* Symbolic group name that can be used to release multiple objects. :param include_command_line_api: *(Optional)* Determines whether Command Line API should be available during the evaluation. :param silent: *(Optional)* In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides ```setPauseOnException```` state. - :param context_id: *(Optional)* Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. + :param context_id: *(Optional)* Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. This is mutually exclusive with ````uniqueContextId````, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment. :param return_by_value: *(Optional)* Whether the result is expected to be a JSON object that should be sent by value. :param generate_preview: **(EXPERIMENTAL)** *(Optional)* Whether preview should be generated for the result. :param user_gesture: *(Optional)* Whether execution should be treated as initiated by user in the UI. - :param await_promise: *(Optional)* Whether execution should ````await``` for resulting value and return once awaited promise is resolved. - :param throw_on_side_effect: **(EXPERIMENTAL)** *(Optional)* Whether to throw an exception if side effect cannot be ruled out during evaluation. + :param await_promise: *(Optional)* Whether execution should ````await```` for resulting value and return once awaited promise is resolved. + :param throw_on_side_effect: **(EXPERIMENTAL)** *(Optional)* Whether to throw an exception if side effect cannot be ruled out during evaluation. This implies ````disableBreaks```` below. :param timeout: **(EXPERIMENTAL)** *(Optional)* Terminate execution after timing out (number of milliseconds). + :param disable_breaks: **(EXPERIMENTAL)** *(Optional)* Disable breakpoints during execution. + :param repl_mode: **(EXPERIMENTAL)** *(Optional)* Setting this flag to true enables ````let```` re-declaration and top-level ````await````. Note that ````let```` variables can only be re-declared if they originate from ````replMode```` themselves. + :param allow_unsafe_eval_blocked_by_csp: **(EXPERIMENTAL)** *(Optional)* The Content Security Policy (CSP) for the target might block 'unsafe-eval' which includes eval(), Function(), setTimeout() and setInterval() when called with non-callable arguments. This flag bypasses CSP for this evaluation and allows unsafe-eval. Defaults to true. + :param unique_context_id: **(EXPERIMENTAL)** *(Optional)* An alternative way to specify the execution context to evaluate in. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental evaluation of the expression in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with ````contextId```. :returns: A tuple with the following items: 0. **result** - Evaluation result. @@ -907,6 +951,14 @@ def evaluate( params['throwOnSideEffect'] = throw_on_side_effect if timeout is not None: params['timeout'] = timeout.to_json() + if disable_breaks is not None: + params['disableBreaks'] = disable_breaks + if repl_mode is not None: + params['replMode'] = repl_mode + if allow_unsafe_eval_blocked_by_csp is not None: + params['allowUnsafeEvalBlockedByCSP'] = allow_unsafe_eval_blocked_by_csp + if unique_context_id is not None: + params['uniqueContextId'] = unique_context_id cmd_dict: T_JSON_DICT = { 'method': 'Runtime.evaluate', 'params': params, @@ -919,7 +971,7 @@ def evaluate( def get_isolate_id() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: - ''' + r''' Returns the isolate id. **EXPERIMENTAL** @@ -934,7 +986,7 @@ def get_isolate_id() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]: def get_heap_usage() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[float, float]]: - ''' + r''' Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime. @@ -959,9 +1011,10 @@ def get_properties( object_id: RemoteObjectId, own_properties: typing.Optional[bool] = None, accessor_properties_only: typing.Optional[bool] = None, - generate_preview: typing.Optional[bool] = None + generate_preview: typing.Optional[bool] = None, + non_indexed_properties_only: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[PropertyDescriptor], typing.Optional[typing.List[InternalPropertyDescriptor]], typing.Optional[typing.List[PrivatePropertyDescriptor]], typing.Optional[ExceptionDetails]]]: - ''' + r''' Returns properties of a given object. Object group of the result is inherited from the target object. @@ -969,6 +1022,7 @@ def get_properties( :param own_properties: *(Optional)* If true, returns properties belonging only to the element itself, not to its prototype chain. :param accessor_properties_only: **(EXPERIMENTAL)** *(Optional)* If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. :param generate_preview: **(EXPERIMENTAL)** *(Optional)* Whether preview should be generated for the results. + :param non_indexed_properties_only: **(EXPERIMENTAL)** *(Optional)* If true, returns non-indexed properties only. :returns: A tuple with the following items: 0. **result** - Object properties. @@ -984,6 +1038,8 @@ def get_properties( params['accessorPropertiesOnly'] = accessor_properties_only if generate_preview is not None: params['generatePreview'] = generate_preview + if non_indexed_properties_only is not None: + params['nonIndexedPropertiesOnly'] = non_indexed_properties_only cmd_dict: T_JSON_DICT = { 'method': 'Runtime.getProperties', 'params': params, @@ -1000,7 +1056,7 @@ def get_properties( def global_lexical_scope_names( execution_context_id: typing.Optional[ExecutionContextId] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Returns all let, const and class variables from global scope. :param execution_context_id: *(Optional)* Specifies in which execution context to lookup global scope variables. @@ -1021,7 +1077,7 @@ def query_objects( prototype_object_id: RemoteObjectId, object_group: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,RemoteObject]: - ''' + r''' :param prototype_object_id: Identifier of the prototype to return objects for. :param object_group: *(Optional)* Symbolic group name that can be used to release the results. :returns: Array with objects. @@ -1041,7 +1097,7 @@ def query_objects( def release_object( object_id: RemoteObjectId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Releases remote object with given id. :param object_id: Identifier of the object to release. @@ -1058,7 +1114,7 @@ def release_object( def release_object_group( object_group: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Releases all remote objects that belong to a given group. :param object_group: Symbolic object group name. @@ -1073,7 +1129,7 @@ def release_object_group( def run_if_waiting_for_debugger() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Tells inspected instance to run if it was waiting for debugger to attach. ''' cmd_dict: T_JSON_DICT = { @@ -1092,7 +1148,7 @@ def run_script( generate_preview: typing.Optional[bool] = None, await_promise: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[RemoteObject, typing.Optional[ExceptionDetails]]]: - ''' + r''' Runs script with given id in a given context. :param script_id: Id of the script to run. @@ -1138,7 +1194,7 @@ def run_script( def set_async_call_stack_depth( max_depth: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables or disables async call stacks tracking. :param max_depth: Maximum depth of async call stacks. Setting to ```0``` will effectively disable collecting async call stacks (default). @@ -1155,7 +1211,7 @@ def set_async_call_stack_depth( def set_custom_object_formatter_enabled( enabled: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' **EXPERIMENTAL** @@ -1174,7 +1230,7 @@ def set_custom_object_formatter_enabled( def set_max_call_stack_size_to_capture( size: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' **EXPERIMENTAL** @@ -1191,7 +1247,7 @@ def set_max_call_stack_size_to_capture( def terminate_execution() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends. @@ -1205,14 +1261,13 @@ def terminate_execution() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def add_binding( name: str, - execution_context_id: typing.Optional[ExecutionContextId] = None + execution_context_id: typing.Optional[ExecutionContextId] = None, + execution_context_name: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' If executionContextId is empty, adds binding with the given name on the global objects of all inspected contexts, including those created later, bindings survive reloads. - If executionContextId is specified, adds binding only on global object of - given execution context. Binding function takes exactly one argument, this argument should be string, in case of any other input, function throws an exception. Each binding function call produces Runtime.bindingCalled notification. @@ -1220,12 +1275,15 @@ def add_binding( **EXPERIMENTAL** :param name: - :param execution_context_id: *(Optional)* + :param execution_context_id: **(DEPRECATED)** *(Optional)* If specified, the binding would only be exposed to the specified execution context. If omitted and ```executionContextName```` is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with ````executionContextName````. Deprecated in favor of ````executionContextName```` due to an unclear use case and bugs in implementation (crbug.com/1169639). ````executionContextId```` will be removed in the future. + :param execution_context_name: **(EXPERIMENTAL)** *(Optional)* If specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See also ````ExecutionContext.name```` and ````worldName```` parameter to ````Page.addScriptToEvaluateOnNewDocument````. This parameter is mutually exclusive with ````executionContextId```. ''' params: T_JSON_DICT = dict() params['name'] = name if execution_context_id is not None: params['executionContextId'] = execution_context_id.to_json() + if execution_context_name is not None: + params['executionContextName'] = execution_context_name cmd_dict: T_JSON_DICT = { 'method': 'Runtime.addBinding', 'params': params, @@ -1236,7 +1294,7 @@ def add_binding( def remove_binding( name: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications. @@ -1256,7 +1314,7 @@ def remove_binding( @event_class('Runtime.bindingCalled') @dataclass class BindingCalled: - ''' + r''' **EXPERIMENTAL** Notification is issued every time when binding is called. @@ -1278,7 +1336,7 @@ def from_json(cls, json: T_JSON_DICT) -> BindingCalled: @event_class('Runtime.consoleAPICalled') @dataclass class ConsoleAPICalled: - ''' + r''' Issued when console API was called. ''' #: Type of the call. @@ -1313,7 +1371,7 @@ def from_json(cls, json: T_JSON_DICT) -> ConsoleAPICalled: @event_class('Runtime.exceptionRevoked') @dataclass class ExceptionRevoked: - ''' + r''' Issued when unhandled exception was revoked. ''' #: Reason describing why exception was revoked. @@ -1332,7 +1390,7 @@ def from_json(cls, json: T_JSON_DICT) -> ExceptionRevoked: @event_class('Runtime.exceptionThrown') @dataclass class ExceptionThrown: - ''' + r''' Issued when exception was thrown and unhandled. ''' #: Timestamp of the exception. @@ -1350,7 +1408,7 @@ def from_json(cls, json: T_JSON_DICT) -> ExceptionThrown: @event_class('Runtime.executionContextCreated') @dataclass class ExecutionContextCreated: - ''' + r''' Issued when new execution context is created. ''' #: A newly created execution context. @@ -1366,7 +1424,7 @@ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextCreated: @event_class('Runtime.executionContextDestroyed') @dataclass class ExecutionContextDestroyed: - ''' + r''' Issued when execution context is destroyed. ''' #: Id of the destroyed context @@ -1382,7 +1440,7 @@ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextDestroyed: @event_class('Runtime.executionContextsCleared') @dataclass class ExecutionContextsCleared: - ''' + r''' Issued when all executionContexts were cleared in browser ''' @@ -1397,16 +1455,19 @@ def from_json(cls, json: T_JSON_DICT) -> ExecutionContextsCleared: @event_class('Runtime.inspectRequested') @dataclass class InspectRequested: - ''' + r''' Issued when object should be inspected (for example, as a result of inspect() command line API call). ''' object_: RemoteObject hints: dict + #: Identifier of the context where the call was made. + execution_context_id: typing.Optional[ExecutionContextId] @classmethod def from_json(cls, json: T_JSON_DICT) -> InspectRequested: return cls( object_=RemoteObject.from_json(json['object']), - hints=dict(json['hints']) + hints=dict(json['hints']), + execution_context_id=ExecutionContextId.from_json(json['executionContextId']) if 'executionContextId' in json else None ) diff --git a/cdp/schema.py b/cdp/schema.py index 0eea84d..8a06f00 100644 --- a/cdp/schema.py +++ b/cdp/schema.py @@ -14,7 +14,7 @@ @dataclass class Domain: - ''' + r''' Description of the protocol domain. ''' #: Domain name. @@ -38,7 +38,7 @@ def from_json(cls, json: T_JSON_DICT) -> Domain: def get_domains() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Domain]]: - ''' + r''' Returns supported domains. :returns: List of supported domains. diff --git a/cdp/security.py b/cdp/security.py index 4f0e5a0..fe7404f 100644 --- a/cdp/security.py +++ b/cdp/security.py @@ -11,12 +11,12 @@ import enum import typing - +from . import network from deprecated.sphinx import deprecated # type: ignore class CertificateId(int): - ''' + r''' An internal certificate ID value. ''' def to_json(self) -> int: @@ -31,7 +31,7 @@ def __repr__(self): class MixedContentType(enum.Enum): - ''' + r''' A description of mixed content (HTTP resources on HTTPS pages), as defined by https://www.w3.org/TR/mixed-content/#categories ''' @@ -48,7 +48,7 @@ def from_json(cls, json: str) -> MixedContentType: class SecurityState(enum.Enum): - ''' + r''' The security level of a page or resource. ''' UNKNOWN = "unknown" @@ -56,6 +56,7 @@ class SecurityState(enum.Enum): INSECURE = "insecure" SECURE = "secure" INFO = "info" + INSECURE_BROKEN = "insecure-broken" def to_json(self) -> str: return self.value @@ -66,8 +67,188 @@ def from_json(cls, json: str) -> SecurityState: @dataclass -class SecurityStateExplanation: +class CertificateSecurityState: + r''' + Details about the security state of the page certificate. + ''' + #: Protocol name (e.g. "TLS 1.2" or "QUIC"). + protocol: str + + #: Key Exchange used by the connection, or the empty string if not applicable. + key_exchange: str + + #: Cipher name. + cipher: str + + #: Page certificate. + certificate: typing.List[str] + + #: Certificate subject name. + subject_name: str + + #: Name of the issuing CA. + issuer: str + + #: Certificate valid from date. + valid_from: network.TimeSinceEpoch + + #: Certificate valid to (expiration) date + valid_to: network.TimeSinceEpoch + + #: True if the certificate uses a weak signature aglorithm. + certificate_has_weak_signature: bool + + #: True if the certificate has a SHA1 signature in the chain. + certificate_has_sha1_signature: bool + + #: True if modern SSL + modern_ssl: bool + + #: True if the connection is using an obsolete SSL protocol. + obsolete_ssl_protocol: bool + + #: True if the connection is using an obsolete SSL key exchange. + obsolete_ssl_key_exchange: bool + + #: True if the connection is using an obsolete SSL cipher. + obsolete_ssl_cipher: bool + + #: True if the connection is using an obsolete SSL signature. + obsolete_ssl_signature: bool + + #: (EC)DH group used by the connection, if applicable. + key_exchange_group: typing.Optional[str] = None + + #: TLS MAC. Note that AEAD ciphers do not have separate MACs. + mac: typing.Optional[str] = None + + #: The highest priority network error code, if the certificate has an error. + certificate_network_error: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['protocol'] = self.protocol + json['keyExchange'] = self.key_exchange + json['cipher'] = self.cipher + json['certificate'] = [i for i in self.certificate] + json['subjectName'] = self.subject_name + json['issuer'] = self.issuer + json['validFrom'] = self.valid_from.to_json() + json['validTo'] = self.valid_to.to_json() + json['certificateHasWeakSignature'] = self.certificate_has_weak_signature + json['certificateHasSha1Signature'] = self.certificate_has_sha1_signature + json['modernSSL'] = self.modern_ssl + json['obsoleteSslProtocol'] = self.obsolete_ssl_protocol + json['obsoleteSslKeyExchange'] = self.obsolete_ssl_key_exchange + json['obsoleteSslCipher'] = self.obsolete_ssl_cipher + json['obsoleteSslSignature'] = self.obsolete_ssl_signature + if self.key_exchange_group is not None: + json['keyExchangeGroup'] = self.key_exchange_group + if self.mac is not None: + json['mac'] = self.mac + if self.certificate_network_error is not None: + json['certificateNetworkError'] = self.certificate_network_error + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> CertificateSecurityState: + return cls( + protocol=str(json['protocol']), + key_exchange=str(json['keyExchange']), + cipher=str(json['cipher']), + certificate=[str(i) for i in json['certificate']], + subject_name=str(json['subjectName']), + issuer=str(json['issuer']), + valid_from=network.TimeSinceEpoch.from_json(json['validFrom']), + valid_to=network.TimeSinceEpoch.from_json(json['validTo']), + certificate_has_weak_signature=bool(json['certificateHasWeakSignature']), + certificate_has_sha1_signature=bool(json['certificateHasSha1Signature']), + modern_ssl=bool(json['modernSSL']), + obsolete_ssl_protocol=bool(json['obsoleteSslProtocol']), + obsolete_ssl_key_exchange=bool(json['obsoleteSslKeyExchange']), + obsolete_ssl_cipher=bool(json['obsoleteSslCipher']), + obsolete_ssl_signature=bool(json['obsoleteSslSignature']), + key_exchange_group=str(json['keyExchangeGroup']) if 'keyExchangeGroup' in json else None, + mac=str(json['mac']) if 'mac' in json else None, + certificate_network_error=str(json['certificateNetworkError']) if 'certificateNetworkError' in json else None, + ) + + +class SafetyTipStatus(enum.Enum): + BAD_REPUTATION = "badReputation" + LOOKALIKE = "lookalike" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> SafetyTipStatus: + return cls(json) + + +@dataclass +class SafetyTipInfo: + #: Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. + safety_tip_status: SafetyTipStatus + + #: The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. + safe_url: typing.Optional[str] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['safetyTipStatus'] = self.safety_tip_status.to_json() + if self.safe_url is not None: + json['safeUrl'] = self.safe_url + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> SafetyTipInfo: + return cls( + safety_tip_status=SafetyTipStatus.from_json(json['safetyTipStatus']), + safe_url=str(json['safeUrl']) if 'safeUrl' in json else None, + ) + + +@dataclass +class VisibleSecurityState: + r''' + Security state information about the page. ''' + #: The security level of the page. + security_state: SecurityState + + #: Array of security state issues ids. + security_state_issue_ids: typing.List[str] + + #: Security state details about the page certificate. + certificate_security_state: typing.Optional[CertificateSecurityState] = None + + #: The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown. + safety_tip_info: typing.Optional[SafetyTipInfo] = None + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['securityState'] = self.security_state.to_json() + json['securityStateIssueIds'] = [i for i in self.security_state_issue_ids] + if self.certificate_security_state is not None: + json['certificateSecurityState'] = self.certificate_security_state.to_json() + if self.safety_tip_info is not None: + json['safetyTipInfo'] = self.safety_tip_info.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> VisibleSecurityState: + return cls( + security_state=SecurityState.from_json(json['securityState']), + security_state_issue_ids=[str(i) for i in json['securityStateIssueIds']], + certificate_security_state=CertificateSecurityState.from_json(json['certificateSecurityState']) if 'certificateSecurityState' in json else None, + safety_tip_info=SafetyTipInfo.from_json(json['safetyTipInfo']) if 'safetyTipInfo' in json else None, + ) + + +@dataclass +class SecurityStateExplanation: + r''' An explanation of an factor contributing to the security state. ''' #: Security state representing the severity of the factor being explained. @@ -118,7 +299,7 @@ def from_json(cls, json: T_JSON_DICT) -> SecurityStateExplanation: @dataclass class InsecureContentStatus: - ''' + r''' Information about insecure content on the page. ''' #: Always false. @@ -167,7 +348,7 @@ def from_json(cls, json: T_JSON_DICT) -> InsecureContentStatus: class CertificateErrorAction(enum.Enum): - ''' + r''' The action to take when a certificate error occurs. continue will continue processing the request and cancel will cancel the request. ''' @@ -183,7 +364,7 @@ def from_json(cls, json: str) -> CertificateErrorAction: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables tracking security state changes. ''' cmd_dict: T_JSON_DICT = { @@ -193,7 +374,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables tracking security state changes. ''' cmd_dict: T_JSON_DICT = { @@ -205,7 +386,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def set_ignore_certificate_errors( ignore: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enable/disable whether all certificate errors should be ignored. **EXPERIMENTAL** @@ -226,7 +407,7 @@ def handle_certificate_error( event_id: int, action: CertificateErrorAction ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Handles a certificate error that fired a certificateError event. .. deprecated:: 1.3 @@ -248,7 +429,7 @@ def handle_certificate_error( def set_override_certificate_errors( override: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enable/disable overriding certificate errors. If enabled, all certificate error events need to be handled by the DevTools client and should be answered with ``handleCertificateError`` commands. @@ -269,7 +450,7 @@ def set_override_certificate_errors( @event_class('Security.certificateError') @dataclass class CertificateError: - ''' + r''' There is a certificate error. If overriding certificate errors is enabled, then it should be handled with the ``handleCertificateError`` command. Note: this event does not fire if the certificate error has been allowed internally. Only one client per target should override @@ -291,22 +472,41 @@ def from_json(cls, json: T_JSON_DICT) -> CertificateError: ) +@event_class('Security.visibleSecurityStateChanged') +@dataclass +class VisibleSecurityStateChanged: + r''' + **EXPERIMENTAL** + + The security state of the page changed. + ''' + #: Security state information about the page. + visible_security_state: VisibleSecurityState + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> VisibleSecurityStateChanged: + return cls( + visible_security_state=VisibleSecurityState.from_json(json['visibleSecurityState']) + ) + + +@deprecated(version="1.3") @event_class('Security.securityStateChanged') @dataclass class SecurityStateChanged: - ''' - The security state of the page changed. + r''' + The security state of the page changed. No longer being sent. ''' #: Security state. security_state: SecurityState #: True if the page was loaded over cryptographic transport such as HTTPS. scheme_is_cryptographic: bool - #: List of explanations for the security state. If the overall security state is ``insecure`` or - #: ``warning``, at least one corresponding explanation should be included. + #: Previously a list of explanations for the security state. Now always + #: empty. explanations: typing.List[SecurityStateExplanation] #: Information about insecure content on the page. insecure_content_status: InsecureContentStatus - #: Overrides user-visible description of the state. + #: Overrides user-visible description of the state. Always omitted. summary: typing.Optional[str] @classmethod diff --git a/cdp/service_worker.py b/cdp/service_worker.py index c6a8ff8..711fdb8 100644 --- a/cdp/service_worker.py +++ b/cdp/service_worker.py @@ -28,7 +28,7 @@ def __repr__(self): @dataclass class ServiceWorkerRegistration: - ''' + r''' ServiceWorker registration. ''' registration_id: RegistrationID @@ -85,7 +85,7 @@ def from_json(cls, json: str) -> ServiceWorkerVersionStatus: @dataclass class ServiceWorkerVersion: - ''' + r''' ServiceWorker version. ''' version_id: str @@ -143,7 +143,7 @@ def from_json(cls, json: T_JSON_DICT) -> ServiceWorkerVersion: @dataclass class ServiceWorkerErrorMessage: - ''' + r''' ServiceWorker error message. ''' error_message: str @@ -185,7 +185,7 @@ def deliver_push_message( registration_id: RegistrationID, data: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param origin: :param registration_id: :param data: @@ -215,7 +215,7 @@ def dispatch_sync_event( tag: str, last_chance: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param origin: :param registration_id: :param tag: @@ -233,6 +233,27 @@ def dispatch_sync_event( json = yield cmd_dict +def dispatch_periodic_sync_event( + origin: str, + registration_id: RegistrationID, + tag: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + :param origin: + :param registration_id: + :param tag: + ''' + params: T_JSON_DICT = dict() + params['origin'] = origin + params['registrationId'] = registration_id.to_json() + params['tag'] = tag + cmd_dict: T_JSON_DICT = { + 'method': 'ServiceWorker.dispatchPeriodicSyncEvent', + 'params': params, + } + json = yield cmd_dict + + def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: cmd_dict: T_JSON_DICT = { @@ -244,7 +265,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def inspect_worker( version_id: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param version_id: ''' params: T_JSON_DICT = dict() @@ -259,7 +280,7 @@ def inspect_worker( def set_force_update_on_page_load( force_update_on_page_load: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param force_update_on_page_load: ''' params: T_JSON_DICT = dict() @@ -274,7 +295,7 @@ def set_force_update_on_page_load( def skip_waiting( scope_url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param scope_url: ''' params: T_JSON_DICT = dict() @@ -289,7 +310,7 @@ def skip_waiting( def start_worker( scope_url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param scope_url: ''' params: T_JSON_DICT = dict() @@ -312,7 +333,7 @@ def stop_all_workers() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def stop_worker( version_id: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param version_id: ''' params: T_JSON_DICT = dict() @@ -327,7 +348,7 @@ def stop_worker( def unregister( scope_url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param scope_url: ''' params: T_JSON_DICT = dict() @@ -342,7 +363,7 @@ def unregister( def update_registration( scope_url: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' :param scope_url: ''' params: T_JSON_DICT = dict() diff --git a/cdp/storage.py b/cdp/storage.py index 80f4b88..c3944ad 100644 --- a/cdp/storage.py +++ b/cdp/storage.py @@ -11,9 +11,12 @@ import enum import typing +from . import browser +from . import network + class StorageType(enum.Enum): - ''' + r''' Enum of possible storage types. ''' APPCACHE = "appcache" @@ -38,7 +41,7 @@ def from_json(cls, json: str) -> StorageType: @dataclass class UsageForType: - ''' + r''' Usage for a storage type. ''' #: Name of storage type. @@ -61,11 +64,35 @@ def from_json(cls, json: T_JSON_DICT) -> UsageForType: ) +@dataclass +class TrustTokens: + r''' + Pair of issuer origin and number of available (signed, but not used) Trust + Tokens from that issuer. + ''' + issuer_origin: str + + count: float + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['issuerOrigin'] = self.issuer_origin + json['count'] = self.count + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> TrustTokens: + return cls( + issuer_origin=str(json['issuerOrigin']), + count=float(json['count']), + ) + + def clear_data_for_origin( origin: str, storage_types: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears storage for origin. :param origin: Security origin. @@ -81,10 +108,69 @@ def clear_data_for_origin( json = yield cmd_dict +def get_cookies( + browser_context_id: typing.Optional[browser.BrowserContextID] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[network.Cookie]]: + r''' + Returns all browser cookies. + + :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint. + :returns: Array of cookie objects. + ''' + params: T_JSON_DICT = dict() + if browser_context_id is not None: + params['browserContextId'] = browser_context_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Storage.getCookies', + 'params': params, + } + json = yield cmd_dict + return [network.Cookie.from_json(i) for i in json['cookies']] + + +def set_cookies( + cookies: typing.List[network.CookieParam], + browser_context_id: typing.Optional[browser.BrowserContextID] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Sets given cookies. + + :param cookies: Cookies to be set. + :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint. + ''' + params: T_JSON_DICT = dict() + params['cookies'] = [i.to_json() for i in cookies] + if browser_context_id is not None: + params['browserContextId'] = browser_context_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Storage.setCookies', + 'params': params, + } + json = yield cmd_dict + + +def clear_cookies( + browser_context_id: typing.Optional[browser.BrowserContextID] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Clears cookies. + + :param browser_context_id: *(Optional)* Browser context to use when called on the browser endpoint. + ''' + params: T_JSON_DICT = dict() + if browser_context_id is not None: + params['browserContextId'] = browser_context_id.to_json() + cmd_dict: T_JSON_DICT = { + 'method': 'Storage.clearCookies', + 'params': params, + } + json = yield cmd_dict + + def get_usage_and_quota( origin: str - ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[float, float, typing.List[UsageForType]]]: - ''' + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[float, float, bool, typing.List[UsageForType]]]: + r''' Returns usage and quota in bytes. :param origin: Security origin. @@ -92,7 +178,8 @@ def get_usage_and_quota( 0. **usage** - Storage usage (bytes). 1. **quota** - Storage quota (bytes). - 2. **usageBreakdown** - Storage usage per type (bytes). + 2. **overrideActive** - Whether or not the origin has an active storage quota override + 3. **usageBreakdown** - Storage usage per type (bytes). ''' params: T_JSON_DICT = dict() params['origin'] = origin @@ -104,14 +191,38 @@ def get_usage_and_quota( return ( float(json['usage']), float(json['quota']), + bool(json['overrideActive']), [UsageForType.from_json(i) for i in json['usageBreakdown']] ) +def override_quota_for_origin( + origin: str, + quota_size: typing.Optional[float] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Override quota for the specified origin + + **EXPERIMENTAL** + + :param origin: Security origin. + :param quota_size: *(Optional)* The quota size (in bytes) to override the original quota with. If this is called multiple times, the overridden quota will be equal to the quotaSize provided in the final call. If this is called without specifying a quotaSize, the quota will be reset to the default value for the specified origin. If this is called multiple times with different origins, the override will be maintained for each origin until it is disabled (called without a quotaSize). + ''' + params: T_JSON_DICT = dict() + params['origin'] = origin + if quota_size is not None: + params['quotaSize'] = quota_size + cmd_dict: T_JSON_DICT = { + 'method': 'Storage.overrideQuotaForOrigin', + 'params': params, + } + json = yield cmd_dict + + def track_cache_storage_for_origin( origin: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Registers origin to be notified when an update occurs to its cache storage list. :param origin: Security origin. @@ -128,7 +239,7 @@ def track_cache_storage_for_origin( def track_indexed_db_for_origin( origin: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Registers origin to be notified when an update occurs to its IndexedDB. :param origin: Security origin. @@ -145,7 +256,7 @@ def track_indexed_db_for_origin( def untrack_cache_storage_for_origin( origin: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Unregisters origin from receiving notifications for cache storage. :param origin: Security origin. @@ -162,7 +273,7 @@ def untrack_cache_storage_for_origin( def untrack_indexed_db_for_origin( origin: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Unregisters origin from receiving notifications for IndexedDB. :param origin: Security origin. @@ -176,10 +287,48 @@ def untrack_indexed_db_for_origin( json = yield cmd_dict +def get_trust_tokens() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[TrustTokens]]: + r''' + Returns the number of stored Trust Tokens per issuer for the + current browsing context. + + **EXPERIMENTAL** + + :returns: + ''' + cmd_dict: T_JSON_DICT = { + 'method': 'Storage.getTrustTokens', + } + json = yield cmd_dict + return [TrustTokens.from_json(i) for i in json['tokens']] + + +def clear_trust_tokens( + issuer_origin: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: + r''' + Removes all Trust Tokens issued by the provided issuerOrigin. + Leaves other stored data, including the issuer's Redemption Records, intact. + + **EXPERIMENTAL** + + :param issuer_origin: + :returns: True if any tokens were deleted, false otherwise. + ''' + params: T_JSON_DICT = dict() + params['issuerOrigin'] = issuer_origin + cmd_dict: T_JSON_DICT = { + 'method': 'Storage.clearTrustTokens', + 'params': params, + } + json = yield cmd_dict + return bool(json['didDeleteTokens']) + + @event_class('Storage.cacheStorageContentUpdated') @dataclass class CacheStorageContentUpdated: - ''' + r''' A cache's contents have been modified. ''' #: Origin to update. @@ -198,7 +347,7 @@ def from_json(cls, json: T_JSON_DICT) -> CacheStorageContentUpdated: @event_class('Storage.cacheStorageListUpdated') @dataclass class CacheStorageListUpdated: - ''' + r''' A cache has been added/deleted. ''' #: Origin to update. @@ -214,7 +363,7 @@ def from_json(cls, json: T_JSON_DICT) -> CacheStorageListUpdated: @event_class('Storage.indexedDBContentUpdated') @dataclass class IndexedDBContentUpdated: - ''' + r''' The origin's IndexedDB object store has been modified. ''' #: Origin to update. @@ -236,7 +385,7 @@ def from_json(cls, json: T_JSON_DICT) -> IndexedDBContentUpdated: @event_class('Storage.indexedDBListUpdated') @dataclass class IndexedDBListUpdated: - ''' + r''' The origin's IndexedDB database list has been modified. ''' #: Origin to update. diff --git a/cdp/system_info.py b/cdp/system_info.py index 71cf4d7..f13fcc8 100644 --- a/cdp/system_info.py +++ b/cdp/system_info.py @@ -14,7 +14,7 @@ @dataclass class GPUDevice: - ''' + r''' Describes a single graphics processor (GPU). ''' #: PCI ID of the GPU vendor, if available; 0 otherwise. @@ -35,6 +35,12 @@ class GPUDevice: #: String description of the GPU driver version. driver_version: str + #: Sub sys ID of the GPU, only available on Windows. + sub_sys_id: typing.Optional[float] = None + + #: Revision of the GPU, only available on Windows. + revision: typing.Optional[float] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['vendorId'] = self.vendor_id @@ -43,6 +49,10 @@ def to_json(self) -> T_JSON_DICT: json['deviceString'] = self.device_string json['driverVendor'] = self.driver_vendor json['driverVersion'] = self.driver_version + if self.sub_sys_id is not None: + json['subSysId'] = self.sub_sys_id + if self.revision is not None: + json['revision'] = self.revision return json @classmethod @@ -54,12 +64,14 @@ def from_json(cls, json: T_JSON_DICT) -> GPUDevice: device_string=str(json['deviceString']), driver_vendor=str(json['driverVendor']), driver_version=str(json['driverVersion']), + sub_sys_id=float(json['subSysId']) if 'subSysId' in json else None, + revision=float(json['revision']) if 'revision' in json else None, ) @dataclass class Size: - ''' + r''' Describes the width and height dimensions of an entity. ''' #: Width in pixels. @@ -84,7 +96,7 @@ def from_json(cls, json: T_JSON_DICT) -> Size: @dataclass class VideoDecodeAcceleratorCapability: - ''' + r''' Describes a supported video decoding profile with its associated minimum and maximum resolutions. ''' @@ -115,7 +127,7 @@ def from_json(cls, json: T_JSON_DICT) -> VideoDecodeAcceleratorCapability: @dataclass class VideoEncodeAcceleratorCapability: - ''' + r''' Describes a supported video encoding profile with its associated maximum resolution and maximum framerate. ''' @@ -151,7 +163,7 @@ def from_json(cls, json: T_JSON_DICT) -> VideoEncodeAcceleratorCapability: class SubsamplingFormat(enum.Enum): - ''' + r''' YUV subsampling type of the pixels of a given image. ''' YUV420 = "yuv420" @@ -166,14 +178,30 @@ def from_json(cls, json: str) -> SubsamplingFormat: return cls(json) +class ImageType(enum.Enum): + r''' + Image format of a given image. + ''' + JPEG = "jpeg" + WEBP = "webp" + UNKNOWN = "unknown" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ImageType: + return cls(json) + + @dataclass class ImageDecodeAcceleratorCapability: - ''' + r''' Describes a supported image decoding profile with its associated minimum and maximum resolutions and subsampling. ''' #: Image coded, e.g. Jpeg. - image_type: str + image_type: ImageType #: Maximum supported dimensions of the image in pixels. max_dimensions: Size @@ -186,7 +214,7 @@ class ImageDecodeAcceleratorCapability: def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() - json['imageType'] = self.image_type + json['imageType'] = self.image_type.to_json() json['maxDimensions'] = self.max_dimensions.to_json() json['minDimensions'] = self.min_dimensions.to_json() json['subsamplings'] = [i.to_json() for i in self.subsamplings] @@ -195,7 +223,7 @@ def to_json(self) -> T_JSON_DICT: @classmethod def from_json(cls, json: T_JSON_DICT) -> ImageDecodeAcceleratorCapability: return cls( - image_type=str(json['imageType']), + image_type=ImageType.from_json(json['imageType']), max_dimensions=Size.from_json(json['maxDimensions']), min_dimensions=Size.from_json(json['minDimensions']), subsamplings=[SubsamplingFormat.from_json(i) for i in json['subsamplings']], @@ -204,7 +232,7 @@ def from_json(cls, json: T_JSON_DICT) -> ImageDecodeAcceleratorCapability: @dataclass class GPUInfo: - ''' + r''' Provides information about the GPU(s) on the system. ''' #: The graphics devices on the system. Element 0 is the primary GPU. @@ -256,7 +284,7 @@ def from_json(cls, json: T_JSON_DICT) -> GPUInfo: @dataclass class ProcessInfo: - ''' + r''' Represents process info. ''' #: Specifies process type. @@ -286,7 +314,7 @@ def from_json(cls, json: T_JSON_DICT) -> ProcessInfo: def get_info() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[GPUInfo, str, str, str]]: - ''' + r''' Returns information about the system. :returns: A tuple with the following items: @@ -309,7 +337,7 @@ def get_info() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[GPUInfo, def get_process_info() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[ProcessInfo]]: - ''' + r''' Returns information about all running processes. :returns: An array of process info blocks. diff --git a/cdp/target.py b/cdp/target.py index 4df4519..eac1062 100644 --- a/cdp/target.py +++ b/cdp/target.py @@ -11,6 +11,10 @@ import enum import typing +from . import browser +from . import page +from deprecated.sphinx import deprecated # type: ignore + class TargetID(str): def to_json(self) -> str: @@ -25,7 +29,7 @@ def __repr__(self): class SessionID(str): - ''' + r''' Unique identifier of attached debugging session. ''' def to_json(self) -> str: @@ -39,18 +43,6 @@ def __repr__(self): return 'SessionID({})'.format(super().__repr__()) -class BrowserContextID(str): - def to_json(self) -> str: - return self - - @classmethod - def from_json(cls, json: str) -> BrowserContextID: - return cls(json) - - def __repr__(self): - return 'BrowserContextID({})'.format(super().__repr__()) - - @dataclass class TargetInfo: target_id: TargetID @@ -64,10 +56,16 @@ class TargetInfo: #: Whether the target has an attached client. attached: bool + #: Whether the target has access to the originating window. + can_access_opener: bool + #: Opener target Id opener_id: typing.Optional[TargetID] = None - browser_context_id: typing.Optional[BrowserContextID] = None + #: Frame id of originating window (is only set if target has an opener). + opener_frame_id: typing.Optional[page.FrameId] = None + + browser_context_id: typing.Optional[browser.BrowserContextID] = None def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() @@ -76,8 +74,11 @@ def to_json(self) -> T_JSON_DICT: json['title'] = self.title json['url'] = self.url json['attached'] = self.attached + json['canAccessOpener'] = self.can_access_opener if self.opener_id is not None: json['openerId'] = self.opener_id.to_json() + if self.opener_frame_id is not None: + json['openerFrameId'] = self.opener_frame_id.to_json() if self.browser_context_id is not None: json['browserContextId'] = self.browser_context_id.to_json() return json @@ -90,8 +91,10 @@ def from_json(cls, json: T_JSON_DICT) -> TargetInfo: title=str(json['title']), url=str(json['url']), attached=bool(json['attached']), + can_access_opener=bool(json['canAccessOpener']), opener_id=TargetID.from_json(json['openerId']) if 'openerId' in json else None, - browser_context_id=BrowserContextID.from_json(json['browserContextId']) if 'browserContextId' in json else None, + opener_frame_id=page.FrameId.from_json(json['openerFrameId']) if 'openerFrameId' in json else None, + browser_context_id=browser.BrowserContextID.from_json(json['browserContextId']) if 'browserContextId' in json else None, ) @@ -118,7 +121,7 @@ def from_json(cls, json: T_JSON_DICT) -> RemoteLocation: def activate_target( target_id: TargetID ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Activates (focuses) the target. :param target_id: @@ -136,11 +139,11 @@ def attach_to_target( target_id: TargetID, flatten: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SessionID]: - ''' + r''' Attaches to the target with given id. :param target_id: - :param flatten: **(EXPERIMENTAL)** *(Optional)* Enables "flat" access to the session via specifying sessionId attribute in the commands. + :param flatten: *(Optional)* Enables "flat" access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325. :returns: Id assigned to the session. ''' params: T_JSON_DICT = dict() @@ -156,7 +159,7 @@ def attach_to_target( def attach_to_browser_target() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SessionID]: - ''' + r''' Attaches to the browser target, only uses flat sessionId mode. **EXPERIMENTAL** @@ -173,11 +176,11 @@ def attach_to_browser_target() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Sessi def close_target( target_id: TargetID ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,bool]: - ''' + r''' Closes the target. If the target is a page that gets closed too. :param target_id: - :returns: + :returns: Always set to true. If an error occurs, the response indicates protocol error. ''' params: T_JSON_DICT = dict() params['targetId'] = target_id.to_json() @@ -193,7 +196,7 @@ def expose_dev_tools_protocol( target_id: TargetID, binding_name: typing.Optional[str] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Inject object to the target's main frame that provides a communication channel with browser target. @@ -219,24 +222,43 @@ def expose_dev_tools_protocol( json = yield cmd_dict -def create_browser_context() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,BrowserContextID]: - ''' +def create_browser_context( + dispose_on_detach: typing.Optional[bool] = None, + proxy_server: typing.Optional[str] = None, + proxy_bypass_list: typing.Optional[str] = None, + origins_with_universal_network_access: typing.Optional[typing.List[str]] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,browser.BrowserContextID]: + r''' Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one. **EXPERIMENTAL** + :param dispose_on_detach: *(Optional)* If specified, disposes this context when debugging session disconnects. + :param proxy_server: *(Optional)* Proxy server, similar to the one passed to --proxy-server + :param proxy_bypass_list: *(Optional)* Proxy bypass list, similar to the one passed to --proxy-bypass-list + :param origins_with_universal_network_access: *(Optional)* An optional list of origins to grant unlimited cross-origin access to. Parts of the URL other than those constituting origin are ignored. :returns: The id of the context created. ''' + params: T_JSON_DICT = dict() + if dispose_on_detach is not None: + params['disposeOnDetach'] = dispose_on_detach + if proxy_server is not None: + params['proxyServer'] = proxy_server + if proxy_bypass_list is not None: + params['proxyBypassList'] = proxy_bypass_list + if origins_with_universal_network_access is not None: + params['originsWithUniversalNetworkAccess'] = [i for i in origins_with_universal_network_access] cmd_dict: T_JSON_DICT = { 'method': 'Target.createBrowserContext', + 'params': params, } json = yield cmd_dict - return BrowserContextID.from_json(json['browserContextId']) + return browser.BrowserContextID.from_json(json['browserContextId']) -def get_browser_contexts() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[BrowserContextID]]: - ''' +def get_browser_contexts() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[browser.BrowserContextID]]: + r''' Returns all browser contexts created with ``Target.createBrowserContext`` method. **EXPERIMENTAL** @@ -247,25 +269,25 @@ def get_browser_contexts() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Li 'method': 'Target.getBrowserContexts', } json = yield cmd_dict - return [BrowserContextID.from_json(i) for i in json['browserContextIds']] + return [browser.BrowserContextID.from_json(i) for i in json['browserContextIds']] def create_target( url: str, width: typing.Optional[int] = None, height: typing.Optional[int] = None, - browser_context_id: typing.Optional[BrowserContextID] = None, + browser_context_id: typing.Optional[browser.BrowserContextID] = None, enable_begin_frame_control: typing.Optional[bool] = None, new_window: typing.Optional[bool] = None, background: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,TargetID]: - ''' + r''' Creates a new page. - :param url: The initial URL the page will be navigated to. + :param url: The initial URL the page will be navigated to. An empty string indicates about:blank. :param width: *(Optional)* Frame width in DIP (headless chrome only). :param height: *(Optional)* Frame height in DIP (headless chrome only). - :param browser_context_id: *(Optional)* The browser context to create the page in. + :param browser_context_id: **(EXPERIMENTAL)** *(Optional)* The browser context to create the page in. :param enable_begin_frame_control: **(EXPERIMENTAL)** *(Optional)* Whether BeginFrames for this target will be controlled via DevTools (headless chrome only, not supported on MacOS yet, false by default). :param new_window: *(Optional)* Whether to create a new Window or Tab (chrome-only, false by default). :param background: *(Optional)* Whether to create the target in background or foreground (chrome-only, false by default). @@ -297,7 +319,7 @@ def detach_from_target( session_id: typing.Optional[SessionID] = None, target_id: typing.Optional[TargetID] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Detaches session with given id. :param session_id: *(Optional)* Session to detach. @@ -316,9 +338,9 @@ def detach_from_target( def dispose_browser_context( - browser_context_id: BrowserContextID + browser_context_id: browser.BrowserContextID ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks. @@ -338,7 +360,7 @@ def dispose_browser_context( def get_target_info( target_id: typing.Optional[TargetID] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,TargetInfo]: - ''' + r''' Returns information about a target. **EXPERIMENTAL** @@ -358,7 +380,7 @@ def get_target_info( def get_targets() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[TargetInfo]]: - ''' + r''' Retrieves a list of available targets. :returns: The list of targets. @@ -370,13 +392,18 @@ def get_targets() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Target return [TargetInfo.from_json(i) for i in json['targetInfos']] +@deprecated(version="1.3") def send_message_to_target( message: str, session_id: typing.Optional[SessionID] = None, target_id: typing.Optional[TargetID] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sends protocol message over session with given id. + Consider using flat mode instead; see commands attachToTarget, setAutoAttach, + and crbug.com/991325. + + .. deprecated:: 1.3 :param message: :param session_id: *(Optional)* Identifier of the session. @@ -400,16 +427,18 @@ def set_auto_attach( wait_for_debugger_on_start: bool, flatten: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Controls whether to automatically attach to new targets which are considered to be related to this one. When turned on, attaches to all existing related targets as well. When turned off, automatically detaches from all currently attached targets. + This also clears all targets added by ``autoAttachRelated`` from the list of targets to watch + for creation of related targets. **EXPERIMENTAL** :param auto_attach: Whether to auto-attach to related targets. :param wait_for_debugger_on_start: Whether to pause new targets when attaching to them. Use ```Runtime.runIfWaitingForDebugger``` to run paused targets. - :param flatten: **(EXPERIMENTAL)** *(Optional)* Enables "flat" access to the session via specifying sessionId attribute in the commands. + :param flatten: *(Optional)* Enables "flat" access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325. ''' params: T_JSON_DICT = dict() params['autoAttach'] = auto_attach @@ -423,10 +452,36 @@ def set_auto_attach( json = yield cmd_dict +def auto_attach_related( + target_id: TargetID, + wait_for_debugger_on_start: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Adds the specified target to the list of targets that will be monitored for any related target + creation (such as child frames, child workers and new versions of service worker) and reported + through ``attachedToTarget``. The specified target is also auto-attached. + This cancels the effect of any previous ``setAutoAttach`` and is also cancelled by subsequent + ``setAutoAttach``. Only available at the Browser target. + + **EXPERIMENTAL** + + :param target_id: + :param wait_for_debugger_on_start: Whether to pause new targets when attaching to them. Use ```Runtime.runIfWaitingForDebugger``` to run paused targets. + ''' + params: T_JSON_DICT = dict() + params['targetId'] = target_id.to_json() + params['waitForDebuggerOnStart'] = wait_for_debugger_on_start + cmd_dict: T_JSON_DICT = { + 'method': 'Target.autoAttachRelated', + 'params': params, + } + json = yield cmd_dict + + def set_discover_targets( discover: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Controls whether to discover available targets and notify via ``targetCreated/targetInfoChanged/targetDestroyed`` events. @@ -444,7 +499,7 @@ def set_discover_targets( def set_remote_locations( locations: typing.List[RemoteLocation] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enables target discovery for the specified locations, when ``setDiscoverTargets`` was set to ``true``. @@ -464,7 +519,7 @@ def set_remote_locations( @event_class('Target.attachedToTarget') @dataclass class AttachedToTarget: - ''' + r''' **EXPERIMENTAL** Issued when attached to target because of auto-attach or ``attachToTarget`` command. @@ -486,7 +541,7 @@ def from_json(cls, json: T_JSON_DICT) -> AttachedToTarget: @event_class('Target.detachedFromTarget') @dataclass class DetachedFromTarget: - ''' + r''' **EXPERIMENTAL** Issued when detached from target for any reason (including ``detachFromTarget`` command). Can be @@ -508,7 +563,7 @@ def from_json(cls, json: T_JSON_DICT) -> DetachedFromTarget: @event_class('Target.receivedMessageFromTarget') @dataclass class ReceivedMessageFromTarget: - ''' + r''' Notifies about a new protocol message received from the session (as reported in ``attachedToTarget`` event). ''' @@ -530,7 +585,7 @@ def from_json(cls, json: T_JSON_DICT) -> ReceivedMessageFromTarget: @event_class('Target.targetCreated') @dataclass class TargetCreated: - ''' + r''' Issued when a possible inspection target is created. ''' target_info: TargetInfo @@ -545,7 +600,7 @@ def from_json(cls, json: T_JSON_DICT) -> TargetCreated: @event_class('Target.targetDestroyed') @dataclass class TargetDestroyed: - ''' + r''' Issued when a target is destroyed. ''' target_id: TargetID @@ -560,7 +615,7 @@ def from_json(cls, json: T_JSON_DICT) -> TargetDestroyed: @event_class('Target.targetCrashed') @dataclass class TargetCrashed: - ''' + r''' Issued when a target has crashed. ''' target_id: TargetID @@ -581,7 +636,7 @@ def from_json(cls, json: T_JSON_DICT) -> TargetCrashed: @event_class('Target.targetInfoChanged') @dataclass class TargetInfoChanged: - ''' + r''' Issued when some information about a target has changed. This only happens between ``targetCreated`` and ``targetDestroyed``. ''' diff --git a/cdp/tethering.py b/cdp/tethering.py index 5ca8510..7878397 100644 --- a/cdp/tethering.py +++ b/cdp/tethering.py @@ -15,7 +15,7 @@ def bind( port: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Request browser port binding. :param port: Port number to bind. @@ -32,7 +32,7 @@ def bind( def unbind( port: int ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Request browser port unbinding. :param port: Port number to unbind. @@ -49,7 +49,7 @@ def unbind( @event_class('Tethering.accepted') @dataclass class Accepted: - ''' + r''' Informs that port was successfully bound and got a specified connection id. ''' #: Port number that was successfully bound. diff --git a/cdp/tracing.py b/cdp/tracing.py index 475751b..fb0b925 100644 --- a/cdp/tracing.py +++ b/cdp/tracing.py @@ -15,7 +15,7 @@ class MemoryDumpConfig(dict): - ''' + r''' Configuration for memory dump. Used only when "memory-infra" category is enabled. ''' def to_json(self) -> dict: @@ -90,7 +90,7 @@ def from_json(cls, json: T_JSON_DICT) -> TraceConfig: class StreamFormat(enum.Enum): - ''' + r''' Data format of a trace. Can be either the legacy JSON format or the protocol buffer format. Note that the JSON format will be deprecated soon. ''' @@ -106,7 +106,7 @@ def from_json(cls, json: str) -> StreamFormat: class StreamCompression(enum.Enum): - ''' + r''' Compression type to use for traces returned via streams. ''' NONE = "none" @@ -120,8 +120,46 @@ def from_json(cls, json: str) -> StreamCompression: return cls(json) -def end() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: +class MemoryDumpLevelOfDetail(enum.Enum): + r''' + Details exposed when memory request explicitly declared. + Keep consistent with memory_dump_request_args.h and + memory_instrumentation.mojom ''' + BACKGROUND = "background" + LIGHT = "light" + DETAILED = "detailed" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> MemoryDumpLevelOfDetail: + return cls(json) + + +class TracingBackend(enum.Enum): + r''' + Backend type to use for tracing. ``chrome`` uses the Chrome-integrated + tracing service and is supported on all platforms. ``system`` is only + supported on Chrome OS and uses the Perfetto system tracing service. + ``auto`` chooses ``system`` when the perfettoConfig provided to Tracing.start + specifies at least one non-Chrome data source; otherwise uses ``chrome``. + ''' + AUTO = "auto" + CHROME = "chrome" + SYSTEM = "system" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> TracingBackend: + return cls(json) + + +def end() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Stop trace events collection. ''' cmd_dict: T_JSON_DICT = { @@ -131,7 +169,7 @@ def end() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_categories() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Gets supported tracing categories. :returns: A list of supported tracing categories. @@ -146,7 +184,7 @@ def get_categories() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str def record_clock_sync_marker( sync_id: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Record a clock sync marker in the trace. :param sync_id: The ID of this clock sync marker @@ -160,17 +198,28 @@ def record_clock_sync_marker( json = yield cmd_dict -def request_memory_dump() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, bool]]: - ''' +def request_memory_dump( + deterministic: typing.Optional[bool] = None, + level_of_detail: typing.Optional[MemoryDumpLevelOfDetail] = None + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[str, bool]]: + r''' Request a global memory dump. + :param deterministic: *(Optional)* Enables more deterministic results by forcing garbage collection + :param level_of_detail: *(Optional)* Specifies level of details in memory dump. Defaults to "detailed". :returns: A tuple with the following items: 0. **dumpGuid** - GUID of the resulting global memory dump. 1. **success** - True iff the global memory dump succeeded. ''' + params: T_JSON_DICT = dict() + if deterministic is not None: + params['deterministic'] = deterministic + if level_of_detail is not None: + params['levelOfDetail'] = level_of_detail.to_json() cmd_dict: T_JSON_DICT = { 'method': 'Tracing.requestMemoryDump', + 'params': params, } json = yield cmd_dict return ( @@ -186,9 +235,11 @@ def start( transfer_mode: typing.Optional[str] = None, stream_format: typing.Optional[StreamFormat] = None, stream_compression: typing.Optional[StreamCompression] = None, - trace_config: typing.Optional[TraceConfig] = None + trace_config: typing.Optional[TraceConfig] = None, + perfetto_config: typing.Optional[str] = None, + tracing_backend: typing.Optional[TracingBackend] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Start trace events collection. :param categories: **(DEPRECATED)** *(Optional)* Category/tag filter @@ -196,8 +247,10 @@ def start( :param buffer_usage_reporting_interval: *(Optional)* If set, the agent will issue bufferUsage events at this interval, specified in milliseconds :param transfer_mode: *(Optional)* Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to ```ReportEvents````). :param stream_format: *(Optional)* Trace data format to use. This only applies when using ````ReturnAsStream```` transfer mode (defaults to ````json````). - :param stream_compression: *(Optional)* Compression format to use. This only applies when using ````ReturnAsStream```` transfer mode (defaults to ````none```) + :param stream_compression: *(Optional)* Compression format to use. This only applies when using ````ReturnAsStream```` transfer mode (defaults to ````none````) :param trace_config: *(Optional)* + :param perfetto_config: *(Optional)* Base64-encoded serialized perfetto.protos.TraceConfig protobuf message When specified, the parameters ````categories````, ````options````, ````traceConfig```` are ignored. (Encoded as a base64 string when passed over JSON) + :param tracing_backend: *(Optional)* Backend type (defaults to ````auto```) ''' params: T_JSON_DICT = dict() if categories is not None: @@ -214,6 +267,10 @@ def start( params['streamCompression'] = stream_compression.to_json() if trace_config is not None: params['traceConfig'] = trace_config.to_json() + if perfetto_config is not None: + params['perfettoConfig'] = perfetto_config + if tracing_backend is not None: + params['tracingBackend'] = tracing_backend.to_json() cmd_dict: T_JSON_DICT = { 'method': 'Tracing.start', 'params': params, @@ -245,7 +302,7 @@ def from_json(cls, json: T_JSON_DICT) -> BufferUsage: @event_class('Tracing.dataCollected') @dataclass class DataCollected: - ''' + r''' Contains an bucket of collected trace events. When tracing is stopped collected events will be send as a sequence of dataCollected events followed by tracingComplete event. ''' @@ -261,7 +318,7 @@ def from_json(cls, json: T_JSON_DICT) -> DataCollected: @event_class('Tracing.tracingComplete') @dataclass class TracingComplete: - ''' + r''' Signals that tracing is stopped and there is no trace buffers pending flush, all data were delivered via dataCollected events. ''' diff --git a/cdp/web_audio.py b/cdp/web_audio.py index 1daee6d..2dbca42 100644 --- a/cdp/web_audio.py +++ b/cdp/web_audio.py @@ -12,23 +12,23 @@ import typing -class ContextId(str): - ''' - Context's UUID in string +class GraphObjectId(str): + r''' + An unique ID for a graph object (AudioContext, AudioNode, AudioParam) in Web Audio API ''' def to_json(self) -> str: return self @classmethod - def from_json(cls, json: str) -> ContextId: + def from_json(cls, json: str) -> GraphObjectId: return cls(json) def __repr__(self): - return 'ContextId({})'.format(super().__repr__()) + return 'GraphObjectId({})'.format(super().__repr__()) class ContextType(enum.Enum): - ''' + r''' Enum of BaseAudioContext types ''' REALTIME = "realtime" @@ -43,7 +43,7 @@ def from_json(cls, json: str) -> ContextType: class ContextState(enum.Enum): - ''' + r''' Enum of AudioContextState from the spec ''' SUSPENDED = "suspended" @@ -58,15 +58,91 @@ def from_json(cls, json: str) -> ContextState: return cls(json) +class NodeType(str): + r''' + Enum of AudioNode types + ''' + def to_json(self) -> str: + return self + + @classmethod + def from_json(cls, json: str) -> NodeType: + return cls(json) + + def __repr__(self): + return 'NodeType({})'.format(super().__repr__()) + + +class ChannelCountMode(enum.Enum): + r''' + Enum of AudioNode::ChannelCountMode from the spec + ''' + CLAMPED_MAX = "clamped-max" + EXPLICIT = "explicit" + MAX_ = "max" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ChannelCountMode: + return cls(json) + + +class ChannelInterpretation(enum.Enum): + r''' + Enum of AudioNode::ChannelInterpretation from the spec + ''' + DISCRETE = "discrete" + SPEAKERS = "speakers" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> ChannelInterpretation: + return cls(json) + + +class ParamType(str): + r''' + Enum of AudioParam types + ''' + def to_json(self) -> str: + return self + + @classmethod + def from_json(cls, json: str) -> ParamType: + return cls(json) + + def __repr__(self): + return 'ParamType({})'.format(super().__repr__()) + + +class AutomationRate(enum.Enum): + r''' + Enum of AudioParam::AutomationRate from the spec + ''' + A_RATE = "a-rate" + K_RATE = "k-rate" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> AutomationRate: + return cls(json) + + @dataclass class ContextRealtimeData: - ''' + r''' Fields in AudioContext that change in real-time. ''' #: The current context time in second in BaseAudioContext. current_time: float - #: The time spent on rendering graph divided by render qunatum duration, + #: The time spent on rendering graph divided by render quantum duration, #: and multiplied by 100. 100 means the audio renderer reached the full #: capacity and glitch may occur. render_capacity: float @@ -97,10 +173,10 @@ def from_json(cls, json: T_JSON_DICT) -> ContextRealtimeData: @dataclass class BaseAudioContext: - ''' + r''' Protocol object for BaseAudioContext ''' - context_id: ContextId + context_id: GraphObjectId context_type: ContextType @@ -132,7 +208,7 @@ def to_json(self) -> T_JSON_DICT: @classmethod def from_json(cls, json: T_JSON_DICT) -> BaseAudioContext: return cls( - context_id=ContextId.from_json(json['contextId']), + context_id=GraphObjectId.from_json(json['contextId']), context_type=ContextType.from_json(json['contextType']), context_state=ContextState.from_json(json['contextState']), callback_buffer_size=float(json['callbackBufferSize']), @@ -142,8 +218,125 @@ def from_json(cls, json: T_JSON_DICT) -> BaseAudioContext: ) -def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: +@dataclass +class AudioListener: + r''' + Protocol object for AudioListener + ''' + listener_id: GraphObjectId + + context_id: GraphObjectId + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['listenerId'] = self.listener_id.to_json() + json['contextId'] = self.context_id.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioListener: + return cls( + listener_id=GraphObjectId.from_json(json['listenerId']), + context_id=GraphObjectId.from_json(json['contextId']), + ) + + +@dataclass +class AudioNode: + r''' + Protocol object for AudioNode + ''' + node_id: GraphObjectId + + context_id: GraphObjectId + + node_type: NodeType + + number_of_inputs: float + + number_of_outputs: float + + channel_count: float + + channel_count_mode: ChannelCountMode + + channel_interpretation: ChannelInterpretation + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['nodeId'] = self.node_id.to_json() + json['contextId'] = self.context_id.to_json() + json['nodeType'] = self.node_type.to_json() + json['numberOfInputs'] = self.number_of_inputs + json['numberOfOutputs'] = self.number_of_outputs + json['channelCount'] = self.channel_count + json['channelCountMode'] = self.channel_count_mode.to_json() + json['channelInterpretation'] = self.channel_interpretation.to_json() + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioNode: + return cls( + node_id=GraphObjectId.from_json(json['nodeId']), + context_id=GraphObjectId.from_json(json['contextId']), + node_type=NodeType.from_json(json['nodeType']), + number_of_inputs=float(json['numberOfInputs']), + number_of_outputs=float(json['numberOfOutputs']), + channel_count=float(json['channelCount']), + channel_count_mode=ChannelCountMode.from_json(json['channelCountMode']), + channel_interpretation=ChannelInterpretation.from_json(json['channelInterpretation']), + ) + + +@dataclass +class AudioParam: + r''' + Protocol object for AudioParam ''' + param_id: GraphObjectId + + node_id: GraphObjectId + + context_id: GraphObjectId + + param_type: ParamType + + rate: AutomationRate + + default_value: float + + min_value: float + + max_value: float + + def to_json(self) -> T_JSON_DICT: + json: T_JSON_DICT = dict() + json['paramId'] = self.param_id.to_json() + json['nodeId'] = self.node_id.to_json() + json['contextId'] = self.context_id.to_json() + json['paramType'] = self.param_type.to_json() + json['rate'] = self.rate.to_json() + json['defaultValue'] = self.default_value + json['minValue'] = self.min_value + json['maxValue'] = self.max_value + return json + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioParam: + return cls( + param_id=GraphObjectId.from_json(json['paramId']), + node_id=GraphObjectId.from_json(json['nodeId']), + context_id=GraphObjectId.from_json(json['contextId']), + param_type=ParamType.from_json(json['paramType']), + rate=AutomationRate.from_json(json['rate']), + default_value=float(json['defaultValue']), + min_value=float(json['minValue']), + max_value=float(json['maxValue']), + ) + + +def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' Enables the WebAudio domain and starts sending context lifetime events. ''' cmd_dict: T_JSON_DICT = { @@ -153,7 +346,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables the WebAudio domain. ''' cmd_dict: T_JSON_DICT = { @@ -163,9 +356,9 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def get_realtime_data( - context_id: ContextId + context_id: GraphObjectId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,ContextRealtimeData]: - ''' + r''' Fetch the realtime data from the registered contexts. :param context_id: @@ -184,7 +377,7 @@ def get_realtime_data( @event_class('WebAudio.contextCreated') @dataclass class ContextCreated: - ''' + r''' Notifies that a new BaseAudioContext has been created. ''' context: BaseAudioContext @@ -196,25 +389,25 @@ def from_json(cls, json: T_JSON_DICT) -> ContextCreated: ) -@event_class('WebAudio.contextDestroyed') +@event_class('WebAudio.contextWillBeDestroyed') @dataclass -class ContextDestroyed: - ''' - Notifies that existing BaseAudioContext has been destroyed. +class ContextWillBeDestroyed: + r''' + Notifies that an existing BaseAudioContext will be destroyed. ''' - context_id: ContextId + context_id: GraphObjectId @classmethod - def from_json(cls, json: T_JSON_DICT) -> ContextDestroyed: + def from_json(cls, json: T_JSON_DICT) -> ContextWillBeDestroyed: return cls( - context_id=ContextId.from_json(json['contextId']) + context_id=GraphObjectId.from_json(json['contextId']) ) @event_class('WebAudio.contextChanged') @dataclass class ContextChanged: - ''' + r''' Notifies that existing BaseAudioContext has changed some properties (id stays the same).. ''' context: BaseAudioContext @@ -224,3 +417,189 @@ def from_json(cls, json: T_JSON_DICT) -> ContextChanged: return cls( context=BaseAudioContext.from_json(json['context']) ) + + +@event_class('WebAudio.audioListenerCreated') +@dataclass +class AudioListenerCreated: + r''' + Notifies that the construction of an AudioListener has finished. + ''' + listener: AudioListener + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioListenerCreated: + return cls( + listener=AudioListener.from_json(json['listener']) + ) + + +@event_class('WebAudio.audioListenerWillBeDestroyed') +@dataclass +class AudioListenerWillBeDestroyed: + r''' + Notifies that a new AudioListener has been created. + ''' + context_id: GraphObjectId + listener_id: GraphObjectId + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioListenerWillBeDestroyed: + return cls( + context_id=GraphObjectId.from_json(json['contextId']), + listener_id=GraphObjectId.from_json(json['listenerId']) + ) + + +@event_class('WebAudio.audioNodeCreated') +@dataclass +class AudioNodeCreated: + r''' + Notifies that a new AudioNode has been created. + ''' + node: AudioNode + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioNodeCreated: + return cls( + node=AudioNode.from_json(json['node']) + ) + + +@event_class('WebAudio.audioNodeWillBeDestroyed') +@dataclass +class AudioNodeWillBeDestroyed: + r''' + Notifies that an existing AudioNode has been destroyed. + ''' + context_id: GraphObjectId + node_id: GraphObjectId + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioNodeWillBeDestroyed: + return cls( + context_id=GraphObjectId.from_json(json['contextId']), + node_id=GraphObjectId.from_json(json['nodeId']) + ) + + +@event_class('WebAudio.audioParamCreated') +@dataclass +class AudioParamCreated: + r''' + Notifies that a new AudioParam has been created. + ''' + param: AudioParam + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioParamCreated: + return cls( + param=AudioParam.from_json(json['param']) + ) + + +@event_class('WebAudio.audioParamWillBeDestroyed') +@dataclass +class AudioParamWillBeDestroyed: + r''' + Notifies that an existing AudioParam has been destroyed. + ''' + context_id: GraphObjectId + node_id: GraphObjectId + param_id: GraphObjectId + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> AudioParamWillBeDestroyed: + return cls( + context_id=GraphObjectId.from_json(json['contextId']), + node_id=GraphObjectId.from_json(json['nodeId']), + param_id=GraphObjectId.from_json(json['paramId']) + ) + + +@event_class('WebAudio.nodesConnected') +@dataclass +class NodesConnected: + r''' + Notifies that two AudioNodes are connected. + ''' + context_id: GraphObjectId + source_id: GraphObjectId + destination_id: GraphObjectId + source_output_index: typing.Optional[float] + destination_input_index: typing.Optional[float] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> NodesConnected: + return cls( + context_id=GraphObjectId.from_json(json['contextId']), + source_id=GraphObjectId.from_json(json['sourceId']), + destination_id=GraphObjectId.from_json(json['destinationId']), + source_output_index=float(json['sourceOutputIndex']) if 'sourceOutputIndex' in json else None, + destination_input_index=float(json['destinationInputIndex']) if 'destinationInputIndex' in json else None + ) + + +@event_class('WebAudio.nodesDisconnected') +@dataclass +class NodesDisconnected: + r''' + Notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected. + ''' + context_id: GraphObjectId + source_id: GraphObjectId + destination_id: GraphObjectId + source_output_index: typing.Optional[float] + destination_input_index: typing.Optional[float] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> NodesDisconnected: + return cls( + context_id=GraphObjectId.from_json(json['contextId']), + source_id=GraphObjectId.from_json(json['sourceId']), + destination_id=GraphObjectId.from_json(json['destinationId']), + source_output_index=float(json['sourceOutputIndex']) if 'sourceOutputIndex' in json else None, + destination_input_index=float(json['destinationInputIndex']) if 'destinationInputIndex' in json else None + ) + + +@event_class('WebAudio.nodeParamConnected') +@dataclass +class NodeParamConnected: + r''' + Notifies that an AudioNode is connected to an AudioParam. + ''' + context_id: GraphObjectId + source_id: GraphObjectId + destination_id: GraphObjectId + source_output_index: typing.Optional[float] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> NodeParamConnected: + return cls( + context_id=GraphObjectId.from_json(json['contextId']), + source_id=GraphObjectId.from_json(json['sourceId']), + destination_id=GraphObjectId.from_json(json['destinationId']), + source_output_index=float(json['sourceOutputIndex']) if 'sourceOutputIndex' in json else None + ) + + +@event_class('WebAudio.nodeParamDisconnected') +@dataclass +class NodeParamDisconnected: + r''' + Notifies that an AudioNode is disconnected to an AudioParam. + ''' + context_id: GraphObjectId + source_id: GraphObjectId + destination_id: GraphObjectId + source_output_index: typing.Optional[float] + + @classmethod + def from_json(cls, json: T_JSON_DICT) -> NodeParamDisconnected: + return cls( + context_id=GraphObjectId.from_json(json['contextId']), + source_id=GraphObjectId.from_json(json['sourceId']), + destination_id=GraphObjectId.from_json(json['destinationId']), + source_output_index=float(json['sourceOutputIndex']) if 'sourceOutputIndex' in json else None + ) diff --git a/cdp/web_authn.py b/cdp/web_authn.py index 595b865..e9d5df9 100644 --- a/cdp/web_authn.py +++ b/cdp/web_authn.py @@ -36,6 +36,18 @@ def from_json(cls, json: str) -> AuthenticatorProtocol: return cls(json) +class Ctap2Version(enum.Enum): + CTAP2_0 = "ctap2_0" + CTAP2_1 = "ctap2_1" + + def to_json(self) -> str: + return self.value + + @classmethod + def from_json(cls, json: str) -> Ctap2Version: + return cls(json) + + class AuthenticatorTransport(enum.Enum): USB = "usb" NFC = "nfc" @@ -57,22 +69,58 @@ class VirtualAuthenticatorOptions: transport: AuthenticatorTransport - has_resident_key: bool + #: Defaults to ctap2_0. Ignored if ``protocol`` == u2f. + ctap2_version: typing.Optional[Ctap2Version] = None - has_user_verification: bool + #: Defaults to false. + has_resident_key: typing.Optional[bool] = None + + #: Defaults to false. + has_user_verification: typing.Optional[bool] = None + + #: If set to true, the authenticator will support the largeBlob extension. + #: https://w3c.github.io/webauthn#largeBlob + #: Defaults to false. + has_large_blob: typing.Optional[bool] = None + + #: If set to true, the authenticator will support the credBlob extension. + #: https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension + #: Defaults to false. + has_cred_blob: typing.Optional[bool] = None + + #: If set to true, the authenticator will support the minPinLength extension. + #: https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension + #: Defaults to false. + has_min_pin_length: typing.Optional[bool] = None #: If set to true, tests of user presence will succeed immediately. #: Otherwise, they will not be resolved. Defaults to true. automatic_presence_simulation: typing.Optional[bool] = None + #: Sets whether User Verification succeeds or fails for an authenticator. + #: Defaults to false. + is_user_verified: typing.Optional[bool] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['protocol'] = self.protocol.to_json() json['transport'] = self.transport.to_json() - json['hasResidentKey'] = self.has_resident_key - json['hasUserVerification'] = self.has_user_verification + if self.ctap2_version is not None: + json['ctap2Version'] = self.ctap2_version.to_json() + if self.has_resident_key is not None: + json['hasResidentKey'] = self.has_resident_key + if self.has_user_verification is not None: + json['hasUserVerification'] = self.has_user_verification + if self.has_large_blob is not None: + json['hasLargeBlob'] = self.has_large_blob + if self.has_cred_blob is not None: + json['hasCredBlob'] = self.has_cred_blob + if self.has_min_pin_length is not None: + json['hasMinPinLength'] = self.has_min_pin_length if self.automatic_presence_simulation is not None: json['automaticPresenceSimulation'] = self.automatic_presence_simulation + if self.is_user_verified is not None: + json['isUserVerified'] = self.is_user_verified return json @classmethod @@ -80,9 +128,14 @@ def from_json(cls, json: T_JSON_DICT) -> VirtualAuthenticatorOptions: return cls( protocol=AuthenticatorProtocol.from_json(json['protocol']), transport=AuthenticatorTransport.from_json(json['transport']), - has_resident_key=bool(json['hasResidentKey']), - has_user_verification=bool(json['hasUserVerification']), + ctap2_version=Ctap2Version.from_json(json['ctap2Version']) if 'ctap2Version' in json else None, + has_resident_key=bool(json['hasResidentKey']) if 'hasResidentKey' in json else None, + has_user_verification=bool(json['hasUserVerification']) if 'hasUserVerification' in json else None, + has_large_blob=bool(json['hasLargeBlob']) if 'hasLargeBlob' in json else None, + has_cred_blob=bool(json['hasCredBlob']) if 'hasCredBlob' in json else None, + has_min_pin_length=bool(json['hasMinPinLength']) if 'hasMinPinLength' in json else None, automatic_presence_simulation=bool(json['automaticPresenceSimulation']) if 'automaticPresenceSimulation' in json else None, + is_user_verified=bool(json['isUserVerified']) if 'isUserVerified' in json else None, ) @@ -90,12 +143,9 @@ def from_json(cls, json: T_JSON_DICT) -> VirtualAuthenticatorOptions: class Credential: credential_id: str - #: SHA-256 hash of the Relying Party ID the credential is scoped to. Must - #: be 32 bytes long. - #: See https://w3c.github.io/webauthn/#rpidhash - rp_id_hash: str + is_resident_credential: bool - #: The private key in PKCS#8 format. + #: The ECDSA P-256 private key in PKCS#8 format. (Encoded as a base64 string when passed over JSON) private_key: str #: Signature counter. This is incremented by one for each successful @@ -103,26 +153,47 @@ class Credential: #: See https://w3c.github.io/webauthn/#signature-counter sign_count: int + #: Relying Party ID the credential is scoped to. Must be set when adding a + #: credential. + rp_id: typing.Optional[str] = None + + #: An opaque byte sequence with a maximum size of 64 bytes mapping the + #: credential to a specific user. (Encoded as a base64 string when passed over JSON) + user_handle: typing.Optional[str] = None + + #: The large blob associated with the credential. + #: See https://w3c.github.io/webauthn/#sctn-large-blob-extension (Encoded as a base64 string when passed over JSON) + large_blob: typing.Optional[str] = None + def to_json(self) -> T_JSON_DICT: json: T_JSON_DICT = dict() json['credentialId'] = self.credential_id - json['rpIdHash'] = self.rp_id_hash + json['isResidentCredential'] = self.is_resident_credential json['privateKey'] = self.private_key json['signCount'] = self.sign_count + if self.rp_id is not None: + json['rpId'] = self.rp_id + if self.user_handle is not None: + json['userHandle'] = self.user_handle + if self.large_blob is not None: + json['largeBlob'] = self.large_blob return json @classmethod def from_json(cls, json: T_JSON_DICT) -> Credential: return cls( credential_id=str(json['credentialId']), - rp_id_hash=str(json['rpIdHash']), + is_resident_credential=bool(json['isResidentCredential']), private_key=str(json['privateKey']), sign_count=int(json['signCount']), + rp_id=str(json['rpId']) if 'rpId' in json else None, + user_handle=str(json['userHandle']) if 'userHandle' in json else None, + large_blob=str(json['largeBlob']) if 'largeBlob' in json else None, ) def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Enable the WebAuthn domain and start intercepting credential storage and retrieval with a virtual authenticator. ''' @@ -133,7 +204,7 @@ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disable the WebAuthn domain. ''' cmd_dict: T_JSON_DICT = { @@ -145,7 +216,7 @@ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: def add_virtual_authenticator( options: VirtualAuthenticatorOptions ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,AuthenticatorId]: - ''' + r''' Creates and adds a virtual authenticator. :param options: @@ -164,7 +235,7 @@ def add_virtual_authenticator( def remove_virtual_authenticator( authenticator_id: AuthenticatorId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Removes the given authenticator. :param authenticator_id: @@ -182,7 +253,7 @@ def add_credential( authenticator_id: AuthenticatorId, credential: Credential ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Adds the credential to the specified authenticator. :param authenticator_id: @@ -198,10 +269,33 @@ def add_credential( json = yield cmd_dict +def get_credential( + authenticator_id: AuthenticatorId, + credential_id: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Credential]: + r''' + Returns a single credential stored in the given virtual authenticator that + matches the credential ID. + + :param authenticator_id: + :param credential_id: + :returns: + ''' + params: T_JSON_DICT = dict() + params['authenticatorId'] = authenticator_id.to_json() + params['credentialId'] = credential_id + cmd_dict: T_JSON_DICT = { + 'method': 'WebAuthn.getCredential', + 'params': params, + } + json = yield cmd_dict + return Credential.from_json(json['credential']) + + def get_credentials( authenticator_id: AuthenticatorId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Credential]]: - ''' + r''' Returns all the credentials stored in the given virtual authenticator. :param authenticator_id: @@ -217,10 +311,30 @@ def get_credentials( return [Credential.from_json(i) for i in json['credentials']] +def remove_credential( + authenticator_id: AuthenticatorId, + credential_id: str + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Removes a credential from the authenticator. + + :param authenticator_id: + :param credential_id: + ''' + params: T_JSON_DICT = dict() + params['authenticatorId'] = authenticator_id.to_json() + params['credentialId'] = credential_id + cmd_dict: T_JSON_DICT = { + 'method': 'WebAuthn.removeCredential', + 'params': params, + } + json = yield cmd_dict + + def clear_credentials( authenticator_id: AuthenticatorId ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Clears all the credentials from the specified device. :param authenticator_id: @@ -238,7 +352,7 @@ def set_user_verified( authenticator_id: AuthenticatorId, is_user_verified: bool ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Sets whether User Verification succeeds or fails for an authenticator. The default is true. @@ -253,3 +367,24 @@ def set_user_verified( 'params': params, } json = yield cmd_dict + + +def set_automatic_presence_simulation( + authenticator_id: AuthenticatorId, + enabled: bool + ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: + r''' + Sets whether tests of user presence will succeed immediately (if true) or fail to resolve (if false) for an authenticator. + The default is true. + + :param authenticator_id: + :param enabled: + ''' + params: T_JSON_DICT = dict() + params['authenticatorId'] = authenticator_id.to_json() + params['enabled'] = enabled + cmd_dict: T_JSON_DICT = { + 'method': 'WebAuthn.setAutomaticPresenceSimulation', + 'params': params, + } + json = yield cmd_dict diff --git a/docs/api/accessibility.rst b/docs/api/accessibility.rst index 078bd80..6a8a0b3 100644 --- a/docs/api/accessibility.rst +++ b/docs/api/accessibility.rst @@ -83,11 +83,31 @@ to. For more information, see .. autofunction:: enable +.. autofunction:: get_ax_node_and_ancestors + +.. autofunction:: get_child_ax_nodes + .. autofunction:: get_full_ax_tree .. autofunction:: get_partial_ax_tree +.. autofunction:: get_root_ax_node + +.. autofunction:: query_ax_tree + Events ------ -*There are no events in this module.* +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. + +.. autoclass:: LoadComplete + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: NodesUpdated + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/audits.rst b/docs/api/audits.rst index d375a7a..aa47cc7 100644 --- a/docs/api/audits.rst +++ b/docs/api/audits.rst @@ -14,7 +14,200 @@ Audits domain allows investigation of page violations and possible improvements. Types ----- -*There are no types in this module.* +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. + +.. autoclass:: AffectedCookie + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AffectedRequest + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AffectedFrame + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SameSiteCookieExclusionReason + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SameSiteCookieWarningReason + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SameSiteCookieOperation + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SameSiteCookieIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: MixedContentResolutionStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: MixedContentResourceType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: MixedContentIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BlockedByResponseReason + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BlockedByResponseIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: HeavyAdResolutionStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: HeavyAdReason + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: HeavyAdIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ContentSecurityPolicyViolationType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SourceCodeLocation + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ContentSecurityPolicyIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SharedArrayBufferIssueType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SharedArrayBufferIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: TwaQualityEnforcementViolationType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: TrustedWebActivityIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: LowTextContrastIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CorsIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AttributionReportingIssueType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AttributionReportingIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: QuirksModeIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: NavigatorUserAgentIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: WasmCrossOriginModuleSharingIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: GenericIssueErrorType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: GenericIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: DeprecationIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ClientHintIssueReason + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ClientHintIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: InspectorIssueCode + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: InspectorIssueDetails + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: IssueId + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: InspectorIssue + :members: + :undoc-members: + :exclude-members: from_json, to_json Commands -------- @@ -28,9 +221,22 @@ commands, and ``z`` is the return type you should pay attention to. For more information, see :ref:`Getting Started: Commands `. +.. autofunction:: check_contrast + +.. autofunction:: disable + +.. autofunction:: enable + .. autofunction:: get_encoded_response Events ------ -*There are no events in this module.* +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. + +.. autoclass:: IssueAdded + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/browser.rst b/docs/api/browser.rst index ba64fe9..2257b14 100644 --- a/docs/api/browser.rst +++ b/docs/api/browser.rst @@ -17,6 +17,11 @@ 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. +.. autoclass:: BrowserContextID + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: WindowID :members: :undoc-members: @@ -37,6 +42,21 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: PermissionSetting + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PermissionDescriptor + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BrowserCommandId + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: Bucket :members: :undoc-members: @@ -59,12 +79,16 @@ commands, and ``z`` is the return type you should pay attention to. For more information, see :ref:`Getting Started: Commands `. +.. autofunction:: cancel_download + .. autofunction:: close .. autofunction:: crash .. autofunction:: crash_gpu_process +.. autofunction:: execute_browser_command + .. autofunction:: get_browser_command_line .. autofunction:: get_histogram @@ -83,9 +107,25 @@ to. For more information, see .. autofunction:: set_dock_tile +.. autofunction:: set_download_behavior + +.. autofunction:: set_permission + .. autofunction:: set_window_bounds Events ------ -*There are no events in this module.* +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. + +.. autoclass:: DownloadWillBegin + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: DownloadProgress + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/cast.rst b/docs/api/cast.rst index fba003b..e0e050e 100644 --- a/docs/api/cast.rst +++ b/docs/api/cast.rst @@ -43,6 +43,8 @@ to. For more information, see .. autofunction:: set_sink_to_use +.. autofunction:: start_desktop_mirroring + .. autofunction:: start_tab_mirroring .. autofunction:: stop_casting diff --git a/docs/api/css.rst b/docs/api/css.rst index f170a16..44581be 100644 --- a/docs/api/css.rst +++ b/docs/api/css.rst @@ -114,11 +114,21 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: CSSContainerQuery + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: PlatformFontUsage :members: :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: FontVariationAxis + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: FontFace :members: :undoc-members: @@ -177,10 +187,14 @@ to. For more information, see .. autofunction:: get_style_sheet_text +.. autofunction:: set_container_query_text + .. autofunction:: set_effective_property_value_for_node .. autofunction:: set_keyframe_key +.. autofunction:: set_local_fonts_enabled + .. autofunction:: set_media_text .. autofunction:: set_rule_selector @@ -193,8 +207,12 @@ to. For more information, see .. autofunction:: stop_rule_usage_tracking +.. autofunction:: take_computed_style_updates + .. autofunction:: take_coverage_delta +.. autofunction:: track_computed_style_updates + Events ------ diff --git a/docs/api/debugger.rst b/docs/api/debugger.rst index 611f717..caa81c3 100644 --- a/docs/api/debugger.rst +++ b/docs/api/debugger.rst @@ -38,6 +38,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: LocationRange + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: CallFrame :members: :undoc-members: @@ -58,6 +63,16 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: ScriptLanguage + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: DebugSymbols + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -84,6 +99,8 @@ to. For more information, see .. autofunction:: get_stack_trace +.. autofunction:: get_wasm_bytecode + .. autofunction:: pause .. autofunction:: pause_on_async_call diff --git a/docs/api/dom.rst b/docs/api/dom.rst index c677ffb..d629423 100644 --- a/docs/api/dom.rst +++ b/docs/api/dom.rst @@ -48,6 +48,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: CompatibilityMode + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: Node :members: :undoc-members: @@ -78,6 +83,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: CSSComputedStyleProperty + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -108,6 +118,8 @@ to. For more information, see .. autofunction:: get_box_model +.. autofunction:: get_container_for_node + .. autofunction:: get_content_quads .. autofunction:: get_document @@ -120,8 +132,14 @@ to. For more information, see .. autofunction:: get_node_for_location +.. autofunction:: get_node_stack_traces + +.. autofunction:: get_nodes_for_subtree_by_style + .. autofunction:: get_outer_html +.. autofunction:: get_querying_descendants_for_container + .. autofunction:: get_relayout_boundary .. autofunction:: get_search_results @@ -158,6 +176,8 @@ to. For more information, see .. autofunction:: resolve_node +.. autofunction:: scroll_into_view_if_needed + .. autofunction:: set_attribute_value .. autofunction:: set_attributes_as_text @@ -168,6 +188,8 @@ to. For more information, see .. autofunction:: set_node_name +.. autofunction:: set_node_stack_traces_enabled + .. autofunction:: set_node_value .. autofunction:: set_outer_html diff --git a/docs/api/dom_debugger.rst b/docs/api/dom_debugger.rst index 49a152c..4c5ec66 100644 --- a/docs/api/dom_debugger.rst +++ b/docs/api/dom_debugger.rst @@ -23,6 +23,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: CSPViolationType + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: EventListener :members: :undoc-members: @@ -50,6 +55,8 @@ to. For more information, see .. autofunction:: remove_xhr_breakpoint +.. autofunction:: set_break_on_csp_violation + .. autofunction:: set_dom_breakpoint .. autofunction:: set_event_listener_breakpoint diff --git a/docs/api/emulation.rst b/docs/api/emulation.rst index f66bea9..5abce21 100644 --- a/docs/api/emulation.rst +++ b/docs/api/emulation.rst @@ -22,11 +22,36 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: DisplayFeature + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: MediaFeature + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: VirtualTimePolicy :members: :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: UserAgentBrandVersion + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: UserAgentMetadata + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: DisabledImageType + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -45,24 +70,36 @@ to. For more information, see .. autofunction:: clear_geolocation_override +.. autofunction:: clear_idle_override + .. autofunction:: reset_page_scale_factor +.. autofunction:: set_auto_dark_mode_override + .. autofunction:: set_cpu_throttling_rate .. autofunction:: set_default_background_color_override .. autofunction:: set_device_metrics_override +.. autofunction:: set_disabled_image_types + .. autofunction:: set_document_cookie_disabled .. autofunction:: set_emit_touch_events_for_mouse .. autofunction:: set_emulated_media +.. autofunction:: set_emulated_vision_deficiency + .. autofunction:: set_focus_emulation_enabled .. autofunction:: set_geolocation_override +.. autofunction:: set_idle_override + +.. autofunction:: set_locale_override + .. autofunction:: set_navigator_overrides .. autofunction:: set_page_scale_factor diff --git a/docs/api/event_breakpoints.rst b/docs/api/event_breakpoints.rst new file mode 100644 index 0000000..af20be4 --- /dev/null +++ b/docs/api/event_breakpoints.rst @@ -0,0 +1,41 @@ +EventBreakpoints +================ + +EventBreakpoints permits setting breakpoints on particular operations and +events in targets that run JavaScript but do not have a DOM. +JavaScript execution will stop on these operations as if there was a regular +breakpoint set. + +*This CDP domain is experimental.* + +.. module:: cdp.event_breakpoints + +* Types_ +* Commands_ +* Events_ + +Types +----- + +*There are no types in this module.* + +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 +:ref:`Getting Started: Commands `. + +.. autofunction:: remove_instrumentation_breakpoint + +.. autofunction:: set_instrumentation_breakpoint + +Events +------ + +*There are no events in this module.* diff --git a/docs/api/fetch.rst b/docs/api/fetch.rst index beabe3a..b21b2d1 100644 --- a/docs/api/fetch.rst +++ b/docs/api/fetch.rst @@ -3,8 +3,6 @@ Fetch A domain for letting clients substitute browser's network layer with client code. -*This CDP domain is experimental.* - .. module:: cdp.fetch * Types_ @@ -63,6 +61,8 @@ to. For more information, see .. autofunction:: continue_request +.. autofunction:: continue_response + .. autofunction:: continue_with_auth .. autofunction:: disable diff --git a/docs/api/input_.rst b/docs/api/input_.rst index 8914793..cf8dff6 100644 --- a/docs/api/input_.rst +++ b/docs/api/input_.rst @@ -25,11 +25,26 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: MouseButton + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: TimeSinceEpoch :members: :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: DragDataItem + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: DragData + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -42,6 +57,8 @@ commands, and ``z`` is the return type you should pay attention to. For more information, see :ref:`Getting Started: Commands `. +.. autofunction:: dispatch_drag_event + .. autofunction:: dispatch_key_event .. autofunction:: dispatch_mouse_event @@ -50,10 +67,14 @@ to. For more information, see .. autofunction:: emulate_touch_from_mouse_event +.. autofunction:: ime_set_composition + .. autofunction:: insert_text .. autofunction:: set_ignore_input_events +.. autofunction:: set_intercept_drags + .. autofunction:: synthesize_pinch_gesture .. autofunction:: synthesize_scroll_gesture @@ -63,4 +84,11 @@ to. For more information, see Events ------ -*There are no events in this module.* +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. + +.. autoclass:: DragIntercepted + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/media.rst b/docs/api/media.rst new file mode 100644 index 0000000..a167f4e --- /dev/null +++ b/docs/api/media.rst @@ -0,0 +1,98 @@ +Media +===== + +This domain allows detailed inspection of media elements + +*This CDP domain is experimental.* + +.. module:: cdp.media + +* Types_ +* Commands_ +* Events_ + +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. + +.. autoclass:: PlayerId + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: Timestamp + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayerMessage + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayerProperty + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayerEvent + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayerError + :members: + :undoc-members: + :exclude-members: from_json, to_json + +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 +:ref:`Getting Started: Commands `. + +.. autofunction:: disable + +.. autofunction:: enable + +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. + +.. autoclass:: PlayerPropertiesChanged + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayerEventsAdded + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayerMessagesLogged + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayerErrorsRaised + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PlayersCreated + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/network.rst b/docs/api/network.rst index b76bde4..025d6a3 100644 --- a/docs/api/network.rst +++ b/docs/api/network.rst @@ -68,6 +68,16 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: CookiePriority + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CookieSourceScheme + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: ResourceTiming :members: :undoc-members: @@ -78,6 +88,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: PostDataEntry + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: Request :members: :undoc-members: @@ -103,6 +118,31 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: CorsError + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CorsErrorStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ServiceWorkerResponseSource + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: TrustTokenParams + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: TrustTokenOperationType + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: Response :members: :undoc-members: @@ -208,6 +248,86 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: ContentEncoding + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PrivateNetworkRequestPolicy + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: IPAddressSpace + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ConnectTiming + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ClientSecurityState + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CrossOriginOpenerPolicyValue + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CrossOriginOpenerPolicyStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CrossOriginEmbedderPolicyValue + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CrossOriginEmbedderPolicyStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SecurityIsolationStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReportStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReportId + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReportingApiReport + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReportingApiEndpoint + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: LoadNetworkResourcePageResult + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: LoadNetworkResourceOptions + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -226,6 +346,8 @@ to. For more information, see .. autofunction:: can_emulate_network_conditions +.. autofunction:: clear_accepted_encodings_override + .. autofunction:: clear_browser_cache .. autofunction:: clear_browser_cookies @@ -240,6 +362,8 @@ to. For more information, see .. autofunction:: enable +.. autofunction:: enable_reporting_api + .. autofunction:: get_all_cookies .. autofunction:: get_certificate @@ -252,10 +376,18 @@ to. For more information, see .. autofunction:: get_response_body_for_interception +.. autofunction:: get_security_isolation_status + +.. autofunction:: load_network_resource + .. autofunction:: replay_xhr .. autofunction:: search_in_response_body +.. autofunction:: set_accepted_encodings + +.. autofunction:: set_attach_debug_stack + .. autofunction:: set_blocked_ur_ls .. autofunction:: set_bypass_service_worker @@ -266,8 +398,6 @@ to. For more information, see .. autofunction:: set_cookies -.. autofunction:: set_data_size_limits_for_test - .. autofunction:: set_extra_http_headers .. autofunction:: set_request_interception @@ -368,6 +498,21 @@ you use the event's attributes. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: WebTransportCreated + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: WebTransportConnectionEstablished + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: WebTransportClosed + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: RequestWillBeSentExtraInfo :members: :undoc-members: @@ -377,3 +522,43 @@ you use the event's attributes. :members: :undoc-members: :exclude-members: from_json, to_json + +.. autoclass:: TrustTokenOperationDone + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SubresourceWebBundleMetadataReceived + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SubresourceWebBundleMetadataError + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SubresourceWebBundleInnerResponseParsed + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SubresourceWebBundleInnerResponseError + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReportingApiReportAdded + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReportingApiReportUpdated + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReportingApiEndpointsChangedForOrigin + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/overlay.rst b/docs/api/overlay.rst index 7792e15..2e89767 100644 --- a/docs/api/overlay.rst +++ b/docs/api/overlay.rst @@ -19,11 +19,96 @@ 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. +.. autoclass:: SourceOrderConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: GridHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: FlexContainerHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: FlexItemHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: LineStyle + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BoxStyle + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ContrastAlgorithm + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: HighlightConfig :members: :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: ColorFormat + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: GridNodeHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: FlexNodeHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ScrollSnapContainerHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ScrollSnapHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: HingeConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ContainerQueryHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ContainerQueryContainerHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: IsolatedElementHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: IsolationModeHighlightConfig + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: InspectMode :members: :undoc-members: @@ -45,8 +130,12 @@ to. For more information, see .. autofunction:: enable +.. autofunction:: get_grid_highlight_objects_for_test + .. autofunction:: get_highlight_object_for_test +.. autofunction:: get_source_order_highlight_object_for_test + .. autofunction:: hide_highlight .. autofunction:: highlight_frame @@ -57,26 +146,42 @@ to. For more information, see .. autofunction:: highlight_rect +.. autofunction:: highlight_source_order + .. autofunction:: set_inspect_mode .. autofunction:: set_paused_in_debugger_message .. autofunction:: set_show_ad_highlights +.. autofunction:: set_show_container_query_overlays + .. autofunction:: set_show_debug_borders +.. autofunction:: set_show_flex_overlays + .. autofunction:: set_show_fps_counter +.. autofunction:: set_show_grid_overlays + +.. autofunction:: set_show_hinge + .. autofunction:: set_show_hit_test_borders +.. autofunction:: set_show_isolated_elements + .. autofunction:: set_show_layout_shift_regions .. autofunction:: set_show_paint_rects .. autofunction:: set_show_scroll_bottleneck_rects +.. autofunction:: set_show_scroll_snap_overlays + .. autofunction:: set_show_viewport_size_on_resize +.. autofunction:: set_show_web_vitals + Events ------ diff --git a/docs/api/page.rst b/docs/api/page.rst index 043a880..cdf7943 100644 --- a/docs/api/page.rst +++ b/docs/api/page.rst @@ -22,6 +22,86 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: AdFrameType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AdFrameExplanation + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AdFrameStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SecureContextType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CrossOriginIsolatedContextType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: GatedAPIFeatures + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PermissionsPolicyFeature + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PermissionsPolicyBlockReason + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PermissionsPolicyBlockLocator + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: PermissionsPolicyFeatureState + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: OriginTrialTokenStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: OriginTrialStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: OriginTrialUsageRestriction + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: OriginTrialToken + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: OriginTrialTokenWithStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: OriginTrial + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: Frame :members: :undoc-members: @@ -72,6 +152,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: AppManifestParsedProperties + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: LayoutViewport :members: :undoc-members: @@ -102,6 +187,56 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: ClientNavigationDisposition + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: InstallabilityErrorArgument + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: InstallabilityError + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ReferrerPolicy + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: CompilationCacheParams + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: NavigationType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BackForwardCacheNotRestoredReason + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BackForwardCacheNotRestoredReasonType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BackForwardCacheNotRestoredExplanation + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: BackForwardCacheNotRestoredExplanationTree + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -148,6 +283,8 @@ to. For more information, see .. autofunction:: generate_test_report +.. autofunction:: get_app_id + .. autofunction:: get_app_manifest .. autofunction:: get_cookies @@ -158,14 +295,18 @@ to. For more information, see .. autofunction:: get_layout_metrics +.. autofunction:: get_manifest_icons + .. autofunction:: get_navigation_history +.. autofunction:: get_origin_trials + +.. autofunction:: get_permissions_policy_state + .. autofunction:: get_resource_content .. autofunction:: get_resource_tree -.. autofunction:: handle_file_chooser - .. autofunction:: handle_java_script_dialog .. autofunction:: navigate @@ -174,6 +315,8 @@ to. For more information, see .. autofunction:: print_to_pdf +.. autofunction:: produce_compilation_cache + .. autofunction:: reload .. autofunction:: remove_script_to_evaluate_on_load @@ -208,7 +351,7 @@ to. For more information, see .. autofunction:: set_lifecycle_events_enabled -.. autofunction:: set_produce_compilation_cache +.. autofunction:: set_spc_transaction_mode .. autofunction:: set_touch_emulation_enabled @@ -259,6 +402,11 @@ you use the event's attributes. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: DocumentOpened + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: FrameResized :members: :undoc-members: @@ -289,6 +437,11 @@ you use the event's attributes. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: DownloadProgress + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: InterstitialHidden :members: :undoc-members: @@ -314,6 +467,11 @@ you use the event's attributes. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: BackForwardCacheNotUsed + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: LoadEventFired :members: :undoc-members: diff --git a/docs/api/application_cache.rst b/docs/api/performance_timeline.rst similarity index 77% rename from docs/api/application_cache.rst rename to docs/api/performance_timeline.rst index 5e3964a..9c3d509 100644 --- a/docs/api/application_cache.rst +++ b/docs/api/performance_timeline.rst @@ -1,9 +1,12 @@ -ApplicationCache -================ +PerformanceTimeline +=================== + +Reporting of performance timeline events, as specified in +https://w3c.github.io/performance-timeline/#dom-performanceobserver. *This CDP domain is experimental.* -.. module:: cdp.application_cache +.. module:: cdp.performance_timeline * Types_ * Commands_ @@ -17,17 +20,22 @@ 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. -.. autoclass:: ApplicationCacheResource +.. autoclass:: LargestContentfulPaint + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: LayoutShiftAttribution :members: :undoc-members: :exclude-members: from_json, to_json -.. autoclass:: ApplicationCache +.. autoclass:: LayoutShift :members: :undoc-members: :exclude-members: from_json, to_json -.. autoclass:: FrameWithManifest +.. autoclass:: TimelineEvent :members: :undoc-members: :exclude-members: from_json, to_json @@ -46,12 +54,6 @@ to. For more information, see .. autofunction:: enable -.. autofunction:: get_application_cache_for_frame - -.. autofunction:: get_frames_with_manifests - -.. autofunction:: get_manifest_for_frame - Events ------ @@ -59,12 +61,7 @@ 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. -.. autoclass:: ApplicationCacheStatusUpdated - :members: - :undoc-members: - :exclude-members: from_json, to_json - -.. autoclass:: NetworkStateUpdated +.. autoclass:: TimelineEventAdded :members: :undoc-members: :exclude-members: from_json, to_json diff --git a/docs/api/profiler.rst b/docs/api/profiler.rst index 4019b39..02c25d6 100644 --- a/docs/api/profiler.rst +++ b/docs/api/profiler.rst @@ -112,3 +112,8 @@ you use the event's attributes. :members: :undoc-members: :exclude-members: from_json, to_json + +.. autoclass:: PreciseCoverageDeltaUpdate + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/security.rst b/docs/api/security.rst index d111318..d1c3e74 100644 --- a/docs/api/security.rst +++ b/docs/api/security.rst @@ -32,6 +32,26 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: CertificateSecurityState + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SafetyTipStatus + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: SafetyTipInfo + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: VisibleSecurityState + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: SecurityStateExplanation :members: :undoc-members: @@ -81,6 +101,11 @@ you use the event's attributes. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: VisibleSecurityStateChanged + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: SecurityStateChanged :members: :undoc-members: diff --git a/docs/api/service_worker.rst b/docs/api/service_worker.rst index 86e7322..3ec58a0 100644 --- a/docs/api/service_worker.rst +++ b/docs/api/service_worker.rst @@ -63,6 +63,8 @@ to. For more information, see .. autofunction:: disable +.. autofunction:: dispatch_periodic_sync_event + .. autofunction:: dispatch_sync_event .. autofunction:: enable diff --git a/docs/api/storage.rst b/docs/api/storage.rst index 4eb90b7..6240901 100644 --- a/docs/api/storage.rst +++ b/docs/api/storage.rst @@ -27,6 +27,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: TrustTokens + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -39,10 +44,22 @@ commands, and ``z`` is the return type you should pay attention to. For more information, see :ref:`Getting Started: Commands `. +.. autofunction:: clear_cookies + .. autofunction:: clear_data_for_origin +.. autofunction:: clear_trust_tokens + +.. autofunction:: get_cookies + +.. autofunction:: get_trust_tokens + .. autofunction:: get_usage_and_quota +.. autofunction:: override_quota_for_origin + +.. autofunction:: set_cookies + .. autofunction:: track_cache_storage_for_origin .. autofunction:: track_indexed_db_for_origin diff --git a/docs/api/system_info.rst b/docs/api/system_info.rst index 4e704f5..1b595c7 100644 --- a/docs/api/system_info.rst +++ b/docs/api/system_info.rst @@ -44,6 +44,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: ImageType + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: ImageDecodeAcceleratorCapability :members: :undoc-members: diff --git a/docs/api/target.rst b/docs/api/target.rst index 323cb37..263ae8a 100644 --- a/docs/api/target.rst +++ b/docs/api/target.rst @@ -27,11 +27,6 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json -.. autoclass:: BrowserContextID - :members: - :undoc-members: - :exclude-members: from_json, to_json - .. autoclass:: TargetInfo :members: :undoc-members: @@ -60,6 +55,8 @@ to. For more information, see .. autofunction:: attach_to_target +.. autofunction:: auto_attach_related + .. autofunction:: close_target .. autofunction:: create_browser_context diff --git a/docs/api/tracing.rst b/docs/api/tracing.rst index 4898f92..fd134ba 100644 --- a/docs/api/tracing.rst +++ b/docs/api/tracing.rst @@ -37,6 +37,16 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: MemoryDumpLevelOfDetail + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: TracingBackend + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- diff --git a/docs/api/web_audio.rst b/docs/api/web_audio.rst index 4e5233c..4000aab 100644 --- a/docs/api/web_audio.rst +++ b/docs/api/web_audio.rst @@ -20,7 +20,7 @@ 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. -.. autoclass:: ContextId +.. autoclass:: GraphObjectId :members: :undoc-members: :exclude-members: from_json, to_json @@ -35,6 +35,31 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: NodeType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ChannelCountMode + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ChannelInterpretation + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: ParamType + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AutomationRate + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: ContextRealtimeData :members: :undoc-members: @@ -45,6 +70,21 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: AudioListener + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AudioNode + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AudioParam + :members: + :undoc-members: + :exclude-members: from_json, to_json + Commands -------- @@ -75,7 +115,7 @@ you use the event's attributes. :undoc-members: :exclude-members: from_json, to_json -.. autoclass:: ContextDestroyed +.. autoclass:: ContextWillBeDestroyed :members: :undoc-members: :exclude-members: from_json, to_json @@ -84,3 +124,53 @@ you use the event's attributes. :members: :undoc-members: :exclude-members: from_json, to_json + +.. autoclass:: AudioListenerCreated + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AudioListenerWillBeDestroyed + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AudioNodeCreated + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AudioNodeWillBeDestroyed + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AudioParamCreated + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: AudioParamWillBeDestroyed + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: NodesConnected + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: NodesDisconnected + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: NodeParamConnected + :members: + :undoc-members: + :exclude-members: from_json, to_json + +.. autoclass:: NodeParamDisconnected + :members: + :undoc-members: + :exclude-members: from_json, to_json diff --git a/docs/api/web_authn.rst b/docs/api/web_authn.rst index 8bf7d2a..8a1a0b9 100644 --- a/docs/api/web_authn.rst +++ b/docs/api/web_authn.rst @@ -30,6 +30,11 @@ arguments to other commands. :undoc-members: :exclude-members: from_json, to_json +.. autoclass:: Ctap2Version + :members: + :undoc-members: + :exclude-members: from_json, to_json + .. autoclass:: AuthenticatorTransport :members: :undoc-members: @@ -67,10 +72,16 @@ to. For more information, see .. autofunction:: enable +.. autofunction:: get_credential + .. autofunction:: get_credentials +.. autofunction:: remove_credential + .. autofunction:: remove_virtual_authenticator +.. autofunction:: set_automatic_presence_simulation + .. autofunction:: set_user_verified Events diff --git a/generator/browser_protocol.json b/generator/browser_protocol.json index d9a2683..befc9d1 100644 --- a/generator/browser_protocol.json +++ b/generator/browser_protocol.json @@ -58,11 +58,13 @@ "description": "Enum of possible native property sources (as a subtype of a particular AXValueSourceType).", "type": "string", "enum": [ + "description", "figcaption", "label", "labelfor", "labelwrapped", "legend", + "rubyannotation", "tablecaption", "title", "other" @@ -306,6 +308,12 @@ "$ref": "AXProperty" } }, + { + "name": "parentId", + "description": "ID for this node's parent.", + "optional": true, + "$ref": "AXNodeId" + }, { "name": "childIds", "description": "IDs for each of this node's child nodes.", @@ -320,6 +328,12 @@ "description": "The backend ID for the associated DOM node, if any.", "optional": true, "$ref": "DOM.BackendNodeId" + }, + { + "name": "frameId", + "description": "The frame ID for the frame associated with this nodes document.", + "optional": true, + "$ref": "Page.FrameId" } ] } @@ -376,11 +390,187 @@ }, { "name": "getFullAXTree", - "description": "Fetches the entire accessibility tree", + "description": "Fetches the entire accessibility tree for the root Document", + "experimental": true, + "parameters": [ + { + "name": "depth", + "description": "The maximum depth at which descendants of the root node should be retrieved.\nIf omitted, the full tree is returned.", + "optional": true, + "type": "integer" + }, + { + "name": "max_depth", + "description": "Deprecated. This parameter has been renamed to `depth`. If depth is not provided, max_depth will be used.", + "deprecated": true, + "optional": true, + "type": "integer" + }, + { + "name": "frameId", + "description": "The frame for whose document the AX tree should be retrieved.\nIf omited, the root frame is used.", + "optional": true, + "$ref": "Page.FrameId" + } + ], + "returns": [ + { + "name": "nodes", + "type": "array", + "items": { + "$ref": "AXNode" + } + } + ] + }, + { + "name": "getRootAXNode", + "description": "Fetches the root node.\nRequires `enable()` to have been called previously.", + "experimental": true, + "parameters": [ + { + "name": "frameId", + "description": "The frame in whose document the node resides.\nIf omitted, the root frame is used.", + "optional": true, + "$ref": "Page.FrameId" + } + ], + "returns": [ + { + "name": "node", + "$ref": "AXNode" + } + ] + }, + { + "name": "getAXNodeAndAncestors", + "description": "Fetches a node and all ancestors up to and including the root.\nRequires `enable()` to have been called previously.", + "experimental": true, + "parameters": [ + { + "name": "nodeId", + "description": "Identifier of the node to get.", + "optional": true, + "$ref": "DOM.NodeId" + }, + { + "name": "backendNodeId", + "description": "Identifier of the backend node to get.", + "optional": true, + "$ref": "DOM.BackendNodeId" + }, + { + "name": "objectId", + "description": "JavaScript object id of the node wrapper to get.", + "optional": true, + "$ref": "Runtime.RemoteObjectId" + } + ], + "returns": [ + { + "name": "nodes", + "type": "array", + "items": { + "$ref": "AXNode" + } + } + ] + }, + { + "name": "getChildAXNodes", + "description": "Fetches a particular accessibility node by AXNodeId.\nRequires `enable()` to have been called previously.", + "experimental": true, + "parameters": [ + { + "name": "id", + "$ref": "AXNodeId" + }, + { + "name": "frameId", + "description": "The frame in whose document the node resides.\nIf omitted, the root frame is used.", + "optional": true, + "$ref": "Page.FrameId" + } + ], + "returns": [ + { + "name": "nodes", + "type": "array", + "items": { + "$ref": "AXNode" + } + } + ] + }, + { + "name": "queryAXTree", + "description": "Query a DOM node's accessibility subtree for accessible name and role.\nThis command computes the name and role for all nodes in the subtree, including those that are\nignored for accessibility, and returns those that mactch the specified name and role. If no DOM\nnode is specified, or the DOM node does not exist, the command returns an error. If neither\n`accessibleName` or `role` is specified, it returns all the accessibility nodes in the subtree.", "experimental": true, + "parameters": [ + { + "name": "nodeId", + "description": "Identifier of the node for the root to query.", + "optional": true, + "$ref": "DOM.NodeId" + }, + { + "name": "backendNodeId", + "description": "Identifier of the backend node for the root to query.", + "optional": true, + "$ref": "DOM.BackendNodeId" + }, + { + "name": "objectId", + "description": "JavaScript object id of the node wrapper for the root to query.", + "optional": true, + "$ref": "Runtime.RemoteObjectId" + }, + { + "name": "accessibleName", + "description": "Find nodes with this computed name.", + "optional": true, + "type": "string" + }, + { + "name": "role", + "description": "Find nodes with this computed role.", + "optional": true, + "type": "string" + } + ], "returns": [ { "name": "nodes", + "description": "A list of `Accessibility.AXNode` matching the specified attributes,\nincluding nodes that are ignored for accessibility.", + "type": "array", + "items": { + "$ref": "AXNode" + } + } + ] + } + ], + "events": [ + { + "name": "loadComplete", + "description": "The loadComplete event mirrors the load complete event sent by the browser to assistive\ntechnology when the web page has finished loading.", + "experimental": true, + "parameters": [ + { + "name": "root", + "description": "New document root node.", + "$ref": "AXNode" + } + ] + }, + { + "name": "nodesUpdated", + "description": "The nodesUpdated event is sent every time a previously requested node has changed the in tree.", + "experimental": true, + "parameters": [ + { + "name": "nodes", + "description": "Updated node data.", "type": "array", "items": { "$ref": "AXNode" @@ -738,11625 +928,16457 @@ ] }, { - "domain": "ApplicationCache", + "domain": "Audits", + "description": "Audits domain allows investigation of page violations and possible improvements.", "experimental": true, + "dependencies": [ + "Network" + ], "types": [ { - "id": "ApplicationCacheResource", - "description": "Detailed application cache resource information.", + "id": "AffectedCookie", + "description": "Information about a cookie that is affected by an inspector issue.", "type": "object", "properties": [ { - "name": "url", - "description": "Resource url.", + "name": "name", + "description": "The following three properties uniquely identify a cookie", "type": "string" }, { - "name": "size", - "description": "Resource size.", - "type": "integer" + "name": "path", + "type": "string" }, { - "name": "type", - "description": "Resource type.", + "name": "domain", "type": "string" } ] }, { - "id": "ApplicationCache", - "description": "Detailed application cache information.", + "id": "AffectedRequest", + "description": "Information about a request that is affected by an inspector issue.", "type": "object", "properties": [ { - "name": "manifestURL", - "description": "Manifest URL.", - "type": "string" - }, - { - "name": "size", - "description": "Application cache size.", - "type": "number" - }, - { - "name": "creationTime", - "description": "Application cache creation time.", - "type": "number" - }, - { - "name": "updateTime", - "description": "Application cache update time.", - "type": "number" + "name": "requestId", + "description": "The unique request id.", + "$ref": "Network.RequestId" }, { - "name": "resources", - "description": "Application cache resources.", - "type": "array", - "items": { - "$ref": "ApplicationCacheResource" - } + "name": "url", + "optional": true, + "type": "string" } ] }, { - "id": "FrameWithManifest", - "description": "Frame identifier - manifest URL pair.", + "id": "AffectedFrame", + "description": "Information about the frame affected by an inspector issue.", "type": "object", "properties": [ { "name": "frameId", - "description": "Frame identifier.", "$ref": "Page.FrameId" - }, - { - "name": "manifestURL", - "description": "Manifest URL.", - "type": "string" - }, - { - "name": "status", - "description": "Application cache status.", - "type": "integer" } ] - } - ], - "commands": [ + }, { - "name": "enable", - "description": "Enables application cache domain notifications." + "id": "SameSiteCookieExclusionReason", + "type": "string", + "enum": [ + "ExcludeSameSiteUnspecifiedTreatedAsLax", + "ExcludeSameSiteNoneInsecure", + "ExcludeSameSiteLax", + "ExcludeSameSiteStrict", + "ExcludeInvalidSameParty", + "ExcludeSamePartyCrossPartyContext" + ] }, { - "name": "getApplicationCacheForFrame", - "description": "Returns relevant application cache data for the document in given frame.", - "parameters": [ - { - "name": "frameId", - "description": "Identifier of the frame containing document whose application cache is retrieved.", - "$ref": "Page.FrameId" - } - ], - "returns": [ - { - "name": "applicationCache", - "description": "Relevant application cache data for the document in given frame.", - "$ref": "ApplicationCache" - } + "id": "SameSiteCookieWarningReason", + "type": "string", + "enum": [ + "WarnSameSiteUnspecifiedCrossSiteContext", + "WarnSameSiteNoneInsecure", + "WarnSameSiteUnspecifiedLaxAllowUnsafe", + "WarnSameSiteStrictLaxDowngradeStrict", + "WarnSameSiteStrictCrossDowngradeStrict", + "WarnSameSiteStrictCrossDowngradeLax", + "WarnSameSiteLaxCrossDowngradeStrict", + "WarnSameSiteLaxCrossDowngradeLax" ] }, { - "name": "getFramesWithManifests", - "description": "Returns array of frame identifiers with manifest urls for each frame containing a document\nassociated with some application cache.", - "returns": [ - { - "name": "frameIds", - "description": "Array of frame identifiers with manifest urls for each frame containing a document\nassociated with some application cache.", - "type": "array", - "items": { - "$ref": "FrameWithManifest" - } - } + "id": "SameSiteCookieOperation", + "type": "string", + "enum": [ + "SetCookie", + "ReadCookie" ] }, { - "name": "getManifestForFrame", - "description": "Returns manifest URL for document in the given frame.", - "parameters": [ + "id": "SameSiteCookieIssueDetails", + "description": "This information is currently necessary, as the front-end has a difficult\ntime finding a specific cookie. With this, we can convey specific error\ninformation without the cookie.", + "type": "object", + "properties": [ { - "name": "frameId", - "description": "Identifier of the frame containing document whose manifest is retrieved.", - "$ref": "Page.FrameId" - } - ], - "returns": [ + "name": "cookie", + "description": "If AffectedCookie is not set then rawCookieLine contains the raw\nSet-Cookie header string. This hints at a problem where the\ncookie line is syntactically or semantically malformed in a way\nthat no valid cookie could be created.", + "optional": true, + "$ref": "AffectedCookie" + }, { - "name": "manifestURL", - "description": "Manifest URL for document in the given frame.", + "name": "rawCookieLine", + "optional": true, "type": "string" - } - ] - } - ], - "events": [ - { - "name": "applicationCacheStatusUpdated", - "parameters": [ + }, { - "name": "frameId", - "description": "Identifier of the frame containing document whose application cache updated status.", - "$ref": "Page.FrameId" + "name": "cookieWarningReasons", + "type": "array", + "items": { + "$ref": "SameSiteCookieWarningReason" + } }, { - "name": "manifestURL", - "description": "Manifest URL.", + "name": "cookieExclusionReasons", + "type": "array", + "items": { + "$ref": "SameSiteCookieExclusionReason" + } + }, + { + "name": "operation", + "description": "Optionally identifies the site-for-cookies and the cookie url, which\nmay be used by the front-end as additional context.", + "$ref": "SameSiteCookieOperation" + }, + { + "name": "siteForCookies", + "optional": true, "type": "string" }, { - "name": "status", - "description": "Updated application cache status.", - "type": "integer" + "name": "cookieUrl", + "optional": true, + "type": "string" + }, + { + "name": "request", + "optional": true, + "$ref": "AffectedRequest" } ] }, { - "name": "networkStateUpdated", - "parameters": [ - { - "name": "isNowOnline", - "type": "boolean" - } + "id": "MixedContentResolutionStatus", + "type": "string", + "enum": [ + "MixedContentBlocked", + "MixedContentAutomaticallyUpgraded", + "MixedContentWarning" ] - } - ] - }, - { - "domain": "Audits", - "description": "Audits domain allows investigation of page violations and possible improvements.", - "experimental": true, - "dependencies": [ - "Network" - ], - "commands": [ + }, { - "name": "getEncodedResponse", - "description": "Returns the response body and size if it were re-encoded with the specified settings. Only\napplies to images.", - "parameters": [ + "id": "MixedContentResourceType", + "type": "string", + "enum": [ + "Audio", + "Beacon", + "CSPReport", + "Download", + "EventSource", + "Favicon", + "Font", + "Form", + "Frame", + "Image", + "Import", + "Manifest", + "Ping", + "PluginData", + "PluginResource", + "Prefetch", + "Resource", + "Script", + "ServiceWorker", + "SharedWorker", + "Stylesheet", + "Track", + "Video", + "Worker", + "XMLHttpRequest", + "XSLT" + ] + }, + { + "id": "MixedContentIssueDetails", + "type": "object", + "properties": [ { - "name": "requestId", - "description": "Identifier of the network request to get content for.", - "$ref": "Network.RequestId" + "name": "resourceType", + "description": "The type of resource causing the mixed content issue (css, js, iframe,\nform,...). Marked as optional because it is mapped to from\nblink::mojom::RequestContextType, which will be replaced\nby network::mojom::RequestDestination", + "optional": true, + "$ref": "MixedContentResourceType" }, { - "name": "encoding", - "description": "The encoding to use.", - "type": "string", - "enum": [ - "webp", - "jpeg", - "png" - ] + "name": "resolutionStatus", + "description": "The way the mixed content issue is being resolved.", + "$ref": "MixedContentResolutionStatus" }, { - "name": "quality", - "description": "The quality of the encoding (0-1). (defaults to 1)", + "name": "insecureURL", + "description": "The unsafe http url causing the mixed content issue.", + "type": "string" + }, + { + "name": "mainResourceURL", + "description": "The url responsible for the call to an unsafe url.", + "type": "string" + }, + { + "name": "request", + "description": "The mixed content request.\nDoes not always exist (e.g. for unsafe form submission urls).", "optional": true, - "type": "number" + "$ref": "AffectedRequest" }, { - "name": "sizeOnly", - "description": "Whether to only return the size information (defaults to false).", + "name": "frame", + "description": "Optional because not every mixed content issue is necessarily linked to a frame.", "optional": true, - "type": "boolean" + "$ref": "AffectedFrame" } - ], - "returns": [ + ] + }, + { + "id": "BlockedByResponseReason", + "description": "Enum indicating the reason a response has been blocked. These reasons are\nrefinements of the net error BLOCKED_BY_RESPONSE.", + "type": "string", + "enum": [ + "CoepFrameResourceNeedsCoepHeader", + "CoopSandboxedIFrameCannotNavigateToCoopPage", + "CorpNotSameOrigin", + "CorpNotSameOriginAfterDefaultedToSameOriginByCoep", + "CorpNotSameSite" + ] + }, + { + "id": "BlockedByResponseIssueDetails", + "description": "Details for a request that has been blocked with the BLOCKED_BY_RESPONSE\ncode. Currently only used for COEP/COOP, but may be extended to include\nsome CSP errors in the future.", + "type": "object", + "properties": [ { - "name": "body", - "description": "The encoded body as a base64 string. Omitted if sizeOnly is true.", + "name": "request", + "$ref": "AffectedRequest" + }, + { + "name": "parentFrame", "optional": true, - "type": "string" + "$ref": "AffectedFrame" }, { - "name": "originalSize", - "description": "Size before re-encoding.", - "type": "integer" + "name": "blockedFrame", + "optional": true, + "$ref": "AffectedFrame" }, { - "name": "encodedSize", - "description": "Size after re-encoding.", - "type": "integer" + "name": "reason", + "$ref": "BlockedByResponseReason" } ] - } - ] - }, - { - "domain": "BackgroundService", - "description": "Defines events for background web platform features.", - "experimental": true, - "types": [ + }, { - "id": "ServiceName", - "description": "The Background Service that will be associated with the commands/events.\nEvery Background Service operates independently, but they share the same\nAPI.", + "id": "HeavyAdResolutionStatus", "type": "string", "enum": [ - "backgroundFetch", - "backgroundSync", - "pushMessaging", - "notifications", - "paymentHandler" + "HeavyAdBlocked", + "HeavyAdWarning" ] }, { - "id": "EventMetadata", - "description": "A key-value pair for additional event information to pass along.", + "id": "HeavyAdReason", + "type": "string", + "enum": [ + "NetworkTotalLimit", + "CpuTotalLimit", + "CpuPeakLimit" + ] + }, + { + "id": "HeavyAdIssueDetails", "type": "object", "properties": [ { - "name": "key", - "type": "string" + "name": "resolution", + "description": "The resolution status, either blocking the content or warning.", + "$ref": "HeavyAdResolutionStatus" }, { - "name": "value", - "type": "string" + "name": "reason", + "description": "The reason the ad was blocked, total network or cpu or peak cpu.", + "$ref": "HeavyAdReason" + }, + { + "name": "frame", + "description": "The frame that was blocked.", + "$ref": "AffectedFrame" } ] }, { - "id": "BackgroundServiceEvent", + "id": "ContentSecurityPolicyViolationType", + "type": "string", + "enum": [ + "kInlineViolation", + "kEvalViolation", + "kURLViolation", + "kTrustedTypesSinkViolation", + "kTrustedTypesPolicyViolation", + "kWasmEvalViolation" + ] + }, + { + "id": "SourceCodeLocation", "type": "object", "properties": [ { - "name": "timestamp", - "description": "Timestamp of the event (in seconds).", - "$ref": "Network.TimeSinceEpoch" + "name": "scriptId", + "optional": true, + "$ref": "Runtime.ScriptId" }, { - "name": "origin", - "description": "The origin this event belongs to.", + "name": "url", "type": "string" }, { - "name": "serviceWorkerRegistrationId", - "description": "The Service Worker ID that initiated the event.", - "$ref": "ServiceWorker.RegistrationID" + "name": "lineNumber", + "type": "integer" }, { - "name": "service", - "description": "The Background Service this event belongs to.", - "$ref": "ServiceName" - }, + "name": "columnNumber", + "type": "integer" + } + ] + }, + { + "id": "ContentSecurityPolicyIssueDetails", + "type": "object", + "properties": [ { - "name": "eventName", - "description": "A description of the event.", + "name": "blockedURL", + "description": "The url not included in allowed sources.", + "optional": true, "type": "string" }, { - "name": "instanceId", - "description": "An identifier that groups related events together.", + "name": "violatedDirective", + "description": "Specific directive that is violated, causing the CSP issue.", "type": "string" }, { - "name": "eventMetadata", - "description": "A list of event-specific information.", - "type": "array", - "items": { - "$ref": "EventMetadata" - } - } - ] - } - ], - "commands": [ - { - "name": "startObserving", - "description": "Enables event updates for the service.", - "parameters": [ + "name": "isReportOnly", + "type": "boolean" + }, { - "name": "service", - "$ref": "ServiceName" + "name": "contentSecurityPolicyViolationType", + "$ref": "ContentSecurityPolicyViolationType" + }, + { + "name": "frameAncestor", + "optional": true, + "$ref": "AffectedFrame" + }, + { + "name": "sourceCodeLocation", + "optional": true, + "$ref": "SourceCodeLocation" + }, + { + "name": "violatingNodeId", + "optional": true, + "$ref": "DOM.BackendNodeId" } ] }, { - "name": "stopObserving", - "description": "Disables event updates for the service.", - "parameters": [ - { - "name": "service", - "$ref": "ServiceName" - } + "id": "SharedArrayBufferIssueType", + "type": "string", + "enum": [ + "TransferIssue", + "CreationIssue" ] }, { - "name": "setRecording", - "description": "Set the recording state for the service.", - "parameters": [ + "id": "SharedArrayBufferIssueDetails", + "description": "Details for a issue arising from an SAB being instantiated in, or\ntransferred to a context that is not cross-origin isolated.", + "type": "object", + "properties": [ { - "name": "shouldRecord", + "name": "sourceCodeLocation", + "$ref": "SourceCodeLocation" + }, + { + "name": "isWarning", "type": "boolean" }, { - "name": "service", - "$ref": "ServiceName" + "name": "type", + "$ref": "SharedArrayBufferIssueType" } ] }, { - "name": "clearEvents", - "description": "Clears all stored data for the service.", - "parameters": [ - { - "name": "service", - "$ref": "ServiceName" - } + "id": "TwaQualityEnforcementViolationType", + "type": "string", + "enum": [ + "kHttpError", + "kUnavailableOffline", + "kDigitalAssetLinks" ] - } - ], - "events": [ + }, { - "name": "recordingStateChanged", - "description": "Called when the recording state for the service has been updated.", - "parameters": [ + "id": "TrustedWebActivityIssueDetails", + "type": "object", + "properties": [ { - "name": "isRecording", - "type": "boolean" + "name": "url", + "description": "The url that triggers the violation.", + "type": "string" }, { - "name": "service", - "$ref": "ServiceName" + "name": "violationType", + "$ref": "TwaQualityEnforcementViolationType" + }, + { + "name": "httpStatusCode", + "optional": true, + "type": "integer" + }, + { + "name": "packageName", + "description": "The package name of the Trusted Web Activity client app. This field is\nonly used when violation type is kDigitalAssetLinks.", + "optional": true, + "type": "string" + }, + { + "name": "signature", + "description": "The signature of the Trusted Web Activity client app. This field is only\nused when violation type is kDigitalAssetLinks.", + "optional": true, + "type": "string" } ] }, { - "name": "backgroundServiceEventReceived", - "description": "Called with all existing backgroundServiceEvents when enabled, and all new\nevents afterwards if enabled and recording.", - "parameters": [ + "id": "LowTextContrastIssueDetails", + "type": "object", + "properties": [ { - "name": "backgroundServiceEvent", - "$ref": "BackgroundServiceEvent" - } - ] - } - ] - }, - { - "domain": "Browser", - "description": "The Browser domain defines methods and events for browser managing.", - "types": [ - { - "id": "WindowID", - "experimental": true, - "type": "integer" - }, - { - "id": "WindowState", - "description": "The state of the browser window.", - "experimental": true, - "type": "string", - "enum": [ - "normal", - "minimized", - "maximized", - "fullscreen" + "name": "violatingNodeId", + "$ref": "DOM.BackendNodeId" + }, + { + "name": "violatingNodeSelector", + "type": "string" + }, + { + "name": "contrastRatio", + "type": "number" + }, + { + "name": "thresholdAA", + "type": "number" + }, + { + "name": "thresholdAAA", + "type": "number" + }, + { + "name": "fontSize", + "type": "string" + }, + { + "name": "fontWeight", + "type": "string" + } ] }, { - "id": "Bounds", - "description": "Browser window bounds information", - "experimental": true, + "id": "CorsIssueDetails", + "description": "Details for a CORS related issue, e.g. a warning or error related to\nCORS RFC1918 enforcement.", "type": "object", "properties": [ { - "name": "left", - "description": "The offset from the left edge of the screen to the window in pixels.", - "optional": true, - "type": "integer" + "name": "corsErrorStatus", + "$ref": "Network.CorsErrorStatus" }, { - "name": "top", - "description": "The offset from the top edge of the screen to the window in pixels.", + "name": "isWarning", + "type": "boolean" + }, + { + "name": "request", + "$ref": "AffectedRequest" + }, + { + "name": "location", "optional": true, - "type": "integer" + "$ref": "SourceCodeLocation" }, { - "name": "width", - "description": "The window width in pixels.", + "name": "initiatorOrigin", "optional": true, - "type": "integer" + "type": "string" }, { - "name": "height", - "description": "The window height in pixels.", + "name": "resourceIPAddressSpace", "optional": true, - "type": "integer" + "$ref": "Network.IPAddressSpace" }, { - "name": "windowState", - "description": "The window state. Default to normal.", + "name": "clientSecurityState", "optional": true, - "$ref": "WindowState" + "$ref": "Network.ClientSecurityState" } ] }, { - "id": "PermissionType", - "experimental": true, + "id": "AttributionReportingIssueType", "type": "string", "enum": [ - "accessibilityEvents", - "audioCapture", - "backgroundSync", - "backgroundFetch", - "clipboardRead", - "clipboardWrite", - "durableStorage", - "flash", - "geolocation", - "midi", - "midiSysex", - "notifications", - "paymentHandler", - "periodicBackgroundSync", - "protectedMediaIdentifier", - "sensors", - "videoCapture", - "idleDetection", - "wakeLockScreen", - "wakeLockSystem" - ] - }, - { - "id": "Bucket", - "description": "Chrome histogram bucket.", - "experimental": true, + "PermissionPolicyDisabled", + "InvalidAttributionSourceEventId", + "InvalidAttributionData", + "AttributionSourceUntrustworthyOrigin", + "AttributionUntrustworthyOrigin", + "AttributionTriggerDataTooLarge", + "AttributionEventSourceTriggerDataTooLarge", + "InvalidAttributionSourceExpiry", + "InvalidAttributionSourcePriority", + "InvalidEventSourceTriggerData", + "InvalidTriggerPriority", + "InvalidTriggerDedupKey" + ] + }, + { + "id": "AttributionReportingIssueDetails", + "description": "Details for issues around \"Attribution Reporting API\" usage.\nExplainer: https://github.com/WICG/conversion-measurement-api", "type": "object", "properties": [ { - "name": "low", - "description": "Minimum value (inclusive).", - "type": "integer" + "name": "violationType", + "$ref": "AttributionReportingIssueType" }, { - "name": "high", - "description": "Maximum value (exclusive).", - "type": "integer" + "name": "frame", + "optional": true, + "$ref": "AffectedFrame" }, { - "name": "count", - "description": "Number of samples.", - "type": "integer" + "name": "request", + "optional": true, + "$ref": "AffectedRequest" + }, + { + "name": "violatingNodeId", + "optional": true, + "$ref": "DOM.BackendNodeId" + }, + { + "name": "invalidParameter", + "optional": true, + "type": "string" } ] }, { - "id": "Histogram", - "description": "Chrome histogram.", - "experimental": true, + "id": "QuirksModeIssueDetails", + "description": "Details for issues about documents in Quirks Mode\nor Limited Quirks Mode that affects page layouting.", "type": "object", "properties": [ { - "name": "name", - "description": "Name.", - "type": "string" - }, - { - "name": "sum", - "description": "Sum of sample values.", - "type": "integer" + "name": "isLimitedQuirksMode", + "description": "If false, it means the document's mode is \"quirks\"\ninstead of \"limited-quirks\".", + "type": "boolean" }, { - "name": "count", - "description": "Total number of samples.", - "type": "integer" + "name": "documentNodeId", + "$ref": "DOM.BackendNodeId" }, { - "name": "buckets", - "description": "Buckets.", - "type": "array", - "items": { - "$ref": "Bucket" - } - } - ] - } - ], - "commands": [ - { - "name": "grantPermissions", - "description": "Grant specific permissions to the given origin and reject all others.", - "experimental": true, - "parameters": [ - { - "name": "origin", + "name": "url", "type": "string" }, { - "name": "permissions", - "type": "array", - "items": { - "$ref": "PermissionType" - } + "name": "frameId", + "$ref": "Page.FrameId" }, { - "name": "browserContextId", - "description": "BrowserContext to override permissions. When omitted, default browser context is used.", - "optional": true, - "$ref": "Target.BrowserContextID" + "name": "loaderId", + "$ref": "Network.LoaderId" } ] }, { - "name": "resetPermissions", - "description": "Reset all permission management for all origins.", - "experimental": true, - "parameters": [ + "id": "NavigatorUserAgentIssueDetails", + "type": "object", + "properties": [ { - "name": "browserContextId", - "description": "BrowserContext to reset permissions. When omitted, default browser context is used.", + "name": "url", + "type": "string" + }, + { + "name": "location", "optional": true, - "$ref": "Target.BrowserContextID" + "$ref": "SourceCodeLocation" } ] }, { - "name": "close", - "description": "Close browser gracefully." - }, - { - "name": "crash", - "description": "Crashes browser on the main thread.", - "experimental": true - }, - { - "name": "crashGpuProcess", - "description": "Crashes GPU process.", - "experimental": true - }, - { - "name": "getVersion", - "description": "Returns version information.", - "returns": [ - { - "name": "protocolVersion", - "description": "Protocol version.", - "type": "string" - }, + "id": "WasmCrossOriginModuleSharingIssueDetails", + "type": "object", + "properties": [ { - "name": "product", - "description": "Product name.", + "name": "wasmModuleUrl", "type": "string" }, { - "name": "revision", - "description": "Product revision.", + "name": "sourceOrigin", "type": "string" }, { - "name": "userAgent", - "description": "User-Agent.", + "name": "targetOrigin", "type": "string" }, { - "name": "jsVersion", - "description": "V8 version.", - "type": "string" + "name": "isWarning", + "type": "boolean" } ] }, { - "name": "getBrowserCommandLine", - "description": "Returns the command line switches for the browser process if, and only if\n--enable-automation is on the commandline.", - "experimental": true, - "returns": [ - { - "name": "arguments", - "description": "Commandline parameters", - "type": "array", - "items": { - "type": "string" - } - } + "id": "GenericIssueErrorType", + "type": "string", + "enum": [ + "CrossOriginPortalPostMessageError" ] }, { - "name": "getHistograms", - "description": "Get Chrome histograms.", - "experimental": true, - "parameters": [ + "id": "GenericIssueDetails", + "description": "Depending on the concrete errorType, different properties are set.", + "type": "object", + "properties": [ { - "name": "query", - "description": "Requested substring in name. Only histograms which have query as a\nsubstring in their name are extracted. An empty or absent query returns\nall histograms.", - "optional": true, - "type": "string" + "name": "errorType", + "description": "Issues with the same errorType are aggregated in the frontend.", + "$ref": "GenericIssueErrorType" }, { - "name": "delta", - "description": "If true, retrieve delta since last call.", + "name": "frameId", "optional": true, - "type": "boolean" - } - ], - "returns": [ - { - "name": "histograms", - "description": "Histograms.", - "type": "array", - "items": { - "$ref": "Histogram" - } + "$ref": "Page.FrameId" } ] }, { - "name": "getHistogram", - "description": "Get a Chrome histogram by name.", - "experimental": true, - "parameters": [ - { - "name": "name", - "description": "Requested histogram name.", - "type": "string" - }, - { - "name": "delta", - "description": "If true, retrieve delta since last call.", - "optional": true, - "type": "boolean" - } - ], - "returns": [ - { - "name": "histogram", - "description": "Histogram.", - "$ref": "Histogram" - } - ] - }, - { - "name": "getWindowBounds", - "description": "Get position and size of the browser window.", - "experimental": true, - "parameters": [ - { - "name": "windowId", - "description": "Browser window id.", - "$ref": "WindowID" - } - ], - "returns": [ - { - "name": "bounds", - "description": "Bounds information of the window. When window state is 'minimized', the restored window\nposition and size are returned.", - "$ref": "Bounds" - } - ] - }, - { - "name": "getWindowForTarget", - "description": "Get the browser window that contains the devtools target.", - "experimental": true, - "parameters": [ + "id": "DeprecationIssueDetails", + "description": "This issue tracks information needed to print a deprecation message.\nThe formatting is inherited from the old console.log version, see more at:\nhttps://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/frame/deprecation.cc\nTODO(crbug.com/1264960): Re-work format to add i18n support per:\nhttps://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/devtools_protocol/README.md", + "type": "object", + "properties": [ { - "name": "targetId", - "description": "Devtools agent host id. If called as a part of the session, associated targetId is used.", + "name": "affectedFrame", "optional": true, - "$ref": "Target.TargetID" - } - ], - "returns": [ - { - "name": "windowId", - "description": "Browser window id.", - "$ref": "WindowID" - }, - { - "name": "bounds", - "description": "Bounds information of the window. When window state is 'minimized', the restored window\nposition and size are returned.", - "$ref": "Bounds" - } - ] - }, - { - "name": "setWindowBounds", - "description": "Set position and/or size of the browser window.", - "experimental": true, - "parameters": [ - { - "name": "windowId", - "description": "Browser window id.", - "$ref": "WindowID" + "$ref": "AffectedFrame" }, { - "name": "bounds", - "description": "New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined\nwith 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.", - "$ref": "Bounds" - } - ] - }, - { - "name": "setDockTile", - "description": "Set dock tile details, platform-specific.", - "experimental": true, - "parameters": [ - { - "name": "badgeLabel", - "optional": true, - "type": "string" + "name": "sourceCodeLocation", + "$ref": "SourceCodeLocation" }, { - "name": "image", - "description": "Png encoded image.", + "name": "message", + "description": "The content of the deprecation issue (this won't be translated),\ne.g. \"window.inefficientLegacyStorageMethod will be removed in M97,\naround January 2022. Please use Web Storage or Indexed Database\ninstead. This standard was abandoned in January, 1970. See\nhttps://www.chromestatus.com/feature/5684870116278272 for more details.\"", + "deprecated": true, "optional": true, "type": "string" } ] - } - ] - }, - { - "domain": "CSS", - "description": "This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles)\nhave an associated `id` used in subsequent operations on the related object. Each object type has\na specific `id` structure, and those are not interchangeable between objects of different kinds.\nCSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client\ncan also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and\nsubsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods.", - "experimental": true, - "dependencies": [ - "DOM" - ], - "types": [ - { - "id": "StyleSheetId", - "type": "string" }, { - "id": "StyleSheetOrigin", - "description": "Stylesheet type: \"injected\" for stylesheets injected via extension, \"user-agent\" for user-agent\nstylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding the \"via\ninspector\" rules), \"regular\" for regular stylesheets.", + "id": "ClientHintIssueReason", "type": "string", "enum": [ - "injected", - "user-agent", - "inspector", - "regular" + "MetaTagAllowListInvalidOrigin", + "MetaTagModifiedHTML" ] }, { - "id": "PseudoElementMatches", - "description": "CSS rule collection for a single pseudo style.", + "id": "ClientHintIssueDetails", + "description": "This issue tracks client hints related issues. It's used to deprecate old\nfeatures, encourage the use of new ones, and provide general guidance.", "type": "object", "properties": [ { - "name": "pseudoType", - "description": "Pseudo element type.", - "$ref": "DOM.PseudoType" + "name": "sourceCodeLocation", + "$ref": "SourceCodeLocation" }, { - "name": "matches", - "description": "Matches of CSS rules applicable to the pseudo style.", - "type": "array", - "items": { - "$ref": "RuleMatch" - } + "name": "clientHintIssueReason", + "$ref": "ClientHintIssueReason" } ] }, { - "id": "InheritedStyleEntry", - "description": "Inherited CSS rule collection from ancestor node.", + "id": "InspectorIssueCode", + "description": "A unique identifier for the type of issue. Each type may use one of the\noptional fields in InspectorIssueDetails to convey more specific\ninformation about the kind of issue.", + "type": "string", + "enum": [ + "SameSiteCookieIssue", + "MixedContentIssue", + "BlockedByResponseIssue", + "HeavyAdIssue", + "ContentSecurityPolicyIssue", + "SharedArrayBufferIssue", + "TrustedWebActivityIssue", + "LowTextContrastIssue", + "CorsIssue", + "AttributionReportingIssue", + "QuirksModeIssue", + "NavigatorUserAgentIssue", + "WasmCrossOriginModuleSharingIssue", + "GenericIssue", + "DeprecationIssue", + "ClientHintIssue" + ] + }, + { + "id": "InspectorIssueDetails", + "description": "This struct holds a list of optional fields with additional information\nspecific to the kind of issue. When adding a new issue code, please also\nadd a new optional field to this type.", "type": "object", "properties": [ { - "name": "inlineStyle", - "description": "The ancestor node's inline style, if any, in the style inheritance chain.", + "name": "sameSiteCookieIssueDetails", "optional": true, - "$ref": "CSSStyle" - }, - { - "name": "matchedCSSRules", - "description": "Matches of CSS rules matching the ancestor node in the style inheritance chain.", - "type": "array", - "items": { - "$ref": "RuleMatch" - } - } - ] - }, - { - "id": "RuleMatch", - "description": "Match data for a CSS rule.", - "type": "object", - "properties": [ - { - "name": "rule", - "description": "CSS rule in the match.", - "$ref": "CSSRule" + "$ref": "SameSiteCookieIssueDetails" }, { - "name": "matchingSelectors", - "description": "Matching selector indices in the rule's selectorList selectors (0-based).", - "type": "array", - "items": { - "type": "integer" - } - } - ] - }, - { - "id": "Value", - "description": "Data for a simple selector (these are delimited by commas in a selector list).", - "type": "object", - "properties": [ - { - "name": "text", - "description": "Value text.", - "type": "string" + "name": "mixedContentIssueDetails", + "optional": true, + "$ref": "MixedContentIssueDetails" }, { - "name": "range", - "description": "Value range in the underlying resource (if available).", + "name": "blockedByResponseIssueDetails", "optional": true, - "$ref": "SourceRange" - } - ] - }, - { - "id": "SelectorList", - "description": "Selector list data.", - "type": "object", - "properties": [ - { - "name": "selectors", - "description": "Selectors in the list.", - "type": "array", - "items": { - "$ref": "Value" - } + "$ref": "BlockedByResponseIssueDetails" }, { - "name": "text", - "description": "Rule selector text.", - "type": "string" - } - ] - }, - { - "id": "CSSStyleSheetHeader", - "description": "CSS stylesheet metainformation.", - "type": "object", - "properties": [ - { - "name": "styleSheetId", - "description": "The stylesheet identifier.", - "$ref": "StyleSheetId" + "name": "heavyAdIssueDetails", + "optional": true, + "$ref": "HeavyAdIssueDetails" }, { - "name": "frameId", - "description": "Owner frame identifier.", - "$ref": "Page.FrameId" + "name": "contentSecurityPolicyIssueDetails", + "optional": true, + "$ref": "ContentSecurityPolicyIssueDetails" }, { - "name": "sourceURL", - "description": "Stylesheet resource URL.", - "type": "string" + "name": "sharedArrayBufferIssueDetails", + "optional": true, + "$ref": "SharedArrayBufferIssueDetails" }, { - "name": "sourceMapURL", - "description": "URL of source map associated with the stylesheet (if any).", + "name": "twaQualityEnforcementDetails", "optional": true, - "type": "string" + "$ref": "TrustedWebActivityIssueDetails" }, { - "name": "origin", - "description": "Stylesheet origin.", - "$ref": "StyleSheetOrigin" + "name": "lowTextContrastIssueDetails", + "optional": true, + "$ref": "LowTextContrastIssueDetails" }, { - "name": "title", - "description": "Stylesheet title.", - "type": "string" + "name": "corsIssueDetails", + "optional": true, + "$ref": "CorsIssueDetails" }, { - "name": "ownerNode", - "description": "The backend id for the owner node of the stylesheet.", + "name": "attributionReportingIssueDetails", "optional": true, - "$ref": "DOM.BackendNodeId" + "$ref": "AttributionReportingIssueDetails" }, { - "name": "disabled", - "description": "Denotes whether the stylesheet is disabled.", - "type": "boolean" + "name": "quirksModeIssueDetails", + "optional": true, + "$ref": "QuirksModeIssueDetails" }, { - "name": "hasSourceURL", - "description": "Whether the sourceURL field value comes from the sourceURL comment.", + "name": "navigatorUserAgentIssueDetails", "optional": true, - "type": "boolean" + "$ref": "NavigatorUserAgentIssueDetails" }, { - "name": "isInline", - "description": "Whether this stylesheet is created for STYLE tag by parser. This flag is not set for\ndocument.written STYLE tags.", - "type": "boolean" + "name": "wasmCrossOriginModuleSharingIssue", + "optional": true, + "$ref": "WasmCrossOriginModuleSharingIssueDetails" }, { - "name": "startLine", - "description": "Line offset of the stylesheet within the resource (zero based).", - "type": "number" + "name": "genericIssueDetails", + "optional": true, + "$ref": "GenericIssueDetails" }, { - "name": "startColumn", - "description": "Column offset of the stylesheet within the resource (zero based).", - "type": "number" + "name": "deprecationIssueDetails", + "optional": true, + "$ref": "DeprecationIssueDetails" }, { - "name": "length", - "description": "Size of the content (in characters).", - "type": "number" + "name": "clientHintIssueDetails", + "optional": true, + "$ref": "ClientHintIssueDetails" } ] }, { - "id": "CSSRule", - "description": "CSS rule representation.", + "id": "IssueId", + "description": "A unique id for a DevTools inspector issue. Allows other entities (e.g.\nexceptions, CDP message, console messages, etc.) to reference an issue.", + "type": "string" + }, + { + "id": "InspectorIssue", + "description": "An inspector issue reported from the back-end.", "type": "object", "properties": [ { - "name": "styleSheetId", - "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", - "optional": true, - "$ref": "StyleSheetId" + "name": "code", + "$ref": "InspectorIssueCode" }, { - "name": "selectorList", - "description": "Rule selector data.", - "$ref": "SelectorList" - }, - { - "name": "origin", - "description": "Parent stylesheet's origin.", - "$ref": "StyleSheetOrigin" + "name": "details", + "$ref": "InspectorIssueDetails" }, { - "name": "style", - "description": "Associated style declaration.", - "$ref": "CSSStyle" - }, - { - "name": "media", - "description": "Media list array (for rules involving media queries). The array enumerates media queries\nstarting with the innermost one, going outwards.", + "name": "issueId", + "description": "A unique id for this issue. May be omitted if no other entity (e.g.\nexception, CDP message, etc.) is referencing this issue.", "optional": true, - "type": "array", - "items": { - "$ref": "CSSMedia" - } + "$ref": "IssueId" } ] - }, + } + ], + "commands": [ { - "id": "RuleUsage", - "description": "CSS coverage information.", - "type": "object", - "properties": [ + "name": "getEncodedResponse", + "description": "Returns the response body and size if it were re-encoded with the specified settings. Only\napplies to images.", + "parameters": [ { - "name": "styleSheetId", - "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", - "$ref": "StyleSheetId" + "name": "requestId", + "description": "Identifier of the network request to get content for.", + "$ref": "Network.RequestId" }, { - "name": "startOffset", - "description": "Offset of the start of the rule (including selector) from the beginning of the stylesheet.", - "type": "number" + "name": "encoding", + "description": "The encoding to use.", + "type": "string", + "enum": [ + "webp", + "jpeg", + "png" + ] }, { - "name": "endOffset", - "description": "Offset of the end of the rule body from the beginning of the stylesheet.", + "name": "quality", + "description": "The quality of the encoding (0-1). (defaults to 1)", + "optional": true, "type": "number" }, { - "name": "used", - "description": "Indicates whether the rule was actually used by some element in the page.", + "name": "sizeOnly", + "description": "Whether to only return the size information (defaults to false).", + "optional": true, "type": "boolean" } - ] - }, - { - "id": "SourceRange", - "description": "Text range within a resource. All numbers are zero-based.", - "type": "object", - "properties": [ - { - "name": "startLine", - "description": "Start line of range.", - "type": "integer" - }, + ], + "returns": [ { - "name": "startColumn", - "description": "Start column of range (inclusive).", - "type": "integer" + "name": "body", + "description": "The encoded body as a base64 string. Omitted if sizeOnly is true. (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" }, { - "name": "endLine", - "description": "End line of range", + "name": "originalSize", + "description": "Size before re-encoding.", "type": "integer" }, { - "name": "endColumn", - "description": "End column of range (exclusive).", + "name": "encodedSize", + "description": "Size after re-encoding.", "type": "integer" } ] }, { - "id": "ShorthandEntry", - "type": "object", - "properties": [ - { - "name": "name", - "description": "Shorthand name.", - "type": "string" - }, - { - "name": "value", - "description": "Shorthand value.", - "type": "string" - }, + "name": "disable", + "description": "Disables issues domain, prevents further issues from being reported to the client." + }, + { + "name": "enable", + "description": "Enables issues domain, sends the issues collected so far to the client by means of the\n`issueAdded` event." + }, + { + "name": "checkContrast", + "description": "Runs the contrast check for the target page. Found issues are reported\nusing Audits.issueAdded event.", + "parameters": [ { - "name": "important", - "description": "Whether the property has \"!important\" annotation (implies `false` if absent).", + "name": "reportAAA", + "description": "Whether to report WCAG AAA level issues. Default is false.", "optional": true, "type": "boolean" } ] - }, + } + ], + "events": [ { - "id": "CSSComputedStyleProperty", - "type": "object", - "properties": [ - { - "name": "name", - "description": "Computed style property name.", - "type": "string" - }, + "name": "issueAdded", + "parameters": [ { - "name": "value", - "description": "Computed style property value.", - "type": "string" + "name": "issue", + "$ref": "InspectorIssue" } ] + } + ] + }, + { + "domain": "BackgroundService", + "description": "Defines events for background web platform features.", + "experimental": true, + "types": [ + { + "id": "ServiceName", + "description": "The Background Service that will be associated with the commands/events.\nEvery Background Service operates independently, but they share the same\nAPI.", + "type": "string", + "enum": [ + "backgroundFetch", + "backgroundSync", + "pushMessaging", + "notifications", + "paymentHandler", + "periodicBackgroundSync" + ] }, { - "id": "CSSStyle", - "description": "CSS style representation.", + "id": "EventMetadata", + "description": "A key-value pair for additional event information to pass along.", "type": "object", "properties": [ { - "name": "styleSheetId", - "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", - "optional": true, - "$ref": "StyleSheetId" - }, - { - "name": "cssProperties", - "description": "CSS properties in the style.", - "type": "array", - "items": { - "$ref": "CSSProperty" - } - }, - { - "name": "shorthandEntries", - "description": "Computed values for all shorthands found in the style.", - "type": "array", - "items": { - "$ref": "ShorthandEntry" - } - }, - { - "name": "cssText", - "description": "Style declaration text (if available).", - "optional": true, + "name": "key", "type": "string" }, { - "name": "range", - "description": "Style declaration range in the enclosing stylesheet (if available).", - "optional": true, - "$ref": "SourceRange" + "name": "value", + "type": "string" } ] }, { - "id": "CSSProperty", - "description": "CSS property declaration data.", + "id": "BackgroundServiceEvent", "type": "object", "properties": [ { - "name": "name", - "description": "The property name.", - "type": "string" + "name": "timestamp", + "description": "Timestamp of the event (in seconds).", + "$ref": "Network.TimeSinceEpoch" }, { - "name": "value", - "description": "The property value.", + "name": "origin", + "description": "The origin this event belongs to.", "type": "string" }, { - "name": "important", - "description": "Whether the property has \"!important\" annotation (implies `false` if absent).", - "optional": true, - "type": "boolean" + "name": "serviceWorkerRegistrationId", + "description": "The Service Worker ID that initiated the event.", + "$ref": "ServiceWorker.RegistrationID" }, { - "name": "implicit", - "description": "Whether the property is implicit (implies `false` if absent).", - "optional": true, - "type": "boolean" + "name": "service", + "description": "The Background Service this event belongs to.", + "$ref": "ServiceName" }, { - "name": "text", - "description": "The full property text as specified in the style.", - "optional": true, + "name": "eventName", + "description": "A description of the event.", "type": "string" }, { - "name": "parsedOk", - "description": "Whether the property is understood by the browser (implies `true` if absent).", - "optional": true, - "type": "boolean" + "name": "instanceId", + "description": "An identifier that groups related events together.", + "type": "string" }, { - "name": "disabled", - "description": "Whether the property is disabled by the user (present for source-based properties only).", - "optional": true, - "type": "boolean" - }, + "name": "eventMetadata", + "description": "A list of event-specific information.", + "type": "array", + "items": { + "$ref": "EventMetadata" + } + } + ] + } + ], + "commands": [ + { + "name": "startObserving", + "description": "Enables event updates for the service.", + "parameters": [ { - "name": "range", - "description": "The entire property range in the enclosing style declaration (if available).", - "optional": true, - "$ref": "SourceRange" + "name": "service", + "$ref": "ServiceName" } ] }, { - "id": "CSSMedia", - "description": "CSS media rule descriptor.", - "type": "object", - "properties": [ - { - "name": "text", - "description": "Media query text.", - "type": "string" - }, + "name": "stopObserving", + "description": "Disables event updates for the service.", + "parameters": [ { - "name": "source", - "description": "Source of the media query: \"mediaRule\" if specified by a @media rule, \"importRule\" if\nspecified by an @import rule, \"linkedSheet\" if specified by a \"media\" attribute in a linked\nstylesheet's LINK tag, \"inlineSheet\" if specified by a \"media\" attribute in an inline\nstylesheet's STYLE tag.", - "type": "string", - "enum": [ - "mediaRule", - "importRule", - "linkedSheet", - "inlineSheet" - ] - }, + "name": "service", + "$ref": "ServiceName" + } + ] + }, + { + "name": "setRecording", + "description": "Set the recording state for the service.", + "parameters": [ { - "name": "sourceURL", - "description": "URL of the document containing the media query description.", - "optional": true, - "type": "string" + "name": "shouldRecord", + "type": "boolean" }, { - "name": "range", - "description": "The associated rule (@media or @import) header range in the enclosing stylesheet (if\navailable).", - "optional": true, - "$ref": "SourceRange" - }, + "name": "service", + "$ref": "ServiceName" + } + ] + }, + { + "name": "clearEvents", + "description": "Clears all stored data for the service.", + "parameters": [ { - "name": "styleSheetId", - "description": "Identifier of the stylesheet containing this object (if exists).", - "optional": true, - "$ref": "StyleSheetId" + "name": "service", + "$ref": "ServiceName" + } + ] + } + ], + "events": [ + { + "name": "recordingStateChanged", + "description": "Called when the recording state for the service has been updated.", + "parameters": [ + { + "name": "isRecording", + "type": "boolean" }, { - "name": "mediaList", - "description": "Array of media queries.", - "optional": true, - "type": "array", - "items": { - "$ref": "MediaQuery" - } + "name": "service", + "$ref": "ServiceName" } ] }, { - "id": "MediaQuery", - "description": "Media query descriptor.", - "type": "object", - "properties": [ - { - "name": "expressions", - "description": "Array of media query expressions.", - "type": "array", - "items": { - "$ref": "MediaQueryExpression" - } - }, + "name": "backgroundServiceEventReceived", + "description": "Called with all existing backgroundServiceEvents when enabled, and all new\nevents afterwards if enabled and recording.", + "parameters": [ { - "name": "active", - "description": "Whether the media query condition is satisfied.", - "type": "boolean" + "name": "backgroundServiceEvent", + "$ref": "BackgroundServiceEvent" } ] + } + ] + }, + { + "domain": "Browser", + "description": "The Browser domain defines methods and events for browser managing.", + "types": [ + { + "id": "BrowserContextID", + "experimental": true, + "type": "string" + }, + { + "id": "WindowID", + "experimental": true, + "type": "integer" + }, + { + "id": "WindowState", + "description": "The state of the browser window.", + "experimental": true, + "type": "string", + "enum": [ + "normal", + "minimized", + "maximized", + "fullscreen" + ] }, { - "id": "MediaQueryExpression", - "description": "Media query expression descriptor.", + "id": "Bounds", + "description": "Browser window bounds information", + "experimental": true, "type": "object", "properties": [ { - "name": "value", - "description": "Media query expression value.", - "type": "number" + "name": "left", + "description": "The offset from the left edge of the screen to the window in pixels.", + "optional": true, + "type": "integer" }, { - "name": "unit", - "description": "Media query expression units.", - "type": "string" + "name": "top", + "description": "The offset from the top edge of the screen to the window in pixels.", + "optional": true, + "type": "integer" }, { - "name": "feature", - "description": "Media query expression feature.", - "type": "string" + "name": "width", + "description": "The window width in pixels.", + "optional": true, + "type": "integer" }, { - "name": "valueRange", - "description": "The associated range of the value text in the enclosing stylesheet (if available).", + "name": "height", + "description": "The window height in pixels.", "optional": true, - "$ref": "SourceRange" + "type": "integer" }, { - "name": "computedLength", - "description": "Computed length of media query expression (if applicable).", + "name": "windowState", + "description": "The window state. Default to normal.", "optional": true, - "type": "number" + "$ref": "WindowState" } ] }, { - "id": "PlatformFontUsage", - "description": "Information about amount of glyphs that were rendered with given font.", + "id": "PermissionType", + "experimental": true, + "type": "string", + "enum": [ + "accessibilityEvents", + "audioCapture", + "backgroundSync", + "backgroundFetch", + "clipboardReadWrite", + "clipboardSanitizedWrite", + "displayCapture", + "durableStorage", + "flash", + "geolocation", + "midi", + "midiSysex", + "nfc", + "notifications", + "paymentHandler", + "periodicBackgroundSync", + "protectedMediaIdentifier", + "sensors", + "videoCapture", + "videoCapturePanTiltZoom", + "idleDetection", + "wakeLockScreen", + "wakeLockSystem" + ] + }, + { + "id": "PermissionSetting", + "experimental": true, + "type": "string", + "enum": [ + "granted", + "denied", + "prompt" + ] + }, + { + "id": "PermissionDescriptor", + "description": "Definition of PermissionDescriptor defined in the Permissions API:\nhttps://w3c.github.io/permissions/#dictdef-permissiondescriptor.", + "experimental": true, "type": "object", "properties": [ { - "name": "familyName", - "description": "Font's family name reported by platform.", + "name": "name", + "description": "Name of permission.\nSee https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names.", "type": "string" }, { - "name": "isCustomFont", - "description": "Indicates if the font was downloaded or resolved locally.", + "name": "sysex", + "description": "For \"midi\" permission, may also specify sysex control.", + "optional": true, "type": "boolean" }, { - "name": "glyphCount", - "description": "Amount of glyphs that were rendered with this font.", - "type": "number" + "name": "userVisibleOnly", + "description": "For \"push\" permission, may specify userVisibleOnly.\nNote that userVisibleOnly = true is the only currently supported type.", + "optional": true, + "type": "boolean" + }, + { + "name": "allowWithoutSanitization", + "description": "For \"clipboard\" permission, may specify allowWithoutSanitization.", + "optional": true, + "type": "boolean" + }, + { + "name": "panTiltZoom", + "description": "For \"camera\" permission, may specify panTiltZoom.", + "optional": true, + "type": "boolean" } ] }, { - "id": "FontFace", - "description": "Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions", + "id": "BrowserCommandId", + "description": "Browser command ids used by executeBrowserCommand.", + "experimental": true, + "type": "string", + "enum": [ + "openTabSearch", + "closeTabSearch" + ] + }, + { + "id": "Bucket", + "description": "Chrome histogram bucket.", + "experimental": true, "type": "object", "properties": [ { - "name": "fontFamily", - "description": "The font-family.", - "type": "string" + "name": "low", + "description": "Minimum value (inclusive).", + "type": "integer" }, { - "name": "fontStyle", - "description": "The font-style.", - "type": "string" + "name": "high", + "description": "Maximum value (exclusive).", + "type": "integer" }, { - "name": "fontVariant", - "description": "The font-variant.", + "name": "count", + "description": "Number of samples.", + "type": "integer" + } + ] + }, + { + "id": "Histogram", + "description": "Chrome histogram.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "name", + "description": "Name.", "type": "string" }, { - "name": "fontWeight", - "description": "The font-weight.", - "type": "string" + "name": "sum", + "description": "Sum of sample values.", + "type": "integer" }, { - "name": "fontStretch", - "description": "The font-stretch.", - "type": "string" + "name": "count", + "description": "Total number of samples.", + "type": "integer" }, { - "name": "unicodeRange", - "description": "The unicode-range.", - "type": "string" + "name": "buckets", + "description": "Buckets.", + "type": "array", + "items": { + "$ref": "Bucket" + } + } + ] + } + ], + "commands": [ + { + "name": "setPermission", + "description": "Set permission settings for given origin.", + "experimental": true, + "parameters": [ + { + "name": "permission", + "description": "Descriptor of permission to override.", + "$ref": "PermissionDescriptor" }, { - "name": "src", - "description": "The src.", - "type": "string" + "name": "setting", + "description": "Setting of the permission.", + "$ref": "PermissionSetting" }, { - "name": "platformFontFamily", - "description": "The resolved platform font family", + "name": "origin", + "description": "Origin the permission applies to, all origins if not specified.", + "optional": true, "type": "string" + }, + { + "name": "browserContextId", + "description": "Context to override. When omitted, default browser context is used.", + "optional": true, + "$ref": "BrowserContextID" } ] }, { - "id": "CSSKeyframesRule", - "description": "CSS keyframes rule representation.", - "type": "object", - "properties": [ - { - "name": "animationName", - "description": "Animation name.", - "$ref": "Value" - }, + "name": "grantPermissions", + "description": "Grant specific permissions to the given origin and reject all others.", + "experimental": true, + "parameters": [ { - "name": "keyframes", - "description": "List of keyframes.", + "name": "permissions", "type": "array", "items": { - "$ref": "CSSKeyframeRule" + "$ref": "PermissionType" } + }, + { + "name": "origin", + "description": "Origin the permission applies to, all origins if not specified.", + "optional": true, + "type": "string" + }, + { + "name": "browserContextId", + "description": "BrowserContext to override permissions. When omitted, default browser context is used.", + "optional": true, + "$ref": "BrowserContextID" } ] }, { - "id": "CSSKeyframeRule", - "description": "CSS keyframe rule representation.", - "type": "object", - "properties": [ + "name": "resetPermissions", + "description": "Reset all permission management for all origins.", + "experimental": true, + "parameters": [ { - "name": "styleSheetId", - "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", + "name": "browserContextId", + "description": "BrowserContext to reset permissions. When omitted, default browser context is used.", "optional": true, - "$ref": "StyleSheetId" + "$ref": "BrowserContextID" + } + ] + }, + { + "name": "setDownloadBehavior", + "description": "Set the behavior when downloading a file.", + "experimental": true, + "parameters": [ + { + "name": "behavior", + "description": "Whether to allow all or deny all download requests, or use default Chrome behavior if\navailable (otherwise deny). |allowAndName| allows download and names files according to\ntheir dowmload guids.", + "type": "string", + "enum": [ + "deny", + "allow", + "allowAndName", + "default" + ] }, { - "name": "origin", - "description": "Parent stylesheet's origin.", - "$ref": "StyleSheetOrigin" + "name": "browserContextId", + "description": "BrowserContext to set download behavior. When omitted, default browser context is used.", + "optional": true, + "$ref": "BrowserContextID" }, { - "name": "keyText", - "description": "Associated key text.", - "$ref": "Value" + "name": "downloadPath", + "description": "The default path to save downloaded files to. This is required if behavior is set to 'allow'\nor 'allowAndName'.", + "optional": true, + "type": "string" }, { - "name": "style", - "description": "Associated style declaration.", - "$ref": "CSSStyle" + "name": "eventsEnabled", + "description": "Whether to emit download events (defaults to false).", + "optional": true, + "type": "boolean" } ] }, { - "id": "StyleDeclarationEdit", - "description": "A descriptor of operation to mutate style declaration text.", - "type": "object", - "properties": [ - { - "name": "styleSheetId", - "description": "The css style sheet identifier.", - "$ref": "StyleSheetId" - }, + "name": "cancelDownload", + "description": "Cancel a download if in progress", + "experimental": true, + "parameters": [ { - "name": "range", - "description": "The range of the style text in the enclosing stylesheet.", - "$ref": "SourceRange" + "name": "guid", + "description": "Global unique identifier of the download.", + "type": "string" }, { - "name": "text", - "description": "New style text.", - "type": "string" + "name": "browserContextId", + "description": "BrowserContext to perform the action in. When omitted, default browser context is used.", + "optional": true, + "$ref": "BrowserContextID" } ] - } - ], - "commands": [ + }, { - "name": "addRule", - "description": "Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the\nposition specified by `location`.", - "parameters": [ + "name": "close", + "description": "Close browser gracefully." + }, + { + "name": "crash", + "description": "Crashes browser on the main thread.", + "experimental": true + }, + { + "name": "crashGpuProcess", + "description": "Crashes GPU process.", + "experimental": true + }, + { + "name": "getVersion", + "description": "Returns version information.", + "returns": [ { - "name": "styleSheetId", - "description": "The css style sheet identifier where a new rule should be inserted.", - "$ref": "StyleSheetId" + "name": "protocolVersion", + "description": "Protocol version.", + "type": "string" }, { - "name": "ruleText", - "description": "The text of a new rule.", + "name": "product", + "description": "Product name.", "type": "string" }, { - "name": "location", - "description": "Text position of a new rule in the target style sheet.", - "$ref": "SourceRange" + "name": "revision", + "description": "Product revision.", + "type": "string" + }, + { + "name": "userAgent", + "description": "User-Agent.", + "type": "string" + }, + { + "name": "jsVersion", + "description": "V8 version.", + "type": "string" } - ], + ] + }, + { + "name": "getBrowserCommandLine", + "description": "Returns the command line switches for the browser process if, and only if\n--enable-automation is on the commandline.", + "experimental": true, "returns": [ { - "name": "rule", - "description": "The newly created rule.", - "$ref": "CSSRule" + "name": "arguments", + "description": "Commandline parameters", + "type": "array", + "items": { + "type": "string" + } } ] }, { - "name": "collectClassNames", - "description": "Returns all class names from specified stylesheet.", + "name": "getHistograms", + "description": "Get Chrome histograms.", + "experimental": true, "parameters": [ { - "name": "styleSheetId", - "$ref": "StyleSheetId" + "name": "query", + "description": "Requested substring in name. Only histograms which have query as a\nsubstring in their name are extracted. An empty or absent query returns\nall histograms.", + "optional": true, + "type": "string" + }, + { + "name": "delta", + "description": "If true, retrieve delta since last call.", + "optional": true, + "type": "boolean" } ], "returns": [ { - "name": "classNames", - "description": "Class name list.", + "name": "histograms", + "description": "Histograms.", "type": "array", "items": { - "type": "string" + "$ref": "Histogram" } } ] }, { - "name": "createStyleSheet", - "description": "Creates a new special \"via-inspector\" stylesheet in the frame with given `frameId`.", + "name": "getHistogram", + "description": "Get a Chrome histogram by name.", + "experimental": true, "parameters": [ { - "name": "frameId", - "description": "Identifier of the frame where \"via-inspector\" stylesheet should be created.", - "$ref": "Page.FrameId" + "name": "name", + "description": "Requested histogram name.", + "type": "string" + }, + { + "name": "delta", + "description": "If true, retrieve delta since last call.", + "optional": true, + "type": "boolean" } ], "returns": [ { - "name": "styleSheetId", - "description": "Identifier of the created \"via-inspector\" stylesheet.", - "$ref": "StyleSheetId" + "name": "histogram", + "description": "Histogram.", + "$ref": "Histogram" } ] }, { - "name": "disable", - "description": "Disables the CSS agent for the given page." - }, - { - "name": "enable", - "description": "Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been\nenabled until the result of this command is received." - }, - { - "name": "forcePseudoState", - "description": "Ensures that the given node will have specified pseudo-classes whenever its style is computed by\nthe browser.", + "name": "getWindowBounds", + "description": "Get position and size of the browser window.", + "experimental": true, "parameters": [ { - "name": "nodeId", - "description": "The element id for which to force the pseudo state.", - "$ref": "DOM.NodeId" - }, + "name": "windowId", + "description": "Browser window id.", + "$ref": "WindowID" + } + ], + "returns": [ { - "name": "forcedPseudoClasses", - "description": "Element pseudo classes to force when computing the element's style.", - "type": "array", - "items": { - "type": "string" - } + "name": "bounds", + "description": "Bounds information of the window. When window state is 'minimized', the restored window\nposition and size are returned.", + "$ref": "Bounds" } ] }, { - "name": "getBackgroundColors", + "name": "getWindowForTarget", + "description": "Get the browser window that contains the devtools target.", + "experimental": true, "parameters": [ { - "name": "nodeId", - "description": "Id of the node to get background colors for.", - "$ref": "DOM.NodeId" + "name": "targetId", + "description": "Devtools agent host id. If called as a part of the session, associated targetId is used.", + "optional": true, + "$ref": "Target.TargetID" } ], "returns": [ { - "name": "backgroundColors", - "description": "The range of background colors behind this element, if it contains any visible text. If no\nvisible text is present, this will be undefined. In the case of a flat background color,\nthis will consist of simply that color. In the case of a gradient, this will consist of each\nof the color stops. For anything more complicated, this will be an empty array. Images will\nbe ignored (as if the image had failed to load).", - "optional": true, - "type": "array", - "items": { - "type": "string" - } - }, - { - "name": "computedFontSize", - "description": "The computed font size for this node, as a CSS computed value string (e.g. '12px').", - "optional": true, - "type": "string" + "name": "windowId", + "description": "Browser window id.", + "$ref": "WindowID" }, { - "name": "computedFontWeight", - "description": "The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or\n'100').", - "optional": true, - "type": "string" + "name": "bounds", + "description": "Bounds information of the window. When window state is 'minimized', the restored window\nposition and size are returned.", + "$ref": "Bounds" } ] }, { - "name": "getComputedStyleForNode", - "description": "Returns the computed style for a DOM node identified by `nodeId`.", + "name": "setWindowBounds", + "description": "Set position and/or size of the browser window.", + "experimental": true, "parameters": [ { - "name": "nodeId", - "$ref": "DOM.NodeId" - } - ], - "returns": [ + "name": "windowId", + "description": "Browser window id.", + "$ref": "WindowID" + }, { - "name": "computedStyle", - "description": "Computed style for the specified DOM node.", - "type": "array", - "items": { - "$ref": "CSSComputedStyleProperty" - } + "name": "bounds", + "description": "New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined\nwith 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.", + "$ref": "Bounds" } ] }, { - "name": "getInlineStylesForNode", - "description": "Returns the styles defined inline (explicitly in the \"style\" attribute and implicitly, using DOM\nattributes) for a DOM node identified by `nodeId`.", + "name": "setDockTile", + "description": "Set dock tile details, platform-specific.", + "experimental": true, "parameters": [ { - "name": "nodeId", - "$ref": "DOM.NodeId" - } - ], - "returns": [ - { - "name": "inlineStyle", - "description": "Inline style for the specified DOM node.", + "name": "badgeLabel", "optional": true, - "$ref": "CSSStyle" + "type": "string" }, { - "name": "attributesStyle", - "description": "Attribute-defined element style (e.g. resulting from \"width=20 height=100%\").", + "name": "image", + "description": "Png encoded image. (Encoded as a base64 string when passed over JSON)", "optional": true, - "$ref": "CSSStyle" + "type": "string" } ] }, { - "name": "getMatchedStylesForNode", - "description": "Returns requested styles for a DOM node identified by `nodeId`.", + "name": "executeBrowserCommand", + "description": "Invoke custom browser commands used by telemetry.", + "experimental": true, "parameters": [ { - "name": "nodeId", - "$ref": "DOM.NodeId" + "name": "commandId", + "$ref": "BrowserCommandId" } - ], - "returns": [ + ] + } + ], + "events": [ + { + "name": "downloadWillBegin", + "description": "Fired when page is about to start a download.", + "experimental": true, + "parameters": [ { - "name": "inlineStyle", - "description": "Inline style for the specified DOM node.", - "optional": true, - "$ref": "CSSStyle" + "name": "frameId", + "description": "Id of the frame that caused the download to begin.", + "$ref": "Page.FrameId" }, { - "name": "attributesStyle", - "description": "Attribute-defined element style (e.g. resulting from \"width=20 height=100%\").", - "optional": true, - "$ref": "CSSStyle" + "name": "guid", + "description": "Global unique identifier of the download.", + "type": "string" }, { - "name": "matchedCSSRules", - "description": "CSS rules matching this node, from all applicable stylesheets.", - "optional": true, - "type": "array", - "items": { - "$ref": "RuleMatch" - } + "name": "url", + "description": "URL of the resource being downloaded.", + "type": "string" }, { - "name": "pseudoElements", - "description": "Pseudo style matches for this node.", - "optional": true, - "type": "array", - "items": { - "$ref": "PseudoElementMatches" - } + "name": "suggestedFilename", + "description": "Suggested file name of the resource (the actual name of the file saved on disk may differ).", + "type": "string" + } + ] + }, + { + "name": "downloadProgress", + "description": "Fired when download makes progress. Last call has |done| == true.", + "experimental": true, + "parameters": [ + { + "name": "guid", + "description": "Global unique identifier of the download.", + "type": "string" }, { - "name": "inherited", - "description": "A chain of inherited styles (from the immediate node parent up to the DOM tree root).", - "optional": true, - "type": "array", - "items": { - "$ref": "InheritedStyleEntry" - } + "name": "totalBytes", + "description": "Total expected bytes to download.", + "type": "number" }, { - "name": "cssKeyframesRules", - "description": "A list of CSS keyframed animations matching this node.", - "optional": true, + "name": "receivedBytes", + "description": "Total bytes received.", + "type": "number" + }, + { + "name": "state", + "description": "Download status.", + "type": "string", + "enum": [ + "inProgress", + "completed", + "canceled" + ] + } + ] + } + ] + }, + { + "domain": "CSS", + "description": "This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles)\nhave an associated `id` used in subsequent operations on the related object. Each object type has\na specific `id` structure, and those are not interchangeable between objects of different kinds.\nCSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client\ncan also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and\nsubsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods.", + "experimental": true, + "dependencies": [ + "DOM", + "Page" + ], + "types": [ + { + "id": "StyleSheetId", + "type": "string" + }, + { + "id": "StyleSheetOrigin", + "description": "Stylesheet type: \"injected\" for stylesheets injected via extension, \"user-agent\" for user-agent\nstylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding the \"via\ninspector\" rules), \"regular\" for regular stylesheets.", + "type": "string", + "enum": [ + "injected", + "user-agent", + "inspector", + "regular" + ] + }, + { + "id": "PseudoElementMatches", + "description": "CSS rule collection for a single pseudo style.", + "type": "object", + "properties": [ + { + "name": "pseudoType", + "description": "Pseudo element type.", + "$ref": "DOM.PseudoType" + }, + { + "name": "matches", + "description": "Matches of CSS rules applicable to the pseudo style.", "type": "array", "items": { - "$ref": "CSSKeyframesRule" + "$ref": "RuleMatch" } } ] }, { - "name": "getMediaQueries", - "description": "Returns all media queries parsed by the rendering engine.", - "returns": [ + "id": "InheritedStyleEntry", + "description": "Inherited CSS rule collection from ancestor node.", + "type": "object", + "properties": [ { - "name": "medias", + "name": "inlineStyle", + "description": "The ancestor node's inline style, if any, in the style inheritance chain.", + "optional": true, + "$ref": "CSSStyle" + }, + { + "name": "matchedCSSRules", + "description": "Matches of CSS rules matching the ancestor node in the style inheritance chain.", "type": "array", "items": { - "$ref": "CSSMedia" + "$ref": "RuleMatch" } } ] }, { - "name": "getPlatformFontsForNode", - "description": "Requests information about platform fonts which we used to render child TextNodes in the given\nnode.", - "parameters": [ + "id": "RuleMatch", + "description": "Match data for a CSS rule.", + "type": "object", + "properties": [ { - "name": "nodeId", - "$ref": "DOM.NodeId" - } - ], - "returns": [ + "name": "rule", + "description": "CSS rule in the match.", + "$ref": "CSSRule" + }, { - "name": "fonts", - "description": "Usage statistics for every employed platform font.", + "name": "matchingSelectors", + "description": "Matching selector indices in the rule's selectorList selectors (0-based).", "type": "array", "items": { - "$ref": "PlatformFontUsage" + "type": "integer" } } ] }, { - "name": "getStyleSheetText", - "description": "Returns the current textual content for a stylesheet.", - "parameters": [ - { - "name": "styleSheetId", - "$ref": "StyleSheetId" - } - ], - "returns": [ + "id": "Value", + "description": "Data for a simple selector (these are delimited by commas in a selector list).", + "type": "object", + "properties": [ { "name": "text", - "description": "The stylesheet text.", + "description": "Value text.", "type": "string" + }, + { + "name": "range", + "description": "Value range in the underlying resource (if available).", + "optional": true, + "$ref": "SourceRange" } ] }, { - "name": "setEffectivePropertyValueForNode", - "description": "Find a rule with the given active property for the given node and set the new value for this\nproperty", - "parameters": [ - { - "name": "nodeId", - "description": "The element id for which to set property.", - "$ref": "DOM.NodeId" - }, + "id": "SelectorList", + "description": "Selector list data.", + "type": "object", + "properties": [ { - "name": "propertyName", - "type": "string" + "name": "selectors", + "description": "Selectors in the list.", + "type": "array", + "items": { + "$ref": "Value" + } }, { - "name": "value", + "name": "text", + "description": "Rule selector text.", "type": "string" } ] }, { - "name": "setKeyframeKey", - "description": "Modifies the keyframe rule key text.", - "parameters": [ + "id": "CSSStyleSheetHeader", + "description": "CSS stylesheet metainformation.", + "type": "object", + "properties": [ { "name": "styleSheetId", + "description": "The stylesheet identifier.", "$ref": "StyleSheetId" }, { - "name": "range", - "$ref": "SourceRange" + "name": "frameId", + "description": "Owner frame identifier.", + "$ref": "Page.FrameId" }, { - "name": "keyText", + "name": "sourceURL", + "description": "Stylesheet resource URL. Empty if this is a constructed stylesheet created using\nnew CSSStyleSheet() (but non-empty if this is a constructed sylesheet imported\nas a CSS module script).", "type": "string" - } - ], - "returns": [ + }, { - "name": "keyText", - "description": "The resulting key text after modification.", - "$ref": "Value" + "name": "sourceMapURL", + "description": "URL of source map associated with the stylesheet (if any).", + "optional": true, + "type": "string" + }, + { + "name": "origin", + "description": "Stylesheet origin.", + "$ref": "StyleSheetOrigin" + }, + { + "name": "title", + "description": "Stylesheet title.", + "type": "string" + }, + { + "name": "ownerNode", + "description": "The backend id for the owner node of the stylesheet.", + "optional": true, + "$ref": "DOM.BackendNodeId" + }, + { + "name": "disabled", + "description": "Denotes whether the stylesheet is disabled.", + "type": "boolean" + }, + { + "name": "hasSourceURL", + "description": "Whether the sourceURL field value comes from the sourceURL comment.", + "optional": true, + "type": "boolean" + }, + { + "name": "isInline", + "description": "Whether this stylesheet is created for STYLE tag by parser. This flag is not set for\ndocument.written STYLE tags.", + "type": "boolean" + }, + { + "name": "isMutable", + "description": "Whether this stylesheet is mutable. Inline stylesheets become mutable\nafter they have been modified via CSSOM API.\n element's stylesheets become mutable only if DevTools modifies them.\nConstructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.", + "type": "boolean" + }, + { + "name": "isConstructed", + "description": "True if this stylesheet is created through new CSSStyleSheet() or imported as a\nCSS module script.", + "type": "boolean" + }, + { + "name": "startLine", + "description": "Line offset of the stylesheet within the resource (zero based).", + "type": "number" + }, + { + "name": "startColumn", + "description": "Column offset of the stylesheet within the resource (zero based).", + "type": "number" + }, + { + "name": "length", + "description": "Size of the content (in characters).", + "type": "number" + }, + { + "name": "endLine", + "description": "Line offset of the end of the stylesheet within the resource (zero based).", + "type": "number" + }, + { + "name": "endColumn", + "description": "Column offset of the end of the stylesheet within the resource (zero based).", + "type": "number" } ] }, { - "name": "setMediaText", - "description": "Modifies the rule selector.", - "parameters": [ + "id": "CSSRule", + "description": "CSS rule representation.", + "type": "object", + "properties": [ { "name": "styleSheetId", + "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", + "optional": true, "$ref": "StyleSheetId" }, { - "name": "range", - "$ref": "SourceRange" + "name": "selectorList", + "description": "Rule selector data.", + "$ref": "SelectorList" }, { - "name": "text", - "type": "string" - } - ], - "returns": [ + "name": "origin", + "description": "Parent stylesheet's origin.", + "$ref": "StyleSheetOrigin" + }, + { + "name": "style", + "description": "Associated style declaration.", + "$ref": "CSSStyle" + }, { "name": "media", - "description": "The resulting CSS media rule after modification.", - "$ref": "CSSMedia" + "description": "Media list array (for rules involving media queries). The array enumerates media queries\nstarting with the innermost one, going outwards.", + "optional": true, + "type": "array", + "items": { + "$ref": "CSSMedia" + } + }, + { + "name": "containerQueries", + "description": "Container query list array (for rules involving container queries).\nThe array enumerates container queries starting with the innermost one, going outwards.", + "experimental": true, + "optional": true, + "type": "array", + "items": { + "$ref": "CSSContainerQuery" + } } ] }, { - "name": "setRuleSelector", - "description": "Modifies the rule selector.", - "parameters": [ + "id": "RuleUsage", + "description": "CSS coverage information.", + "type": "object", + "properties": [ { "name": "styleSheetId", + "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", "$ref": "StyleSheetId" }, { - "name": "range", - "$ref": "SourceRange" + "name": "startOffset", + "description": "Offset of the start of the rule (including selector) from the beginning of the stylesheet.", + "type": "number" }, { - "name": "selector", - "type": "string" + "name": "endOffset", + "description": "Offset of the end of the rule body from the beginning of the stylesheet.", + "type": "number" + }, + { + "name": "used", + "description": "Indicates whether the rule was actually used by some element in the page.", + "type": "boolean" } - ], - "returns": [ + ] + }, + { + "id": "SourceRange", + "description": "Text range within a resource. All numbers are zero-based.", + "type": "object", + "properties": [ { - "name": "selectorList", - "description": "The resulting selector list after modification.", - "$ref": "SelectorList" + "name": "startLine", + "description": "Start line of range.", + "type": "integer" + }, + { + "name": "startColumn", + "description": "Start column of range (inclusive).", + "type": "integer" + }, + { + "name": "endLine", + "description": "End line of range", + "type": "integer" + }, + { + "name": "endColumn", + "description": "End column of range (exclusive).", + "type": "integer" } ] }, { - "name": "setStyleSheetText", - "description": "Sets the new stylesheet text.", - "parameters": [ + "id": "ShorthandEntry", + "type": "object", + "properties": [ { - "name": "styleSheetId", - "$ref": "StyleSheetId" + "name": "name", + "description": "Shorthand name.", + "type": "string" }, { - "name": "text", + "name": "value", + "description": "Shorthand value.", "type": "string" - } - ], - "returns": [ + }, { - "name": "sourceMapURL", - "description": "URL of source map associated with script (if any).", + "name": "important", + "description": "Whether the property has \"!important\" annotation (implies `false` if absent).", "optional": true, - "type": "string" + "type": "boolean" } ] }, { - "name": "setStyleTexts", - "description": "Applies specified style edits one after another in the given order.", - "parameters": [ + "id": "CSSComputedStyleProperty", + "type": "object", + "properties": [ { - "name": "edits", - "type": "array", - "items": { - "$ref": "StyleDeclarationEdit" - } - } - ], - "returns": [ + "name": "name", + "description": "Computed style property name.", + "type": "string" + }, { - "name": "styles", - "description": "The resulting styles after modification.", - "type": "array", - "items": { - "$ref": "CSSStyle" - } + "name": "value", + "description": "Computed style property value.", + "type": "string" } ] }, { - "name": "startRuleUsageTracking", - "description": "Enables the selector recording." - }, - { - "name": "stopRuleUsageTracking", - "description": "Stop tracking rule usage and return the list of rules that were used since last call to\n`takeCoverageDelta` (or since start of coverage instrumentation)", - "returns": [ + "id": "CSSStyle", + "description": "CSS style representation.", + "type": "object", + "properties": [ { - "name": "ruleUsage", + "name": "styleSheetId", + "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", + "optional": true, + "$ref": "StyleSheetId" + }, + { + "name": "cssProperties", + "description": "CSS properties in the style.", "type": "array", "items": { - "$ref": "RuleUsage" + "$ref": "CSSProperty" } - } - ] - }, - { - "name": "takeCoverageDelta", - "description": "Obtain list of rules that became used since last call to this method (or since start of coverage\ninstrumentation)", - "returns": [ + }, { - "name": "coverage", + "name": "shorthandEntries", + "description": "Computed values for all shorthands found in the style.", "type": "array", "items": { - "$ref": "RuleUsage" + "$ref": "ShorthandEntry" } - } - ] - } - ], - "events": [ - { - "name": "fontsUpdated", - "description": "Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded\nweb font", - "parameters": [ + }, { - "name": "font", - "description": "The web font that has loaded.", + "name": "cssText", + "description": "Style declaration text (if available).", "optional": true, - "$ref": "FontFace" - } - ] - }, - { - "name": "mediaQueryResultChanged", - "description": "Fires whenever a MediaQuery result changes (for example, after a browser window has been\nresized.) The current implementation considers only viewport-dependent media features." - }, - { - "name": "styleSheetAdded", - "description": "Fired whenever an active document stylesheet is added.", - "parameters": [ - { - "name": "header", - "description": "Added stylesheet metainfo.", - "$ref": "CSSStyleSheetHeader" - } - ] - }, - { - "name": "styleSheetChanged", - "description": "Fired whenever a stylesheet is changed as a result of the client operation.", - "parameters": [ - { - "name": "styleSheetId", - "$ref": "StyleSheetId" - } - ] - }, - { - "name": "styleSheetRemoved", - "description": "Fired whenever an active document stylesheet is removed.", - "parameters": [ + "type": "string" + }, { - "name": "styleSheetId", - "description": "Identifier of the removed stylesheet.", - "$ref": "StyleSheetId" + "name": "range", + "description": "Style declaration range in the enclosing stylesheet (if available).", + "optional": true, + "$ref": "SourceRange" } ] - } - ] - }, - { - "domain": "CacheStorage", - "experimental": true, - "types": [ - { - "id": "CacheId", - "description": "Unique identifier of the Cache object.", - "type": "string" - }, - { - "id": "CachedResponseType", - "description": "type of HTTP response cached", - "type": "string", - "enum": [ - "basic", - "cors", - "default", - "error", - "opaqueResponse", - "opaqueRedirect" - ] }, { - "id": "DataEntry", - "description": "Data entry.", + "id": "CSSProperty", + "description": "CSS property declaration data.", "type": "object", "properties": [ { - "name": "requestURL", - "description": "Request URL.", + "name": "name", + "description": "The property name.", "type": "string" }, { - "name": "requestMethod", - "description": "Request method.", + "name": "value", + "description": "The property value.", "type": "string" }, { - "name": "requestHeaders", - "description": "Request headers", - "type": "array", - "items": { - "$ref": "Header" - } + "name": "important", + "description": "Whether the property has \"!important\" annotation (implies `false` if absent).", + "optional": true, + "type": "boolean" }, { - "name": "responseTime", - "description": "Number of seconds since epoch.", - "type": "number" + "name": "implicit", + "description": "Whether the property is implicit (implies `false` if absent).", + "optional": true, + "type": "boolean" }, { - "name": "responseStatus", - "description": "HTTP response status code.", - "type": "integer" + "name": "text", + "description": "The full property text as specified in the style.", + "optional": true, + "type": "string" }, { - "name": "responseStatusText", - "description": "HTTP response status text.", - "type": "string" + "name": "parsedOk", + "description": "Whether the property is understood by the browser (implies `true` if absent).", + "optional": true, + "type": "boolean" }, { - "name": "responseType", - "description": "HTTP response type", - "$ref": "CachedResponseType" + "name": "disabled", + "description": "Whether the property is disabled by the user (present for source-based properties only).", + "optional": true, + "type": "boolean" }, { - "name": "responseHeaders", - "description": "Response headers", - "type": "array", - "items": { - "$ref": "Header" - } + "name": "range", + "description": "The entire property range in the enclosing style declaration (if available).", + "optional": true, + "$ref": "SourceRange" } ] }, { - "id": "Cache", - "description": "Cache identifier.", + "id": "CSSMedia", + "description": "CSS media rule descriptor.", "type": "object", "properties": [ { - "name": "cacheId", - "description": "An opaque unique id of the cache.", - "$ref": "CacheId" + "name": "text", + "description": "Media query text.", + "type": "string" }, { - "name": "securityOrigin", - "description": "Security origin of the cache.", - "type": "string" + "name": "source", + "description": "Source of the media query: \"mediaRule\" if specified by a @media rule, \"importRule\" if\nspecified by an @import rule, \"linkedSheet\" if specified by a \"media\" attribute in a linked\nstylesheet's LINK tag, \"inlineSheet\" if specified by a \"media\" attribute in an inline\nstylesheet's STYLE tag.", + "type": "string", + "enum": [ + "mediaRule", + "importRule", + "linkedSheet", + "inlineSheet" + ] }, { - "name": "cacheName", - "description": "The name of the cache.", + "name": "sourceURL", + "description": "URL of the document containing the media query description.", + "optional": true, "type": "string" + }, + { + "name": "range", + "description": "The associated rule (@media or @import) header range in the enclosing stylesheet (if\navailable).", + "optional": true, + "$ref": "SourceRange" + }, + { + "name": "styleSheetId", + "description": "Identifier of the stylesheet containing this object (if exists).", + "optional": true, + "$ref": "StyleSheetId" + }, + { + "name": "mediaList", + "description": "Array of media queries.", + "optional": true, + "type": "array", + "items": { + "$ref": "MediaQuery" + } } ] }, { - "id": "Header", + "id": "MediaQuery", + "description": "Media query descriptor.", "type": "object", "properties": [ { - "name": "name", - "type": "string" + "name": "expressions", + "description": "Array of media query expressions.", + "type": "array", + "items": { + "$ref": "MediaQueryExpression" + } }, { - "name": "value", - "type": "string" + "name": "active", + "description": "Whether the media query condition is satisfied.", + "type": "boolean" } ] }, { - "id": "CachedResponse", - "description": "Cached response", - "type": "object", + "id": "MediaQueryExpression", + "description": "Media query expression descriptor.", + "type": "object", "properties": [ { - "name": "body", - "description": "Entry content, base64-encoded.", + "name": "value", + "description": "Media query expression value.", + "type": "number" + }, + { + "name": "unit", + "description": "Media query expression units.", "type": "string" - } - ] - } - ], - "commands": [ - { - "name": "deleteCache", - "description": "Deletes a cache.", - "parameters": [ + }, { - "name": "cacheId", - "description": "Id of cache for deletion.", - "$ref": "CacheId" - } - ] - }, - { - "name": "deleteEntry", - "description": "Deletes a cache entry.", - "parameters": [ + "name": "feature", + "description": "Media query expression feature.", + "type": "string" + }, { - "name": "cacheId", - "description": "Id of cache where the entry will be deleted.", - "$ref": "CacheId" + "name": "valueRange", + "description": "The associated range of the value text in the enclosing stylesheet (if available).", + "optional": true, + "$ref": "SourceRange" }, { - "name": "request", - "description": "URL spec of the request.", - "type": "string" + "name": "computedLength", + "description": "Computed length of media query expression (if applicable).", + "optional": true, + "type": "number" } ] }, { - "name": "requestCacheNames", - "description": "Requests cache names.", - "parameters": [ + "id": "CSSContainerQuery", + "description": "CSS container query rule descriptor.", + "experimental": true, + "type": "object", + "properties": [ { - "name": "securityOrigin", - "description": "Security origin.", + "name": "text", + "description": "Container query text.", "type": "string" - } - ], - "returns": [ + }, { - "name": "caches", - "description": "Caches for the security origin.", - "type": "array", - "items": { - "$ref": "Cache" - } + "name": "range", + "description": "The associated rule header range in the enclosing stylesheet (if\navailable).", + "optional": true, + "$ref": "SourceRange" + }, + { + "name": "styleSheetId", + "description": "Identifier of the stylesheet containing this object (if exists).", + "optional": true, + "$ref": "StyleSheetId" + }, + { + "name": "name", + "description": "Optional name for the container.", + "optional": true, + "type": "string" } ] }, { - "name": "requestCachedResponse", - "description": "Fetches cache entry.", - "parameters": [ - { - "name": "cacheId", - "description": "Id of cache that contains the entry.", - "$ref": "CacheId" - }, + "id": "PlatformFontUsage", + "description": "Information about amount of glyphs that were rendered with given font.", + "type": "object", + "properties": [ { - "name": "requestURL", - "description": "URL spec of the request.", + "name": "familyName", + "description": "Font's family name reported by platform.", "type": "string" }, { - "name": "requestHeaders", - "description": "headers of the request.", - "type": "array", - "items": { - "$ref": "Header" - } - } - ], - "returns": [ + "name": "isCustomFont", + "description": "Indicates if the font was downloaded or resolved locally.", + "type": "boolean" + }, { - "name": "response", - "description": "Response read from the cache.", - "$ref": "CachedResponse" + "name": "glyphCount", + "description": "Amount of glyphs that were rendered with this font.", + "type": "number" } ] }, { - "name": "requestEntries", - "description": "Requests data from cache.", - "parameters": [ + "id": "FontVariationAxis", + "description": "Information about font variation axes for variable fonts", + "type": "object", + "properties": [ { - "name": "cacheId", - "description": "ID of cache to get entries from.", - "$ref": "CacheId" + "name": "tag", + "description": "The font-variation-setting tag (a.k.a. \"axis tag\").", + "type": "string" }, { - "name": "skipCount", - "description": "Number of records to skip.", - "type": "integer" + "name": "name", + "description": "Human-readable variation name in the default language (normally, \"en\").", + "type": "string" }, { - "name": "pageSize", - "description": "Number of records to fetch.", - "type": "integer" + "name": "minValue", + "description": "The minimum value (inclusive) the font supports for this tag.", + "type": "number" }, { - "name": "pathFilter", - "description": "If present, only return the entries containing this substring in the path", - "optional": true, - "type": "string" - } - ], - "returns": [ - { - "name": "cacheDataEntries", - "description": "Array of object store data entries.", - "type": "array", - "items": { - "$ref": "DataEntry" - } + "name": "maxValue", + "description": "The maximum value (inclusive) the font supports for this tag.", + "type": "number" }, { - "name": "returnCount", - "description": "Count of returned entries from this storage. If pathFilter is empty, it\nis the count of all entries from this storage.", + "name": "defaultValue", + "description": "The default value.", "type": "number" } ] - } - ] - }, - { - "domain": "Cast", - "description": "A domain for interacting with Cast, Presentation API, and Remote Playback API\nfunctionalities.", - "experimental": true, - "types": [ + }, { - "id": "Sink", + "id": "FontFace", + "description": "Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions\nand additional information such as platformFontFamily and fontVariationAxes.", "type": "object", "properties": [ { - "name": "name", + "name": "fontFamily", + "description": "The font-family.", "type": "string" }, { - "name": "id", + "name": "fontStyle", + "description": "The font-style.", "type": "string" }, { - "name": "session", - "description": "Text describing the current session. Present only if there is an active\nsession on the sink.", - "optional": true, + "name": "fontVariant", + "description": "The font-variant.", "type": "string" - } - ] - } - ], - "commands": [ - { - "name": "enable", - "description": "Starts observing for sinks that can be used for tab mirroring, and if set,\nsinks compatible with |presentationUrl| as well. When sinks are found, a\n|sinksUpdated| event is fired.\nAlso starts observing for issue messages. When an issue is added or removed,\nan |issueUpdated| event is fired.", - "parameters": [ + }, { - "name": "presentationUrl", - "optional": true, + "name": "fontWeight", + "description": "The font-weight.", "type": "string" - } - ] - }, - { - "name": "disable", - "description": "Stops observing for sinks and issues." - }, - { - "name": "setSinkToUse", - "description": "Sets a sink to be used when the web page requests the browser to choose a\nsink via Presentation API, Remote Playback API, or Cast SDK.", - "parameters": [ + }, { - "name": "sinkName", + "name": "fontStretch", + "description": "The font-stretch.", "type": "string" - } - ] - }, - { - "name": "startTabMirroring", - "description": "Starts mirroring the tab to the sink.", - "parameters": [ + }, { - "name": "sinkName", + "name": "unicodeRange", + "description": "The unicode-range.", "type": "string" - } - ] - }, - { - "name": "stopCasting", - "description": "Stops the active Cast session on the sink.", - "parameters": [ + }, { - "name": "sinkName", + "name": "src", + "description": "The src.", "type": "string" - } - ] - } - ], - "events": [ - { - "name": "sinksUpdated", - "description": "This is fired whenever the list of available sinks changes. A sink is a\ndevice or a software surface that you can cast to.", - "parameters": [ + }, { - "name": "sinks", + "name": "platformFontFamily", + "description": "The resolved platform font family", + "type": "string" + }, + { + "name": "fontVariationAxes", + "description": "Available variation settings (a.k.a. \"axes\").", + "optional": true, "type": "array", "items": { - "$ref": "Sink" + "$ref": "FontVariationAxis" } } ] }, { - "name": "issueUpdated", - "description": "This is fired whenever the outstanding issue/error message changes.\n|issueMessage| is empty if there is no issue.", - "parameters": [ + "id": "CSSKeyframesRule", + "description": "CSS keyframes rule representation.", + "type": "object", + "properties": [ { - "name": "issueMessage", - "type": "string" - } - ] - } - ] - }, - { - "domain": "DOM", - "description": "This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object\nthat has an `id`. This `id` can be used to get additional information on the Node, resolve it into\nthe JavaScript object wrapper, etc. It is important that client receives DOM events only for the\nnodes that are known to the client. Backend keeps track of the nodes that were sent to the client\nand never sends the same node twice. It is client's responsibility to collect information about\nthe nodes that were sent to the client.

Note that `iframe` owner elements will return\ncorresponding document elements as their child nodes.

", - "dependencies": [ - "Runtime" - ], - "types": [ - { - "id": "NodeId", - "description": "Unique DOM node identifier.", - "type": "integer" - }, - { - "id": "BackendNodeId", - "description": "Unique DOM node identifier used to reference a node that may not have been pushed to the\nfront-end.", - "type": "integer" + "name": "animationName", + "description": "Animation name.", + "$ref": "Value" + }, + { + "name": "keyframes", + "description": "List of keyframes.", + "type": "array", + "items": { + "$ref": "CSSKeyframeRule" + } + } + ] }, { - "id": "BackendNode", - "description": "Backend node with a friendly name.", + "id": "CSSKeyframeRule", + "description": "CSS keyframe rule representation.", "type": "object", "properties": [ { - "name": "nodeType", - "description": "`Node`'s nodeType.", - "type": "integer" + "name": "styleSheetId", + "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified\nstylesheet rules) this rule came from.", + "optional": true, + "$ref": "StyleSheetId" }, { - "name": "nodeName", - "description": "`Node`'s nodeName.", - "type": "string" + "name": "origin", + "description": "Parent stylesheet's origin.", + "$ref": "StyleSheetOrigin" }, { - "name": "backendNodeId", - "$ref": "BackendNodeId" + "name": "keyText", + "description": "Associated key text.", + "$ref": "Value" + }, + { + "name": "style", + "description": "Associated style declaration.", + "$ref": "CSSStyle" } ] }, { - "id": "PseudoType", - "description": "Pseudo element type.", - "type": "string", - "enum": [ - "first-line", - "first-letter", - "before", - "after", - "backdrop", - "selection", - "first-line-inherited", - "scrollbar", - "scrollbar-thumb", - "scrollbar-button", - "scrollbar-track", - "scrollbar-track-piece", - "scrollbar-corner", - "resizer", - "input-list-button" - ] - }, - { - "id": "ShadowRootType", - "description": "Shadow root type.", - "type": "string", - "enum": [ - "user-agent", - "open", - "closed" - ] - }, - { - "id": "Node", - "description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.\nDOMNode is a base node mirror type.", + "id": "StyleDeclarationEdit", + "description": "A descriptor of operation to mutate style declaration text.", "type": "object", "properties": [ { - "name": "nodeId", - "description": "Node identifier that is passed into the rest of the DOM messages as the `nodeId`. Backend\nwill only push node with given `id` once. It is aware of all requested nodes and will only\nfire DOM events for nodes known to the client.", - "$ref": "NodeId" + "name": "styleSheetId", + "description": "The css style sheet identifier.", + "$ref": "StyleSheetId" }, { - "name": "parentId", - "description": "The id of the parent node if any.", - "optional": true, - "$ref": "NodeId" + "name": "range", + "description": "The range of the style text in the enclosing stylesheet.", + "$ref": "SourceRange" }, { - "name": "backendNodeId", - "description": "The BackendNodeId for this node.", - "$ref": "BackendNodeId" - }, + "name": "text", + "description": "New style text.", + "type": "string" + } + ] + } + ], + "commands": [ + { + "name": "addRule", + "description": "Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the\nposition specified by `location`.", + "parameters": [ { - "name": "nodeType", - "description": "`Node`'s nodeType.", - "type": "integer" + "name": "styleSheetId", + "description": "The css style sheet identifier where a new rule should be inserted.", + "$ref": "StyleSheetId" }, { - "name": "nodeName", - "description": "`Node`'s nodeName.", + "name": "ruleText", + "description": "The text of a new rule.", "type": "string" }, { - "name": "localName", - "description": "`Node`'s localName.", - "type": "string" - }, + "name": "location", + "description": "Text position of a new rule in the target style sheet.", + "$ref": "SourceRange" + } + ], + "returns": [ { - "name": "nodeValue", - "description": "`Node`'s nodeValue.", - "type": "string" - }, + "name": "rule", + "description": "The newly created rule.", + "$ref": "CSSRule" + } + ] + }, + { + "name": "collectClassNames", + "description": "Returns all class names from specified stylesheet.", + "parameters": [ { - "name": "childNodeCount", - "description": "Child count for `Container` nodes.", - "optional": true, - "type": "integer" - }, + "name": "styleSheetId", + "$ref": "StyleSheetId" + } + ], + "returns": [ { - "name": "children", - "description": "Child nodes of this node when requested with children.", - "optional": true, + "name": "classNames", + "description": "Class name list.", "type": "array", "items": { - "$ref": "Node" + "type": "string" } + } + ] + }, + { + "name": "createStyleSheet", + "description": "Creates a new special \"via-inspector\" stylesheet in the frame with given `frameId`.", + "parameters": [ + { + "name": "frameId", + "description": "Identifier of the frame where \"via-inspector\" stylesheet should be created.", + "$ref": "Page.FrameId" + } + ], + "returns": [ + { + "name": "styleSheetId", + "description": "Identifier of the created \"via-inspector\" stylesheet.", + "$ref": "StyleSheetId" + } + ] + }, + { + "name": "disable", + "description": "Disables the CSS agent for the given page." + }, + { + "name": "enable", + "description": "Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been\nenabled until the result of this command is received." + }, + { + "name": "forcePseudoState", + "description": "Ensures that the given node will have specified pseudo-classes whenever its style is computed by\nthe browser.", + "parameters": [ + { + "name": "nodeId", + "description": "The element id for which to force the pseudo state.", + "$ref": "DOM.NodeId" }, { - "name": "attributes", - "description": "Attributes of the `Element` node in the form of flat array `[name1, value1, name2, value2]`.", - "optional": true, + "name": "forcedPseudoClasses", + "description": "Element pseudo classes to force when computing the element's style.", "type": "array", "items": { "type": "string" } - }, - { - "name": "documentURL", - "description": "Document URL that `Document` or `FrameOwner` node points to.", - "optional": true, - "type": "string" - }, + } + ] + }, + { + "name": "getBackgroundColors", + "parameters": [ { - "name": "baseURL", - "description": "Base URL that `Document` or `FrameOwner` node uses for URL completion.", - "optional": true, - "type": "string" - }, + "name": "nodeId", + "description": "Id of the node to get background colors for.", + "$ref": "DOM.NodeId" + } + ], + "returns": [ { - "name": "publicId", - "description": "`DocumentType`'s publicId.", + "name": "backgroundColors", + "description": "The range of background colors behind this element, if it contains any visible text. If no\nvisible text is present, this will be undefined. In the case of a flat background color,\nthis will consist of simply that color. In the case of a gradient, this will consist of each\nof the color stops. For anything more complicated, this will be an empty array. Images will\nbe ignored (as if the image had failed to load).", "optional": true, - "type": "string" + "type": "array", + "items": { + "type": "string" + } }, { - "name": "systemId", - "description": "`DocumentType`'s systemId.", + "name": "computedFontSize", + "description": "The computed font size for this node, as a CSS computed value string (e.g. '12px').", "optional": true, "type": "string" }, { - "name": "internalSubset", - "description": "`DocumentType`'s internalSubset.", + "name": "computedFontWeight", + "description": "The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or\n'100').", "optional": true, "type": "string" - }, + } + ] + }, + { + "name": "getComputedStyleForNode", + "description": "Returns the computed style for a DOM node identified by `nodeId`.", + "parameters": [ { - "name": "xmlVersion", - "description": "`Document`'s XML version in case of XML documents.", - "optional": true, - "type": "string" - }, + "name": "nodeId", + "$ref": "DOM.NodeId" + } + ], + "returns": [ { - "name": "name", - "description": "`Attr`'s name.", - "optional": true, - "type": "string" - }, + "name": "computedStyle", + "description": "Computed style for the specified DOM node.", + "type": "array", + "items": { + "$ref": "CSSComputedStyleProperty" + } + } + ] + }, + { + "name": "getInlineStylesForNode", + "description": "Returns the styles defined inline (explicitly in the \"style\" attribute and implicitly, using DOM\nattributes) for a DOM node identified by `nodeId`.", + "parameters": [ { - "name": "value", - "description": "`Attr`'s value.", - "optional": true, - "type": "string" - }, + "name": "nodeId", + "$ref": "DOM.NodeId" + } + ], + "returns": [ { - "name": "pseudoType", - "description": "Pseudo element type for this node.", + "name": "inlineStyle", + "description": "Inline style for the specified DOM node.", "optional": true, - "$ref": "PseudoType" + "$ref": "CSSStyle" }, { - "name": "shadowRootType", - "description": "Shadow root type.", + "name": "attributesStyle", + "description": "Attribute-defined element style (e.g. resulting from \"width=20 height=100%\").", "optional": true, - "$ref": "ShadowRootType" - }, + "$ref": "CSSStyle" + } + ] + }, + { + "name": "getMatchedStylesForNode", + "description": "Returns requested styles for a DOM node identified by `nodeId`.", + "parameters": [ { - "name": "frameId", - "description": "Frame ID for frame owner elements.", + "name": "nodeId", + "$ref": "DOM.NodeId" + } + ], + "returns": [ + { + "name": "inlineStyle", + "description": "Inline style for the specified DOM node.", "optional": true, - "$ref": "Page.FrameId" + "$ref": "CSSStyle" }, { - "name": "contentDocument", - "description": "Content document for frame owner elements.", + "name": "attributesStyle", + "description": "Attribute-defined element style (e.g. resulting from \"width=20 height=100%\").", "optional": true, - "$ref": "Node" + "$ref": "CSSStyle" }, { - "name": "shadowRoots", - "description": "Shadow root list for given element host.", + "name": "matchedCSSRules", + "description": "CSS rules matching this node, from all applicable stylesheets.", "optional": true, "type": "array", "items": { - "$ref": "Node" + "$ref": "RuleMatch" } }, - { - "name": "templateContent", - "description": "Content document fragment for template elements.", - "optional": true, - "$ref": "Node" - }, { "name": "pseudoElements", - "description": "Pseudo elements associated with this node.", + "description": "Pseudo style matches for this node.", "optional": true, "type": "array", "items": { - "$ref": "Node" + "$ref": "PseudoElementMatches" } }, { - "name": "importedDocument", - "description": "Import document for the HTMLImport links.", - "optional": true, - "$ref": "Node" - }, - { - "name": "distributedNodes", - "description": "Distributed nodes for given insertion point.", + "name": "inherited", + "description": "A chain of inherited styles (from the immediate node parent up to the DOM tree root).", "optional": true, "type": "array", "items": { - "$ref": "BackendNode" + "$ref": "InheritedStyleEntry" } }, { - "name": "isSVG", - "description": "Whether the node is SVG.", + "name": "cssKeyframesRules", + "description": "A list of CSS keyframed animations matching this node.", "optional": true, - "type": "boolean" + "type": "array", + "items": { + "$ref": "CSSKeyframesRule" + } } ] }, { - "id": "RGBA", - "description": "A structure holding an RGBA color.", - "type": "object", - "properties": [ - { - "name": "r", - "description": "The red component, in the [0-255] range.", - "type": "integer" - }, - { - "name": "g", - "description": "The green component, in the [0-255] range.", - "type": "integer" - }, - { - "name": "b", - "description": "The blue component, in the [0-255] range.", - "type": "integer" - }, + "name": "getMediaQueries", + "description": "Returns all media queries parsed by the rendering engine.", + "returns": [ { - "name": "a", - "description": "The alpha component, in the [0-1] range (default: 1).", - "optional": true, - "type": "number" + "name": "medias", + "type": "array", + "items": { + "$ref": "CSSMedia" + } } ] }, { - "id": "Quad", - "description": "An array of quad vertices, x immediately followed by y for each point, points clock-wise.", - "type": "array", - "items": { - "type": "number" - } - }, - { - "id": "BoxModel", - "description": "Box model.", - "type": "object", - "properties": [ - { - "name": "content", - "description": "Content box", - "$ref": "Quad" - }, - { - "name": "padding", - "description": "Padding box", - "$ref": "Quad" - }, - { - "name": "border", - "description": "Border box", - "$ref": "Quad" - }, + "name": "getPlatformFontsForNode", + "description": "Requests information about platform fonts which we used to render child TextNodes in the given\nnode.", + "parameters": [ { - "name": "margin", - "description": "Margin box", - "$ref": "Quad" - }, + "name": "nodeId", + "$ref": "DOM.NodeId" + } + ], + "returns": [ { - "name": "width", - "description": "Node width", - "type": "integer" - }, + "name": "fonts", + "description": "Usage statistics for every employed platform font.", + "type": "array", + "items": { + "$ref": "PlatformFontUsage" + } + } + ] + }, + { + "name": "getStyleSheetText", + "description": "Returns the current textual content for a stylesheet.", + "parameters": [ { - "name": "height", - "description": "Node height", - "type": "integer" - }, + "name": "styleSheetId", + "$ref": "StyleSheetId" + } + ], + "returns": [ { - "name": "shapeOutside", - "description": "Shape outside coordinates", - "optional": true, - "$ref": "ShapeOutsideInfo" + "name": "text", + "description": "The stylesheet text.", + "type": "string" } ] }, { - "id": "ShapeOutsideInfo", - "description": "CSS Shape Outside details.", - "type": "object", - "properties": [ - { - "name": "bounds", - "description": "Shape bounds", - "$ref": "Quad" - }, + "name": "trackComputedStyleUpdates", + "description": "Starts tracking the given computed styles for updates. The specified array of properties\nreplaces the one previously specified. Pass empty array to disable tracking.\nUse takeComputedStyleUpdates to retrieve the list of nodes that had properties modified.\nThe changes to computed style properties are only tracked for nodes pushed to the front-end\nby the DOM agent. If no changes to the tracked properties occur after the node has been pushed\nto the front-end, no updates will be issued for the node.", + "experimental": true, + "parameters": [ { - "name": "shape", - "description": "Shape coordinate details", + "name": "propertiesToTrack", "type": "array", "items": { - "type": "any" + "$ref": "CSSComputedStyleProperty" } - }, + } + ] + }, + { + "name": "takeComputedStyleUpdates", + "description": "Polls the next batch of computed style updates.", + "experimental": true, + "returns": [ { - "name": "marginShape", - "description": "Margin shape bounds", + "name": "nodeIds", + "description": "The list of node Ids that have their tracked computed styles updated", "type": "array", "items": { - "type": "any" + "$ref": "DOM.NodeId" } } ] }, { - "id": "Rect", - "description": "Rectangle.", - "type": "object", - "properties": [ + "name": "setEffectivePropertyValueForNode", + "description": "Find a rule with the given active property for the given node and set the new value for this\nproperty", + "parameters": [ { - "name": "x", - "description": "X coordinate", - "type": "number" - }, - { - "name": "y", - "description": "Y coordinate", - "type": "number" + "name": "nodeId", + "description": "The element id for which to set property.", + "$ref": "DOM.NodeId" }, { - "name": "width", - "description": "Rectangle width", - "type": "number" + "name": "propertyName", + "type": "string" }, { - "name": "height", - "description": "Rectangle height", - "type": "number" + "name": "value", + "type": "string" } ] - } - ], - "commands": [ + }, { - "name": "collectClassNamesFromSubtree", - "description": "Collects class names for the node with given id and all of it's child nodes.", - "experimental": true, + "name": "setKeyframeKey", + "description": "Modifies the keyframe rule key text.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node to collect class names.", - "$ref": "NodeId" + "name": "styleSheetId", + "$ref": "StyleSheetId" + }, + { + "name": "range", + "$ref": "SourceRange" + }, + { + "name": "keyText", + "type": "string" } ], "returns": [ { - "name": "classNames", - "description": "Class name list.", - "type": "array", - "items": { - "type": "string" - } + "name": "keyText", + "description": "The resulting key text after modification.", + "$ref": "Value" } ] }, { - "name": "copyTo", - "description": "Creates a deep copy of the specified node and places it into the target container before the\ngiven anchor.", - "experimental": true, + "name": "setMediaText", + "description": "Modifies the rule selector.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node to copy.", - "$ref": "NodeId" + "name": "styleSheetId", + "$ref": "StyleSheetId" }, { - "name": "targetNodeId", - "description": "Id of the element to drop the copy into.", - "$ref": "NodeId" + "name": "range", + "$ref": "SourceRange" }, { - "name": "insertBeforeNodeId", - "description": "Drop the copy before this node (if absent, the copy becomes the last child of\n`targetNodeId`).", - "optional": true, - "$ref": "NodeId" + "name": "text", + "type": "string" } ], "returns": [ { - "name": "nodeId", - "description": "Id of the node clone.", - "$ref": "NodeId" + "name": "media", + "description": "The resulting CSS media rule after modification.", + "$ref": "CSSMedia" } ] }, { - "name": "describeNode", - "description": "Describes node given its id, does not require domain to be enabled. Does not start tracking any\nobjects, can be used for automation.", + "name": "setContainerQueryText", + "description": "Modifies the expression of a container query.", + "experimental": true, "parameters": [ { - "name": "nodeId", - "description": "Identifier of the node.", - "optional": true, - "$ref": "NodeId" - }, - { - "name": "backendNodeId", - "description": "Identifier of the backend node.", - "optional": true, - "$ref": "BackendNodeId" - }, - { - "name": "objectId", - "description": "JavaScript object id of the node wrapper.", - "optional": true, - "$ref": "Runtime.RemoteObjectId" + "name": "styleSheetId", + "$ref": "StyleSheetId" }, { - "name": "depth", - "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", - "optional": true, - "type": "integer" + "name": "range", + "$ref": "SourceRange" }, { - "name": "pierce", - "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false).", - "optional": true, - "type": "boolean" + "name": "text", + "type": "string" } ], "returns": [ { - "name": "node", - "description": "Node description.", - "$ref": "Node" + "name": "containerQuery", + "description": "The resulting CSS container query rule after modification.", + "$ref": "CSSContainerQuery" } ] }, { - "name": "disable", - "description": "Disables DOM agent for the given page." - }, - { - "name": "discardSearchResults", - "description": "Discards search results from the session with the given id. `getSearchResults` should no longer\nbe called for that search.", - "experimental": true, + "name": "setRuleSelector", + "description": "Modifies the rule selector.", "parameters": [ { - "name": "searchId", - "description": "Unique search session identifier.", + "name": "styleSheetId", + "$ref": "StyleSheetId" + }, + { + "name": "range", + "$ref": "SourceRange" + }, + { + "name": "selector", "type": "string" } + ], + "returns": [ + { + "name": "selectorList", + "description": "The resulting selector list after modification.", + "$ref": "SelectorList" + } ] }, { - "name": "enable", - "description": "Enables DOM agent for the given page." - }, - { - "name": "focus", - "description": "Focuses the given element.", + "name": "setStyleSheetText", + "description": "Sets the new stylesheet text.", "parameters": [ { - "name": "nodeId", - "description": "Identifier of the node.", - "optional": true, - "$ref": "NodeId" + "name": "styleSheetId", + "$ref": "StyleSheetId" }, { - "name": "backendNodeId", - "description": "Identifier of the backend node.", - "optional": true, - "$ref": "BackendNodeId" - }, + "name": "text", + "type": "string" + } + ], + "returns": [ { - "name": "objectId", - "description": "JavaScript object id of the node wrapper.", + "name": "sourceMapURL", + "description": "URL of source map associated with script (if any).", "optional": true, - "$ref": "Runtime.RemoteObjectId" + "type": "string" } ] }, { - "name": "getAttributes", - "description": "Returns attributes for the specified node.", + "name": "setStyleTexts", + "description": "Applies specified style edits one after another in the given order.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node to retrieve attibutes for.", - "$ref": "NodeId" + "name": "edits", + "type": "array", + "items": { + "$ref": "StyleDeclarationEdit" + } } ], "returns": [ { - "name": "attributes", - "description": "An interleaved array of node attribute names and values.", + "name": "styles", + "description": "The resulting styles after modification.", "type": "array", "items": { - "type": "string" + "$ref": "CSSStyle" } } ] }, { - "name": "getBoxModel", - "description": "Returns boxes for the given node.", - "parameters": [ - { - "name": "nodeId", - "description": "Identifier of the node.", - "optional": true, - "$ref": "NodeId" - }, - { - "name": "backendNodeId", - "description": "Identifier of the backend node.", - "optional": true, - "$ref": "BackendNodeId" - }, - { - "name": "objectId", - "description": "JavaScript object id of the node wrapper.", - "optional": true, - "$ref": "Runtime.RemoteObjectId" - } - ], - "returns": [ - { - "name": "model", - "description": "Box model for the node.", - "$ref": "BoxModel" - } - ] + "name": "startRuleUsageTracking", + "description": "Enables the selector recording." }, { - "name": "getContentQuads", - "description": "Returns quads that describe node position on the page. This method\nmight return multiple quads for inline nodes.", - "experimental": true, - "parameters": [ - { - "name": "nodeId", - "description": "Identifier of the node.", - "optional": true, - "$ref": "NodeId" - }, - { - "name": "backendNodeId", - "description": "Identifier of the backend node.", - "optional": true, - "$ref": "BackendNodeId" - }, - { - "name": "objectId", - "description": "JavaScript object id of the node wrapper.", - "optional": true, - "$ref": "Runtime.RemoteObjectId" - } - ], + "name": "stopRuleUsageTracking", + "description": "Stop tracking rule usage and return the list of rules that were used since last call to\n`takeCoverageDelta` (or since start of coverage instrumentation)", "returns": [ { - "name": "quads", - "description": "Quads that describe node layout relative to viewport.", + "name": "ruleUsage", "type": "array", "items": { - "$ref": "Quad" + "$ref": "RuleUsage" } } ] }, { - "name": "getDocument", - "description": "Returns the root DOM node (and optionally the subtree) to the caller.", - "parameters": [ - { - "name": "depth", - "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", - "optional": true, - "type": "integer" - }, - { - "name": "pierce", - "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false).", - "optional": true, - "type": "boolean" - } - ], - "returns": [ - { - "name": "root", - "description": "Resulting node.", - "$ref": "Node" - } - ] - }, - { - "name": "getFlattenedDocument", - "description": "Returns the root DOM node (and optionally the subtree) to the caller.", - "parameters": [ - { - "name": "depth", - "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", - "optional": true, - "type": "integer" - }, - { - "name": "pierce", - "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false).", - "optional": true, - "type": "boolean" - } - ], + "name": "takeCoverageDelta", + "description": "Obtain list of rules that became used since last call to this method (or since start of coverage\ninstrumentation)", "returns": [ { - "name": "nodes", - "description": "Resulting node.", + "name": "coverage", "type": "array", "items": { - "$ref": "Node" + "$ref": "RuleUsage" } + }, + { + "name": "timestamp", + "description": "Monotonically increasing time, in seconds.", + "type": "number" } ] }, { - "name": "getNodeForLocation", - "description": "Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is\neither returned or not.", + "name": "setLocalFontsEnabled", + "description": "Enables/disables rendering of local CSS fonts (enabled by default).", "experimental": true, "parameters": [ { - "name": "x", - "description": "X coordinate.", - "type": "integer" - }, - { - "name": "y", - "description": "Y coordinate.", - "type": "integer" - }, - { - "name": "includeUserAgentShadowDOM", - "description": "False to skip to the nearest non-UA shadow root ancestor (default: false).", - "optional": true, + "name": "enabled", + "description": "Whether rendering of local fonts is enabled.", "type": "boolean" } - ], - "returns": [ - { - "name": "backendNodeId", - "description": "Resulting node.", - "$ref": "BackendNodeId" - }, + ] + } + ], + "events": [ + { + "name": "fontsUpdated", + "description": "Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded\nweb font", + "parameters": [ { - "name": "nodeId", - "description": "Id of the node at given coordinates, only when enabled and requested document.", + "name": "font", + "description": "The web font that has loaded.", "optional": true, - "$ref": "NodeId" + "$ref": "FontFace" } ] }, { - "name": "getOuterHTML", - "description": "Returns node's HTML markup.", + "name": "mediaQueryResultChanged", + "description": "Fires whenever a MediaQuery result changes (for example, after a browser window has been\nresized.) The current implementation considers only viewport-dependent media features." + }, + { + "name": "styleSheetAdded", + "description": "Fired whenever an active document stylesheet is added.", "parameters": [ { - "name": "nodeId", - "description": "Identifier of the node.", - "optional": true, - "$ref": "NodeId" - }, - { - "name": "backendNodeId", - "description": "Identifier of the backend node.", - "optional": true, - "$ref": "BackendNodeId" - }, - { - "name": "objectId", - "description": "JavaScript object id of the node wrapper.", - "optional": true, - "$ref": "Runtime.RemoteObjectId" - } - ], - "returns": [ - { - "name": "outerHTML", - "description": "Outer HTML markup.", - "type": "string" + "name": "header", + "description": "Added stylesheet metainfo.", + "$ref": "CSSStyleSheetHeader" } ] }, { - "name": "getRelayoutBoundary", - "description": "Returns the id of the nearest ancestor that is a relayout boundary.", - "experimental": true, + "name": "styleSheetChanged", + "description": "Fired whenever a stylesheet is changed as a result of the client operation.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node.", - "$ref": "NodeId" + "name": "styleSheetId", + "$ref": "StyleSheetId" } - ], - "returns": [ + ] + }, + { + "name": "styleSheetRemoved", + "description": "Fired whenever an active document stylesheet is removed.", + "parameters": [ { - "name": "nodeId", - "description": "Relayout boundary node id for the given node.", - "$ref": "NodeId" + "name": "styleSheetId", + "description": "Identifier of the removed stylesheet.", + "$ref": "StyleSheetId" } ] + } + ] + }, + { + "domain": "CacheStorage", + "experimental": true, + "types": [ + { + "id": "CacheId", + "description": "Unique identifier of the Cache object.", + "type": "string" }, { - "name": "getSearchResults", - "description": "Returns search results from given `fromIndex` to given `toIndex` from the search with the given\nidentifier.", - "experimental": true, - "parameters": [ + "id": "CachedResponseType", + "description": "type of HTTP response cached", + "type": "string", + "enum": [ + "basic", + "cors", + "default", + "error", + "opaqueResponse", + "opaqueRedirect" + ] + }, + { + "id": "DataEntry", + "description": "Data entry.", + "type": "object", + "properties": [ { - "name": "searchId", - "description": "Unique search session identifier.", + "name": "requestURL", + "description": "Request URL.", "type": "string" }, { - "name": "fromIndex", - "description": "Start index of the search result to be returned.", - "type": "integer" + "name": "requestMethod", + "description": "Request method.", + "type": "string" }, { - "name": "toIndex", - "description": "End index of the search result to be returned.", + "name": "requestHeaders", + "description": "Request headers", + "type": "array", + "items": { + "$ref": "Header" + } + }, + { + "name": "responseTime", + "description": "Number of seconds since epoch.", + "type": "number" + }, + { + "name": "responseStatus", + "description": "HTTP response status code.", "type": "integer" - } - ], - "returns": [ + }, { - "name": "nodeIds", - "description": "Ids of the search result nodes.", + "name": "responseStatusText", + "description": "HTTP response status text.", + "type": "string" + }, + { + "name": "responseType", + "description": "HTTP response type", + "$ref": "CachedResponseType" + }, + { + "name": "responseHeaders", + "description": "Response headers", "type": "array", "items": { - "$ref": "NodeId" + "$ref": "Header" } } ] }, { - "name": "hideHighlight", - "description": "Hides any highlight.", - "redirect": "Overlay" - }, - { - "name": "highlightNode", - "description": "Highlights DOM node.", - "redirect": "Overlay" - }, - { - "name": "highlightRect", - "description": "Highlights given rectangle.", - "redirect": "Overlay" - }, - { - "name": "markUndoableState", - "description": "Marks last undoable state.", - "experimental": true - }, - { - "name": "moveTo", - "description": "Moves node into the new container, places it before the given anchor.", - "parameters": [ + "id": "Cache", + "description": "Cache identifier.", + "type": "object", + "properties": [ { - "name": "nodeId", - "description": "Id of the node to move.", - "$ref": "NodeId" + "name": "cacheId", + "description": "An opaque unique id of the cache.", + "$ref": "CacheId" }, { - "name": "targetNodeId", - "description": "Id of the element to drop the moved node into.", - "$ref": "NodeId" + "name": "securityOrigin", + "description": "Security origin of the cache.", + "type": "string" }, { - "name": "insertBeforeNodeId", - "description": "Drop node before this one (if absent, the moved node becomes the last child of\n`targetNodeId`).", - "optional": true, - "$ref": "NodeId" - } - ], - "returns": [ - { - "name": "nodeId", - "description": "New id of the moved node.", - "$ref": "NodeId" + "name": "cacheName", + "description": "The name of the cache.", + "type": "string" } ] }, { - "name": "performSearch", - "description": "Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or\n`cancelSearch` to end this search session.", - "experimental": true, - "parameters": [ + "id": "Header", + "type": "object", + "properties": [ { - "name": "query", - "description": "Plain text or query selector or XPath search query.", + "name": "name", "type": "string" }, { - "name": "includeUserAgentShadowDOM", - "description": "True to search in user agent shadow DOM.", - "optional": true, - "type": "boolean" + "name": "value", + "type": "string" } - ], - "returns": [ + ] + }, + { + "id": "CachedResponse", + "description": "Cached response", + "type": "object", + "properties": [ { - "name": "searchId", - "description": "Unique search session identifier.", + "name": "body", + "description": "Entry content, base64-encoded. (Encoded as a base64 string when passed over JSON)", "type": "string" - }, + } + ] + } + ], + "commands": [ + { + "name": "deleteCache", + "description": "Deletes a cache.", + "parameters": [ { - "name": "resultCount", - "description": "Number of search results.", - "type": "integer" + "name": "cacheId", + "description": "Id of cache for deletion.", + "$ref": "CacheId" } ] }, { - "name": "pushNodeByPathToFrontend", - "description": "Requests that the node is sent to the caller given its path. // FIXME, use XPath", - "experimental": true, + "name": "deleteEntry", + "description": "Deletes a cache entry.", "parameters": [ { - "name": "path", - "description": "Path to node in the proprietary format.", - "type": "string" - } - ], - "returns": [ + "name": "cacheId", + "description": "Id of cache where the entry will be deleted.", + "$ref": "CacheId" + }, { - "name": "nodeId", - "description": "Id of the node for given path.", - "$ref": "NodeId" + "name": "request", + "description": "URL spec of the request.", + "type": "string" } ] }, { - "name": "pushNodesByBackendIdsToFrontend", - "description": "Requests that a batch of nodes is sent to the caller given their backend node ids.", - "experimental": true, + "name": "requestCacheNames", + "description": "Requests cache names.", "parameters": [ { - "name": "backendNodeIds", - "description": "The array of backend node ids.", - "type": "array", - "items": { - "$ref": "BackendNodeId" - } + "name": "securityOrigin", + "description": "Security origin.", + "type": "string" } ], "returns": [ { - "name": "nodeIds", - "description": "The array of ids of pushed nodes that correspond to the backend ids specified in\nbackendNodeIds.", + "name": "caches", + "description": "Caches for the security origin.", "type": "array", "items": { - "$ref": "NodeId" + "$ref": "Cache" } } ] }, { - "name": "querySelector", - "description": "Executes `querySelector` on a given node.", + "name": "requestCachedResponse", + "description": "Fetches cache entry.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node to query upon.", - "$ref": "NodeId" + "name": "cacheId", + "description": "Id of cache that contains the entry.", + "$ref": "CacheId" }, { - "name": "selector", - "description": "Selector string.", + "name": "requestURL", + "description": "URL spec of the request.", "type": "string" + }, + { + "name": "requestHeaders", + "description": "headers of the request.", + "type": "array", + "items": { + "$ref": "Header" + } } ], "returns": [ { - "name": "nodeId", - "description": "Query selector result.", - "$ref": "NodeId" + "name": "response", + "description": "Response read from the cache.", + "$ref": "CachedResponse" } ] }, { - "name": "querySelectorAll", - "description": "Executes `querySelectorAll` on a given node.", + "name": "requestEntries", + "description": "Requests data from cache.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node to query upon.", - "$ref": "NodeId" + "name": "cacheId", + "description": "ID of cache to get entries from.", + "$ref": "CacheId" }, { - "name": "selector", - "description": "Selector string.", + "name": "skipCount", + "description": "Number of records to skip.", + "optional": true, + "type": "integer" + }, + { + "name": "pageSize", + "description": "Number of records to fetch.", + "optional": true, + "type": "integer" + }, + { + "name": "pathFilter", + "description": "If present, only return the entries containing this substring in the path", + "optional": true, "type": "string" } ], "returns": [ { - "name": "nodeIds", - "description": "Query selector result.", + "name": "cacheDataEntries", + "description": "Array of object store data entries.", "type": "array", "items": { - "$ref": "NodeId" + "$ref": "DataEntry" } + }, + { + "name": "returnCount", + "description": "Count of returned entries from this storage. If pathFilter is empty, it\nis the count of all entries from this storage.", + "type": "number" } ] - }, - { - "name": "redo", - "description": "Re-does the last undone action.", - "experimental": true - }, + } + ] + }, + { + "domain": "Cast", + "description": "A domain for interacting with Cast, Presentation API, and Remote Playback API\nfunctionalities.", + "experimental": true, + "types": [ { - "name": "removeAttribute", - "description": "Removes attribute with given name from an element with given id.", - "parameters": [ + "id": "Sink", + "type": "object", + "properties": [ { - "name": "nodeId", - "description": "Id of the element to remove attribute from.", - "$ref": "NodeId" + "name": "name", + "type": "string" }, { - "name": "name", - "description": "Name of the attribute to remove.", + "name": "id", + "type": "string" + }, + { + "name": "session", + "description": "Text describing the current session. Present only if there is an active\nsession on the sink.", + "optional": true, "type": "string" } ] - }, + } + ], + "commands": [ { - "name": "removeNode", - "description": "Removes node with given id.", + "name": "enable", + "description": "Starts observing for sinks that can be used for tab mirroring, and if set,\nsinks compatible with |presentationUrl| as well. When sinks are found, a\n|sinksUpdated| event is fired.\nAlso starts observing for issue messages. When an issue is added or removed,\nan |issueUpdated| event is fired.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node to remove.", - "$ref": "NodeId" + "name": "presentationUrl", + "optional": true, + "type": "string" } ] }, { - "name": "requestChildNodes", - "description": "Requests that children of the node with given id are returned to the caller in form of\n`setChildNodes` events where not only immediate children are retrieved, but all children down to\nthe specified depth.", + "name": "disable", + "description": "Stops observing for sinks and issues." + }, + { + "name": "setSinkToUse", + "description": "Sets a sink to be used when the web page requests the browser to choose a\nsink via Presentation API, Remote Playback API, or Cast SDK.", "parameters": [ { - "name": "nodeId", - "description": "Id of the node to get children for.", - "$ref": "NodeId" - }, - { - "name": "depth", - "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", - "optional": true, - "type": "integer" - }, - { - "name": "pierce", - "description": "Whether or not iframes and shadow roots should be traversed when returning the sub-tree\n(default is false).", - "optional": true, - "type": "boolean" + "name": "sinkName", + "type": "string" } ] }, { - "name": "requestNode", - "description": "Requests that the node is sent to the caller given the JavaScript node object reference. All\nnodes that form the path from the node to the root are also sent to the client as a series of\n`setChildNodes` notifications.", + "name": "startDesktopMirroring", + "description": "Starts mirroring the desktop to the sink.", "parameters": [ { - "name": "objectId", - "description": "JavaScript object id to convert into node.", - "$ref": "Runtime.RemoteObjectId" - } - ], - "returns": [ - { - "name": "nodeId", - "description": "Node id for given object.", - "$ref": "NodeId" + "name": "sinkName", + "type": "string" } ] }, { - "name": "resolveNode", - "description": "Resolves the JavaScript node object for a given NodeId or BackendNodeId.", - "parameters": [ - { - "name": "nodeId", - "description": "Id of the node to resolve.", - "optional": true, - "$ref": "NodeId" - }, - { - "name": "backendNodeId", - "description": "Backend identifier of the node to resolve.", - "optional": true, - "$ref": "DOM.BackendNodeId" - }, - { - "name": "objectGroup", - "description": "Symbolic group name that can be used to release multiple objects.", - "optional": true, - "type": "string" - }, - { - "name": "executionContextId", - "description": "Execution context in which to resolve the node.", - "optional": true, - "$ref": "Runtime.ExecutionContextId" - } - ], - "returns": [ - { - "name": "object", - "description": "JavaScript object wrapper for given node.", - "$ref": "Runtime.RemoteObject" - } - ] - }, - { - "name": "setAttributeValue", - "description": "Sets attribute for an element with given id.", + "name": "startTabMirroring", + "description": "Starts mirroring the tab to the sink.", "parameters": [ { - "name": "nodeId", - "description": "Id of the element to set attribute for.", - "$ref": "NodeId" - }, - { - "name": "name", - "description": "Attribute name.", - "type": "string" - }, - { - "name": "value", - "description": "Attribute value.", + "name": "sinkName", "type": "string" } ] }, { - "name": "setAttributesAsText", - "description": "Sets attributes on element with given id. This method is useful when user edits some existing\nattribute value and types in several attribute name/value pairs.", + "name": "stopCasting", + "description": "Stops the active Cast session on the sink.", "parameters": [ { - "name": "nodeId", - "description": "Id of the element to set attributes for.", - "$ref": "NodeId" - }, - { - "name": "text", - "description": "Text with a number of attributes. Will parse this text using HTML parser.", - "type": "string" - }, - { - "name": "name", - "description": "Attribute name to replace with new attributes derived from text in case text parsed\nsuccessfully.", - "optional": true, + "name": "sinkName", "type": "string" } ] - }, + } + ], + "events": [ { - "name": "setFileInputFiles", - "description": "Sets files for the given file input element.", + "name": "sinksUpdated", + "description": "This is fired whenever the list of available sinks changes. A sink is a\ndevice or a software surface that you can cast to.", "parameters": [ { - "name": "files", - "description": "Array of file paths to set.", + "name": "sinks", "type": "array", "items": { - "type": "string" + "$ref": "Sink" } - }, - { - "name": "nodeId", - "description": "Identifier of the node.", - "optional": true, - "$ref": "NodeId" - }, - { - "name": "backendNodeId", - "description": "Identifier of the backend node.", - "optional": true, - "$ref": "BackendNodeId" - }, - { - "name": "objectId", - "description": "JavaScript object id of the node wrapper.", - "optional": true, - "$ref": "Runtime.RemoteObjectId" } ] }, { - "name": "getFileInfo", - "description": "Returns file information for the given\nFile wrapper.", - "experimental": true, + "name": "issueUpdated", + "description": "This is fired whenever the outstanding issue/error message changes.\n|issueMessage| is empty if there is no issue.", "parameters": [ { - "name": "objectId", - "description": "JavaScript object id of the node wrapper.", - "$ref": "Runtime.RemoteObjectId" - } - ], - "returns": [ - { - "name": "path", + "name": "issueMessage", "type": "string" } ] + } + ] + }, + { + "domain": "DOM", + "description": "This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object\nthat has an `id`. This `id` can be used to get additional information on the Node, resolve it into\nthe JavaScript object wrapper, etc. It is important that client receives DOM events only for the\nnodes that are known to the client. Backend keeps track of the nodes that were sent to the client\nand never sends the same node twice. It is client's responsibility to collect information about\nthe nodes that were sent to the client.

Note that `iframe` owner elements will return\ncorresponding document elements as their child nodes.

", + "dependencies": [ + "Runtime" + ], + "types": [ + { + "id": "NodeId", + "description": "Unique DOM node identifier.", + "type": "integer" }, { - "name": "setInspectedNode", - "description": "Enables console to refer to the node with given id via $x (see Command Line API for more details\n$x functions).", - "experimental": true, - "parameters": [ - { - "name": "nodeId", - "description": "DOM node id to be accessible by means of $x command line API.", - "$ref": "NodeId" - } - ] + "id": "BackendNodeId", + "description": "Unique DOM node identifier used to reference a node that may not have been pushed to the\nfront-end.", + "type": "integer" }, { - "name": "setNodeName", - "description": "Sets node name for a node with given id.", - "parameters": [ + "id": "BackendNode", + "description": "Backend node with a friendly name.", + "type": "object", + "properties": [ { - "name": "nodeId", - "description": "Id of the node to set name for.", - "$ref": "NodeId" + "name": "nodeType", + "description": "`Node`'s nodeType.", + "type": "integer" }, { - "name": "name", - "description": "New node's name.", + "name": "nodeName", + "description": "`Node`'s nodeName.", "type": "string" - } - ], - "returns": [ + }, { - "name": "nodeId", - "description": "New node's id.", - "$ref": "NodeId" + "name": "backendNodeId", + "$ref": "BackendNodeId" } ] }, { - "name": "setNodeValue", - "description": "Sets node value for a node with given id.", - "parameters": [ - { - "name": "nodeId", - "description": "Id of the node to set value for.", - "$ref": "NodeId" - }, - { - "name": "value", - "description": "New node's value.", - "type": "string" - } + "id": "PseudoType", + "description": "Pseudo element type.", + "type": "string", + "enum": [ + "first-line", + "first-letter", + "before", + "after", + "marker", + "backdrop", + "selection", + "target-text", + "spelling-error", + "grammar-error", + "highlight", + "first-line-inherited", + "scrollbar", + "scrollbar-thumb", + "scrollbar-button", + "scrollbar-track", + "scrollbar-track-piece", + "scrollbar-corner", + "resizer", + "input-list-button", + "transition", + "transition-container", + "transition-old-content", + "transition-new-content" ] }, { - "name": "setOuterHTML", - "description": "Sets node HTML markup, returns new node id.", - "parameters": [ - { - "name": "nodeId", - "description": "Id of the node to set markup for.", - "$ref": "NodeId" - }, - { - "name": "outerHTML", - "description": "Outer HTML markup to set.", - "type": "string" - } + "id": "ShadowRootType", + "description": "Shadow root type.", + "type": "string", + "enum": [ + "user-agent", + "open", + "closed" ] }, { - "name": "undo", - "description": "Undoes the last performed action.", - "experimental": true + "id": "CompatibilityMode", + "description": "Document compatibility mode.", + "type": "string", + "enum": [ + "QuirksMode", + "LimitedQuirksMode", + "NoQuirksMode" + ] }, { - "name": "getFrameOwner", - "description": "Returns iframe node that owns iframe with the given domain.", - "experimental": true, - "parameters": [ + "id": "Node", + "description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes.\nDOMNode is a base node mirror type.", + "type": "object", + "properties": [ { - "name": "frameId", - "$ref": "Page.FrameId" - } - ], - "returns": [ + "name": "nodeId", + "description": "Node identifier that is passed into the rest of the DOM messages as the `nodeId`. Backend\nwill only push node with given `id` once. It is aware of all requested nodes and will only\nfire DOM events for nodes known to the client.", + "$ref": "NodeId" + }, + { + "name": "parentId", + "description": "The id of the parent node if any.", + "optional": true, + "$ref": "NodeId" + }, { "name": "backendNodeId", - "description": "Resulting node.", + "description": "The BackendNodeId for this node.", "$ref": "BackendNodeId" }, { - "name": "nodeId", - "description": "Id of the node at given coordinates, only when enabled and requested document.", - "optional": true, - "$ref": "NodeId" - } - ] - } - ], - "events": [ - { - "name": "attributeModified", - "description": "Fired when `Element`'s attribute is modified.", - "parameters": [ + "name": "nodeType", + "description": "`Node`'s nodeType.", + "type": "integer" + }, { - "name": "nodeId", - "description": "Id of the node that has changed.", - "$ref": "NodeId" + "name": "nodeName", + "description": "`Node`'s nodeName.", + "type": "string" }, { - "name": "name", - "description": "Attribute name.", + "name": "localName", + "description": "`Node`'s localName.", "type": "string" }, { - "name": "value", - "description": "Attribute value.", + "name": "nodeValue", + "description": "`Node`'s nodeValue.", "type": "string" - } - ] - }, - { - "name": "attributeRemoved", - "description": "Fired when `Element`'s attribute is removed.", - "parameters": [ + }, { - "name": "nodeId", - "description": "Id of the node that has changed.", - "$ref": "NodeId" + "name": "childNodeCount", + "description": "Child count for `Container` nodes.", + "optional": true, + "type": "integer" }, { - "name": "name", - "description": "A ttribute name.", + "name": "children", + "description": "Child nodes of this node when requested with children.", + "optional": true, + "type": "array", + "items": { + "$ref": "Node" + } + }, + { + "name": "attributes", + "description": "Attributes of the `Element` node in the form of flat array `[name1, value1, name2, value2]`.", + "optional": true, + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "documentURL", + "description": "Document URL that `Document` or `FrameOwner` node points to.", + "optional": true, "type": "string" - } - ] - }, - { - "name": "characterDataModified", - "description": "Mirrors `DOMCharacterDataModified` event.", - "parameters": [ + }, { - "name": "nodeId", - "description": "Id of the node that has changed.", - "$ref": "NodeId" + "name": "baseURL", + "description": "Base URL that `Document` or `FrameOwner` node uses for URL completion.", + "optional": true, + "type": "string" }, { - "name": "characterData", - "description": "New text value.", + "name": "publicId", + "description": "`DocumentType`'s publicId.", + "optional": true, "type": "string" - } - ] - }, - { - "name": "childNodeCountUpdated", - "description": "Fired when `Container`'s child node count has changed.", - "parameters": [ + }, { - "name": "nodeId", - "description": "Id of the node that has changed.", - "$ref": "NodeId" + "name": "systemId", + "description": "`DocumentType`'s systemId.", + "optional": true, + "type": "string" }, { - "name": "childNodeCount", - "description": "New node count.", - "type": "integer" - } - ] - }, - { - "name": "childNodeInserted", - "description": "Mirrors `DOMNodeInserted` event.", - "parameters": [ + "name": "internalSubset", + "description": "`DocumentType`'s internalSubset.", + "optional": true, + "type": "string" + }, { - "name": "parentNodeId", - "description": "Id of the node that has changed.", - "$ref": "NodeId" + "name": "xmlVersion", + "description": "`Document`'s XML version in case of XML documents.", + "optional": true, + "type": "string" }, { - "name": "previousNodeId", - "description": "If of the previous siblint.", - "$ref": "NodeId" + "name": "name", + "description": "`Attr`'s name.", + "optional": true, + "type": "string" }, { - "name": "node", - "description": "Inserted node data.", + "name": "value", + "description": "`Attr`'s value.", + "optional": true, + "type": "string" + }, + { + "name": "pseudoType", + "description": "Pseudo element type for this node.", + "optional": true, + "$ref": "PseudoType" + }, + { + "name": "shadowRootType", + "description": "Shadow root type.", + "optional": true, + "$ref": "ShadowRootType" + }, + { + "name": "frameId", + "description": "Frame ID for frame owner elements.", + "optional": true, + "$ref": "Page.FrameId" + }, + { + "name": "contentDocument", + "description": "Content document for frame owner elements.", + "optional": true, "$ref": "Node" - } - ] - }, - { - "name": "childNodeRemoved", - "description": "Mirrors `DOMNodeRemoved` event.", - "parameters": [ + }, { - "name": "parentNodeId", - "description": "Parent id.", - "$ref": "NodeId" + "name": "shadowRoots", + "description": "Shadow root list for given element host.", + "optional": true, + "type": "array", + "items": { + "$ref": "Node" + } }, { - "name": "nodeId", - "description": "Id of the node that has been removed.", - "$ref": "NodeId" - } - ] - }, - { - "name": "distributedNodesUpdated", - "description": "Called when distrubution is changed.", - "experimental": true, - "parameters": [ + "name": "templateContent", + "description": "Content document fragment for template elements.", + "optional": true, + "$ref": "Node" + }, { - "name": "insertionPointId", - "description": "Insertion point where distrubuted nodes were updated.", - "$ref": "NodeId" + "name": "pseudoElements", + "description": "Pseudo elements associated with this node.", + "optional": true, + "type": "array", + "items": { + "$ref": "Node" + } + }, + { + "name": "importedDocument", + "description": "Deprecated, as the HTML Imports API has been removed (crbug.com/937746).\nThis property used to return the imported document for the HTMLImport links.\nThe property is always undefined now.", + "deprecated": true, + "optional": true, + "$ref": "Node" }, { "name": "distributedNodes", "description": "Distributed nodes for given insertion point.", + "optional": true, "type": "array", "items": { "$ref": "BackendNode" } + }, + { + "name": "isSVG", + "description": "Whether the node is SVG.", + "optional": true, + "type": "boolean" + }, + { + "name": "compatibilityMode", + "optional": true, + "$ref": "CompatibilityMode" } ] }, { - "name": "documentUpdated", - "description": "Fired when `Document` has been totally updated. Node ids are no longer valid." - }, - { - "name": "inlineStyleInvalidated", - "description": "Fired when `Element`'s inline style is modified via a CSS property modification.", - "experimental": true, - "parameters": [ + "id": "RGBA", + "description": "A structure holding an RGBA color.", + "type": "object", + "properties": [ { - "name": "nodeIds", - "description": "Ids of the nodes for which the inline styles have been invalidated.", - "type": "array", - "items": { - "$ref": "NodeId" - } + "name": "r", + "description": "The red component, in the [0-255] range.", + "type": "integer" + }, + { + "name": "g", + "description": "The green component, in the [0-255] range.", + "type": "integer" + }, + { + "name": "b", + "description": "The blue component, in the [0-255] range.", + "type": "integer" + }, + { + "name": "a", + "description": "The alpha component, in the [0-1] range (default: 1).", + "optional": true, + "type": "number" } ] }, { - "name": "pseudoElementAdded", - "description": "Called when a pseudo element is added to an element.", - "experimental": true, - "parameters": [ + "id": "Quad", + "description": "An array of quad vertices, x immediately followed by y for each point, points clock-wise.", + "type": "array", + "items": { + "type": "number" + } + }, + { + "id": "BoxModel", + "description": "Box model.", + "type": "object", + "properties": [ { - "name": "parentId", - "description": "Pseudo element's parent element id.", - "$ref": "NodeId" + "name": "content", + "description": "Content box", + "$ref": "Quad" }, { - "name": "pseudoElement", - "description": "The added pseudo element.", - "$ref": "Node" - } - ] - }, - { - "name": "pseudoElementRemoved", - "description": "Called when a pseudo element is removed from an element.", - "experimental": true, - "parameters": [ + "name": "padding", + "description": "Padding box", + "$ref": "Quad" + }, { - "name": "parentId", - "description": "Pseudo element's parent element id.", - "$ref": "NodeId" + "name": "border", + "description": "Border box", + "$ref": "Quad" }, { - "name": "pseudoElementId", - "description": "The removed pseudo element id.", - "$ref": "NodeId" + "name": "margin", + "description": "Margin box", + "$ref": "Quad" + }, + { + "name": "width", + "description": "Node width", + "type": "integer" + }, + { + "name": "height", + "description": "Node height", + "type": "integer" + }, + { + "name": "shapeOutside", + "description": "Shape outside coordinates", + "optional": true, + "$ref": "ShapeOutsideInfo" } ] }, { - "name": "setChildNodes", - "description": "Fired when backend wants to provide client with the missing DOM structure. This happens upon\nmost of the calls requesting node ids.", - "parameters": [ + "id": "ShapeOutsideInfo", + "description": "CSS Shape Outside details.", + "type": "object", + "properties": [ { - "name": "parentId", - "description": "Parent node id to populate with children.", - "$ref": "NodeId" + "name": "bounds", + "description": "Shape bounds", + "$ref": "Quad" }, { - "name": "nodes", - "description": "Child nodes array.", + "name": "shape", + "description": "Shape coordinate details", "type": "array", "items": { - "$ref": "Node" + "type": "any" + } + }, + { + "name": "marginShape", + "description": "Margin shape bounds", + "type": "array", + "items": { + "type": "any" } } ] }, { - "name": "shadowRootPopped", - "description": "Called when shadow root is popped from the element.", - "experimental": true, - "parameters": [ + "id": "Rect", + "description": "Rectangle.", + "type": "object", + "properties": [ { - "name": "hostId", - "description": "Host element id.", - "$ref": "NodeId" + "name": "x", + "description": "X coordinate", + "type": "number" }, { - "name": "rootId", - "description": "Shadow root id.", - "$ref": "NodeId" - } - ] - }, - { - "name": "shadowRootPushed", - "description": "Called when shadow root is pushed into the element.", - "experimental": true, - "parameters": [ + "name": "y", + "description": "Y coordinate", + "type": "number" + }, { - "name": "hostId", - "description": "Host element id.", - "$ref": "NodeId" + "name": "width", + "description": "Rectangle width", + "type": "number" }, { - "name": "root", - "description": "Shadow root.", - "$ref": "Node" + "name": "height", + "description": "Rectangle height", + "type": "number" } ] - } - ] - }, - { - "domain": "DOMDebugger", - "description": "DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript\nexecution will stop on these operations as if there was a regular breakpoint set.", - "dependencies": [ - "DOM", - "Debugger", - "Runtime" - ], - "types": [ - { - "id": "DOMBreakpointType", - "description": "DOM breakpoint type.", - "type": "string", - "enum": [ - "subtree-modified", - "attribute-modified", - "node-removed" - ] }, { - "id": "EventListener", - "description": "Object event listener.", + "id": "CSSComputedStyleProperty", "type": "object", "properties": [ { - "name": "type", - "description": "`EventListener`'s type.", + "name": "name", + "description": "Computed style property name.", "type": "string" }, { - "name": "useCapture", - "description": "`EventListener`'s useCapture.", - "type": "boolean" - }, - { - "name": "passive", - "description": "`EventListener`'s passive flag.", - "type": "boolean" - }, - { - "name": "once", - "description": "`EventListener`'s once flag.", - "type": "boolean" - }, - { - "name": "scriptId", - "description": "Script id of the handler code.", - "$ref": "Runtime.ScriptId" - }, - { - "name": "lineNumber", - "description": "Line number in the script (0-based).", - "type": "integer" - }, - { - "name": "columnNumber", - "description": "Column number in the script (0-based).", - "type": "integer" - }, - { - "name": "handler", - "description": "Event handler function value.", - "optional": true, - "$ref": "Runtime.RemoteObject" - }, - { - "name": "originalHandler", - "description": "Event original handler function value.", - "optional": true, - "$ref": "Runtime.RemoteObject" - }, - { - "name": "backendNodeId", - "description": "Node the listener is added to (if any).", - "optional": true, - "$ref": "DOM.BackendNodeId" + "name": "value", + "description": "Computed style property value.", + "type": "string" } ] } ], "commands": [ { - "name": "getEventListeners", - "description": "Returns event listeners of the given object.", + "name": "collectClassNamesFromSubtree", + "description": "Collects class names for the node with given id and all of it's child nodes.", + "experimental": true, "parameters": [ { - "name": "objectId", - "description": "Identifier of the object to return listeners for.", - "$ref": "Runtime.RemoteObjectId" - }, - { - "name": "depth", - "description": "The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", - "optional": true, - "type": "integer" - }, - { - "name": "pierce", - "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false). Reports listeners for all contexts if pierce is enabled.", - "optional": true, - "type": "boolean" + "name": "nodeId", + "description": "Id of the node to collect class names.", + "$ref": "NodeId" } ], "returns": [ { - "name": "listeners", - "description": "Array of relevant listeners.", + "name": "classNames", + "description": "Class name list.", "type": "array", "items": { - "$ref": "EventListener" + "type": "string" } } ] }, { - "name": "removeDOMBreakpoint", - "description": "Removes DOM breakpoint that was set using `setDOMBreakpoint`.", + "name": "copyTo", + "description": "Creates a deep copy of the specified node and places it into the target container before the\ngiven anchor.", + "experimental": true, "parameters": [ { "name": "nodeId", - "description": "Identifier of the node to remove breakpoint from.", - "$ref": "DOM.NodeId" + "description": "Id of the node to copy.", + "$ref": "NodeId" }, { - "name": "type", - "description": "Type of the breakpoint to remove.", - "$ref": "DOMBreakpointType" - } - ] - }, - { - "name": "removeEventListenerBreakpoint", - "description": "Removes breakpoint on particular DOM event.", - "parameters": [ - { - "name": "eventName", - "description": "Event name.", - "type": "string" + "name": "targetNodeId", + "description": "Id of the element to drop the copy into.", + "$ref": "NodeId" }, { - "name": "targetName", - "description": "EventTarget interface name.", - "experimental": true, + "name": "insertBeforeNodeId", + "description": "Drop the copy before this node (if absent, the copy becomes the last child of\n`targetNodeId`).", "optional": true, - "type": "string" + "$ref": "NodeId" } - ] - }, - { - "name": "removeInstrumentationBreakpoint", - "description": "Removes breakpoint on particular native event.", - "experimental": true, - "parameters": [ + ], + "returns": [ { - "name": "eventName", - "description": "Instrumentation name to stop on.", - "type": "string" + "name": "nodeId", + "description": "Id of the node clone.", + "$ref": "NodeId" } ] }, { - "name": "removeXHRBreakpoint", - "description": "Removes breakpoint from XMLHttpRequest.", + "name": "describeNode", + "description": "Describes node given its id, does not require domain to be enabled. Does not start tracking any\nobjects, can be used for automation.", "parameters": [ { - "name": "url", - "description": "Resource URL substring.", - "type": "string" + "name": "nodeId", + "description": "Identifier of the node.", + "optional": true, + "$ref": "NodeId" + }, + { + "name": "backendNodeId", + "description": "Identifier of the backend node.", + "optional": true, + "$ref": "BackendNodeId" + }, + { + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", + "optional": true, + "$ref": "Runtime.RemoteObjectId" + }, + { + "name": "depth", + "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", + "optional": true, + "type": "integer" + }, + { + "name": "pierce", + "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false).", + "optional": true, + "type": "boolean" + } + ], + "returns": [ + { + "name": "node", + "description": "Node description.", + "$ref": "Node" } ] }, { - "name": "setDOMBreakpoint", - "description": "Sets breakpoint on particular operation with DOM.", + "name": "scrollIntoViewIfNeeded", + "description": "Scrolls the specified rect of the given node into view if not already visible.\nNote: exactly one between nodeId, backendNodeId and objectId should be passed\nto identify the node.", + "experimental": true, "parameters": [ { "name": "nodeId", - "description": "Identifier of the node to set breakpoint on.", - "$ref": "DOM.NodeId" + "description": "Identifier of the node.", + "optional": true, + "$ref": "NodeId" }, { - "name": "type", - "description": "Type of the operation to stop upon.", - "$ref": "DOMBreakpointType" - } - ] - }, - { - "name": "setEventListenerBreakpoint", - "description": "Sets breakpoint on particular DOM event.", - "parameters": [ + "name": "backendNodeId", + "description": "Identifier of the backend node.", + "optional": true, + "$ref": "BackendNodeId" + }, { - "name": "eventName", - "description": "DOM Event name to stop on (any DOM event will do).", - "type": "string" + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", + "optional": true, + "$ref": "Runtime.RemoteObjectId" }, { - "name": "targetName", - "description": "EventTarget interface name to stop on. If equal to `\"*\"` or not provided, will stop on any\nEventTarget.", - "experimental": true, + "name": "rect", + "description": "The rect to be scrolled into view, relative to the node's border box, in CSS pixels.\nWhen omitted, center of the node will be used, similar to Element.scrollIntoView.", "optional": true, - "type": "string" + "$ref": "Rect" } ] }, { - "name": "setInstrumentationBreakpoint", - "description": "Sets breakpoint on particular native event.", + "name": "disable", + "description": "Disables DOM agent for the given page." + }, + { + "name": "discardSearchResults", + "description": "Discards search results from the session with the given id. `getSearchResults` should no longer\nbe called for that search.", "experimental": true, "parameters": [ { - "name": "eventName", - "description": "Instrumentation name to stop on.", + "name": "searchId", + "description": "Unique search session identifier.", "type": "string" } ] }, { - "name": "setXHRBreakpoint", - "description": "Sets breakpoint on XMLHttpRequest.", + "name": "enable", + "description": "Enables DOM agent for the given page." + }, + { + "name": "focus", + "description": "Focuses the given element.", "parameters": [ { - "name": "url", - "description": "Resource URL substring. All XHRs having this substring in the URL will get stopped upon.", - "type": "string" + "name": "nodeId", + "description": "Identifier of the node.", + "optional": true, + "$ref": "NodeId" + }, + { + "name": "backendNodeId", + "description": "Identifier of the backend node.", + "optional": true, + "$ref": "BackendNodeId" + }, + { + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", + "optional": true, + "$ref": "Runtime.RemoteObjectId" } ] - } - ] - }, - { - "domain": "DOMSnapshot", - "description": "This domain facilitates obtaining document snapshots with DOM, layout, and style information.", - "experimental": true, - "dependencies": [ - "CSS", - "DOM", - "DOMDebugger", - "Page" - ], - "types": [ + }, { - "id": "DOMNode", - "description": "A Node in the DOM tree.", - "type": "object", - "properties": [ - { - "name": "nodeType", - "description": "`Node`'s nodeType.", - "type": "integer" - }, + "name": "getAttributes", + "description": "Returns attributes for the specified node.", + "parameters": [ { - "name": "nodeName", - "description": "`Node`'s nodeName.", - "type": "string" - }, + "name": "nodeId", + "description": "Id of the node to retrieve attibutes for.", + "$ref": "NodeId" + } + ], + "returns": [ { - "name": "nodeValue", - "description": "`Node`'s nodeValue.", - "type": "string" - }, + "name": "attributes", + "description": "An interleaved array of node attribute names and values.", + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "name": "getBoxModel", + "description": "Returns boxes for the given node.", + "parameters": [ { - "name": "textValue", - "description": "Only set for textarea elements, contains the text value.", + "name": "nodeId", + "description": "Identifier of the node.", "optional": true, - "type": "string" + "$ref": "NodeId" }, { - "name": "inputValue", - "description": "Only set for input elements, contains the input's associated text value.", + "name": "backendNodeId", + "description": "Identifier of the backend node.", "optional": true, - "type": "string" + "$ref": "BackendNodeId" }, { - "name": "inputChecked", - "description": "Only set for radio and checkbox input elements, indicates if the element has been checked", + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", "optional": true, - "type": "boolean" - }, + "$ref": "Runtime.RemoteObjectId" + } + ], + "returns": [ { - "name": "optionSelected", - "description": "Only set for option elements, indicates if the element has been selected", + "name": "model", + "description": "Box model for the node.", + "$ref": "BoxModel" + } + ] + }, + { + "name": "getContentQuads", + "description": "Returns quads that describe node position on the page. This method\nmight return multiple quads for inline nodes.", + "experimental": true, + "parameters": [ + { + "name": "nodeId", + "description": "Identifier of the node.", "optional": true, - "type": "boolean" + "$ref": "NodeId" }, { "name": "backendNodeId", - "description": "`Node`'s id, corresponds to DOM.Node.backendNodeId.", - "$ref": "DOM.BackendNodeId" + "description": "Identifier of the backend node.", + "optional": true, + "$ref": "BackendNodeId" }, { - "name": "childNodeIndexes", - "description": "The indexes of the node's child nodes in the `domNodes` array returned by `getSnapshot`, if\nany.", + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", "optional": true, + "$ref": "Runtime.RemoteObjectId" + } + ], + "returns": [ + { + "name": "quads", + "description": "Quads that describe node layout relative to viewport.", "type": "array", "items": { - "type": "integer" + "$ref": "Quad" } - }, + } + ] + }, + { + "name": "getDocument", + "description": "Returns the root DOM node (and optionally the subtree) to the caller.", + "parameters": [ { - "name": "attributes", - "description": "Attributes of an `Element` node.", + "name": "depth", + "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", "optional": true, - "type": "array", - "items": { - "$ref": "NameValue" - } + "type": "integer" }, { - "name": "pseudoElementIndexes", - "description": "Indexes of pseudo elements associated with this node in the `domNodes` array returned by\n`getSnapshot`, if any.", + "name": "pierce", + "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false).", "optional": true, - "type": "array", - "items": { - "type": "integer" - } - }, + "type": "boolean" + } + ], + "returns": [ { - "name": "layoutNodeIndex", - "description": "The index of the node's related layout tree node in the `layoutTreeNodes` array returned by\n`getSnapshot`, if any.", - "optional": true, - "type": "integer" - }, + "name": "root", + "description": "Resulting node.", + "$ref": "Node" + } + ] + }, + { + "name": "getFlattenedDocument", + "description": "Returns the root DOM node (and optionally the subtree) to the caller.\nDeprecated, as it is not designed to work well with the rest of the DOM agent.\nUse DOMSnapshot.captureSnapshot instead.", + "deprecated": true, + "parameters": [ { - "name": "documentURL", - "description": "Document URL that `Document` or `FrameOwner` node points to.", + "name": "depth", + "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", "optional": true, - "type": "string" + "type": "integer" }, { - "name": "baseURL", - "description": "Base URL that `Document` or `FrameOwner` node uses for URL completion.", + "name": "pierce", + "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false).", "optional": true, - "type": "string" - }, + "type": "boolean" + } + ], + "returns": [ { - "name": "contentLanguage", - "description": "Only set for documents, contains the document's content language.", - "optional": true, - "type": "string" - }, + "name": "nodes", + "description": "Resulting node.", + "type": "array", + "items": { + "$ref": "Node" + } + } + ] + }, + { + "name": "getNodesForSubtreeByStyle", + "description": "Finds nodes with a given computed style in a subtree.", + "experimental": true, + "parameters": [ { - "name": "documentEncoding", - "description": "Only set for documents, contains the document's character set encoding.", - "optional": true, - "type": "string" + "name": "nodeId", + "description": "Node ID pointing to the root of a subtree.", + "$ref": "NodeId" }, { - "name": "publicId", - "description": "`DocumentType` node's publicId.", - "optional": true, - "type": "string" + "name": "computedStyles", + "description": "The style to filter nodes by (includes nodes if any of properties matches).", + "type": "array", + "items": { + "$ref": "CSSComputedStyleProperty" + } }, { - "name": "systemId", - "description": "`DocumentType` node's systemId.", + "name": "pierce", + "description": "Whether or not iframes and shadow roots in the same target should be traversed when returning the\nresults (default is false).", "optional": true, - "type": "string" - }, + "type": "boolean" + } + ], + "returns": [ { - "name": "frameId", - "description": "Frame ID for frame owner elements and also for the document node.", - "optional": true, - "$ref": "Page.FrameId" - }, + "name": "nodeIds", + "description": "Resulting nodes.", + "type": "array", + "items": { + "$ref": "NodeId" + } + } + ] + }, + { + "name": "getNodeForLocation", + "description": "Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is\neither returned or not.", + "parameters": [ { - "name": "contentDocumentIndex", - "description": "The index of a frame owner element's content document in the `domNodes` array returned by\n`getSnapshot`, if any.", - "optional": true, + "name": "x", + "description": "X coordinate.", "type": "integer" }, { - "name": "pseudoType", - "description": "Type of a pseudo element node.", - "optional": true, - "$ref": "DOM.PseudoType" + "name": "y", + "description": "Y coordinate.", + "type": "integer" }, { - "name": "shadowRootType", - "description": "Shadow root type.", + "name": "includeUserAgentShadowDOM", + "description": "False to skip to the nearest non-UA shadow root ancestor (default: false).", "optional": true, - "$ref": "DOM.ShadowRootType" + "type": "boolean" }, { - "name": "isClickable", - "description": "Whether this DOM node responds to mouse clicks. This includes nodes that have had click\nevent listeners attached via JavaScript as well as anchor tags that naturally navigate when\nclicked.", + "name": "ignorePointerEventsNone", + "description": "Whether to ignore pointer-events: none on elements and hit test them.", "optional": true, "type": "boolean" + } + ], + "returns": [ + { + "name": "backendNodeId", + "description": "Resulting node.", + "$ref": "BackendNodeId" }, { - "name": "eventListeners", - "description": "Details of the node's event listeners, if any.", - "optional": true, - "type": "array", - "items": { - "$ref": "DOMDebugger.EventListener" - } + "name": "frameId", + "description": "Frame this node belongs to.", + "$ref": "Page.FrameId" }, { - "name": "currentSourceURL", - "description": "The selected url for nodes with a srcset attribute.", + "name": "nodeId", + "description": "Id of the node at given coordinates, only when enabled and requested document.", "optional": true, - "type": "string" - }, + "$ref": "NodeId" + } + ] + }, + { + "name": "getOuterHTML", + "description": "Returns node's HTML markup.", + "parameters": [ { - "name": "originURL", - "description": "The url of the script (if any) that generates this node.", + "name": "nodeId", + "description": "Identifier of the node.", "optional": true, - "type": "string" + "$ref": "NodeId" }, { - "name": "scrollOffsetX", - "description": "Scroll offsets, set when this node is a Document.", + "name": "backendNodeId", + "description": "Identifier of the backend node.", "optional": true, - "type": "number" + "$ref": "BackendNodeId" }, { - "name": "scrollOffsetY", + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", "optional": true, - "type": "number" + "$ref": "Runtime.RemoteObjectId" + } + ], + "returns": [ + { + "name": "outerHTML", + "description": "Outer HTML markup.", + "type": "string" } ] }, { - "id": "InlineTextBox", - "description": "Details of post layout rendered text positions. The exact layout should not be regarded as\nstable and may change between versions.", - "type": "object", - "properties": [ - { - "name": "boundingBox", - "description": "The bounding box in document coordinates. Note that scroll offset of the document is ignored.", - "$ref": "DOM.Rect" - }, + "name": "getRelayoutBoundary", + "description": "Returns the id of the nearest ancestor that is a relayout boundary.", + "experimental": true, + "parameters": [ { - "name": "startCharacterIndex", - "description": "The starting index in characters, for this post layout textbox substring. Characters that\nwould be represented as a surrogate pair in UTF-16 have length 2.", - "type": "integer" - }, + "name": "nodeId", + "description": "Id of the node.", + "$ref": "NodeId" + } + ], + "returns": [ { - "name": "numCharacters", - "description": "The number of characters in this post layout textbox substring. Characters that would be\nrepresented as a surrogate pair in UTF-16 have length 2.", - "type": "integer" + "name": "nodeId", + "description": "Relayout boundary node id for the given node.", + "$ref": "NodeId" } ] }, { - "id": "LayoutTreeNode", - "description": "Details of an element in the DOM tree with a LayoutObject.", - "type": "object", - "properties": [ - { - "name": "domNodeIndex", - "description": "The index of the related DOM node in the `domNodes` array returned by `getSnapshot`.", - "type": "integer" - }, - { - "name": "boundingBox", - "description": "The bounding box in document coordinates. Note that scroll offset of the document is ignored.", - "$ref": "DOM.Rect" - }, + "name": "getSearchResults", + "description": "Returns search results from given `fromIndex` to given `toIndex` from the search with the given\nidentifier.", + "experimental": true, + "parameters": [ { - "name": "layoutText", - "description": "Contents of the LayoutText, if any.", - "optional": true, + "name": "searchId", + "description": "Unique search session identifier.", "type": "string" }, { - "name": "inlineTextNodes", - "description": "The post-layout inline text nodes, if any.", - "optional": true, - "type": "array", - "items": { - "$ref": "InlineTextBox" - } + "name": "fromIndex", + "description": "Start index of the search result to be returned.", + "type": "integer" }, { - "name": "styleIndex", - "description": "Index into the `computedStyles` array returned by `getSnapshot`.", - "optional": true, + "name": "toIndex", + "description": "End index of the search result to be returned.", "type": "integer" + } + ], + "returns": [ + { + "name": "nodeIds", + "description": "Ids of the search result nodes.", + "type": "array", + "items": { + "$ref": "NodeId" + } + } + ] + }, + { + "name": "hideHighlight", + "description": "Hides any highlight.", + "redirect": "Overlay" + }, + { + "name": "highlightNode", + "description": "Highlights DOM node.", + "redirect": "Overlay" + }, + { + "name": "highlightRect", + "description": "Highlights given rectangle.", + "redirect": "Overlay" + }, + { + "name": "markUndoableState", + "description": "Marks last undoable state.", + "experimental": true + }, + { + "name": "moveTo", + "description": "Moves node into the new container, places it before the given anchor.", + "parameters": [ + { + "name": "nodeId", + "description": "Id of the node to move.", + "$ref": "NodeId" }, { - "name": "paintOrder", - "description": "Global paint order index, which is determined by the stacking order of the nodes. Nodes\nthat are painted together will have the same index. Only provided if includePaintOrder in\ngetSnapshot was true.", - "optional": true, - "type": "integer" + "name": "targetNodeId", + "description": "Id of the element to drop the moved node into.", + "$ref": "NodeId" }, { - "name": "isStackingContext", - "description": "Set to true to indicate the element begins a new stacking context.", + "name": "insertBeforeNodeId", + "description": "Drop node before this one (if absent, the moved node becomes the last child of\n`targetNodeId`).", "optional": true, - "type": "boolean" + "$ref": "NodeId" } - ] - }, - { - "id": "ComputedStyle", - "description": "A subset of the full ComputedStyle as defined by the request whitelist.", - "type": "object", - "properties": [ + ], + "returns": [ { - "name": "properties", - "description": "Name/value pairs of computed style properties.", - "type": "array", - "items": { - "$ref": "NameValue" - } + "name": "nodeId", + "description": "New id of the moved node.", + "$ref": "NodeId" } ] }, { - "id": "NameValue", - "description": "A name/value pair.", - "type": "object", - "properties": [ + "name": "performSearch", + "description": "Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or\n`cancelSearch` to end this search session.", + "experimental": true, + "parameters": [ { - "name": "name", - "description": "Attribute/property name.", + "name": "query", + "description": "Plain text or query selector or XPath search query.", "type": "string" }, { - "name": "value", - "description": "Attribute/property value.", + "name": "includeUserAgentShadowDOM", + "description": "True to search in user agent shadow DOM.", + "optional": true, + "type": "boolean" + } + ], + "returns": [ + { + "name": "searchId", + "description": "Unique search session identifier.", "type": "string" + }, + { + "name": "resultCount", + "description": "Number of search results.", + "type": "integer" } ] }, { - "id": "StringIndex", - "description": "Index of the string in the strings table.", - "type": "integer" - }, - { - "id": "ArrayOfStrings", - "description": "Index of the string in the strings table.", - "type": "array", - "items": { - "$ref": "StringIndex" - } + "name": "pushNodeByPathToFrontend", + "description": "Requests that the node is sent to the caller given its path. // FIXME, use XPath", + "experimental": true, + "parameters": [ + { + "name": "path", + "description": "Path to node in the proprietary format.", + "type": "string" + } + ], + "returns": [ + { + "name": "nodeId", + "description": "Id of the node for given path.", + "$ref": "NodeId" + } + ] }, { - "id": "RareStringData", - "description": "Data that is only present on rare nodes.", - "type": "object", - "properties": [ + "name": "pushNodesByBackendIdsToFrontend", + "description": "Requests that a batch of nodes is sent to the caller given their backend node ids.", + "experimental": true, + "parameters": [ { - "name": "index", + "name": "backendNodeIds", + "description": "The array of backend node ids.", "type": "array", "items": { - "type": "integer" + "$ref": "BackendNodeId" } - }, + } + ], + "returns": [ { - "name": "value", + "name": "nodeIds", + "description": "The array of ids of pushed nodes that correspond to the backend ids specified in\nbackendNodeIds.", "type": "array", "items": { - "$ref": "StringIndex" + "$ref": "NodeId" } } ] }, { - "id": "RareBooleanData", - "type": "object", - "properties": [ + "name": "querySelector", + "description": "Executes `querySelector` on a given node.", + "parameters": [ { - "name": "index", - "type": "array", - "items": { - "type": "integer" - } + "name": "nodeId", + "description": "Id of the node to query upon.", + "$ref": "NodeId" + }, + { + "name": "selector", + "description": "Selector string.", + "type": "string" + } + ], + "returns": [ + { + "name": "nodeId", + "description": "Query selector result.", + "$ref": "NodeId" } ] }, { - "id": "RareIntegerData", - "type": "object", - "properties": [ + "name": "querySelectorAll", + "description": "Executes `querySelectorAll` on a given node.", + "parameters": [ { - "name": "index", - "type": "array", - "items": { - "type": "integer" - } + "name": "nodeId", + "description": "Id of the node to query upon.", + "$ref": "NodeId" }, { - "name": "value", + "name": "selector", + "description": "Selector string.", + "type": "string" + } + ], + "returns": [ + { + "name": "nodeIds", + "description": "Query selector result.", "type": "array", "items": { - "type": "integer" + "$ref": "NodeId" } } ] }, { - "id": "Rectangle", - "type": "array", - "items": { - "type": "number" - } + "name": "redo", + "description": "Re-does the last undone action.", + "experimental": true }, { - "id": "DocumentSnapshot", - "description": "Document snapshot.", - "type": "object", - "properties": [ + "name": "removeAttribute", + "description": "Removes attribute with given name from an element with given id.", + "parameters": [ { - "name": "documentURL", - "description": "Document URL that `Document` or `FrameOwner` node points to.", - "$ref": "StringIndex" + "name": "nodeId", + "description": "Id of the element to remove attribute from.", + "$ref": "NodeId" }, { - "name": "baseURL", - "description": "Base URL that `Document` or `FrameOwner` node uses for URL completion.", - "$ref": "StringIndex" - }, + "name": "name", + "description": "Name of the attribute to remove.", + "type": "string" + } + ] + }, + { + "name": "removeNode", + "description": "Removes node with given id.", + "parameters": [ { - "name": "contentLanguage", - "description": "Contains the document's content language.", - "$ref": "StringIndex" - }, + "name": "nodeId", + "description": "Id of the node to remove.", + "$ref": "NodeId" + } + ] + }, + { + "name": "requestChildNodes", + "description": "Requests that children of the node with given id are returned to the caller in form of\n`setChildNodes` events where not only immediate children are retrieved, but all children down to\nthe specified depth.", + "parameters": [ { - "name": "encodingName", - "description": "Contains the document's character set encoding.", - "$ref": "StringIndex" + "name": "nodeId", + "description": "Id of the node to get children for.", + "$ref": "NodeId" }, { - "name": "publicId", - "description": "`DocumentType` node's publicId.", - "$ref": "StringIndex" + "name": "depth", + "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", + "optional": true, + "type": "integer" }, { - "name": "systemId", - "description": "`DocumentType` node's systemId.", - "$ref": "StringIndex" - }, + "name": "pierce", + "description": "Whether or not iframes and shadow roots should be traversed when returning the sub-tree\n(default is false).", + "optional": true, + "type": "boolean" + } + ] + }, + { + "name": "requestNode", + "description": "Requests that the node is sent to the caller given the JavaScript node object reference. All\nnodes that form the path from the node to the root are also sent to the client as a series of\n`setChildNodes` notifications.", + "parameters": [ { - "name": "frameId", - "description": "Frame ID for frame owner elements and also for the document node.", - "$ref": "StringIndex" - }, + "name": "objectId", + "description": "JavaScript object id to convert into node.", + "$ref": "Runtime.RemoteObjectId" + } + ], + "returns": [ { - "name": "nodes", - "description": "A table with dom nodes.", - "$ref": "NodeTreeSnapshot" - }, + "name": "nodeId", + "description": "Node id for given object.", + "$ref": "NodeId" + } + ] + }, + { + "name": "resolveNode", + "description": "Resolves the JavaScript node object for a given NodeId or BackendNodeId.", + "parameters": [ { - "name": "layout", - "description": "The nodes in the layout tree.", - "$ref": "LayoutTreeSnapshot" + "name": "nodeId", + "description": "Id of the node to resolve.", + "optional": true, + "$ref": "NodeId" }, { - "name": "textBoxes", - "description": "The post-layout inline text nodes.", - "$ref": "TextBoxSnapshot" + "name": "backendNodeId", + "description": "Backend identifier of the node to resolve.", + "optional": true, + "$ref": "DOM.BackendNodeId" }, { - "name": "scrollOffsetX", - "description": "Horizontal scroll offset.", + "name": "objectGroup", + "description": "Symbolic group name that can be used to release multiple objects.", "optional": true, - "type": "number" + "type": "string" }, { - "name": "scrollOffsetY", - "description": "Vertical scroll offset.", + "name": "executionContextId", + "description": "Execution context in which to resolve the node.", "optional": true, - "type": "number" + "$ref": "Runtime.ExecutionContextId" + } + ], + "returns": [ + { + "name": "object", + "description": "JavaScript object wrapper for given node.", + "$ref": "Runtime.RemoteObject" } ] }, { - "id": "NodeTreeSnapshot", - "description": "Table containing nodes.", - "type": "object", - "properties": [ + "name": "setAttributeValue", + "description": "Sets attribute for an element with given id.", + "parameters": [ { - "name": "parentIndex", - "description": "Parent node index.", - "optional": true, - "type": "array", - "items": { - "type": "integer" - } + "name": "nodeId", + "description": "Id of the element to set attribute for.", + "$ref": "NodeId" }, { - "name": "nodeType", - "description": "`Node`'s nodeType.", - "optional": true, - "type": "array", - "items": { - "type": "integer" - } + "name": "name", + "description": "Attribute name.", + "type": "string" }, { - "name": "nodeName", - "description": "`Node`'s nodeName.", - "optional": true, - "type": "array", - "items": { - "$ref": "StringIndex" - } - }, + "name": "value", + "description": "Attribute value.", + "type": "string" + } + ] + }, + { + "name": "setAttributesAsText", + "description": "Sets attributes on element with given id. This method is useful when user edits some existing\nattribute value and types in several attribute name/value pairs.", + "parameters": [ { - "name": "nodeValue", - "description": "`Node`'s nodeValue.", - "optional": true, - "type": "array", - "items": { - "$ref": "StringIndex" - } + "name": "nodeId", + "description": "Id of the element to set attributes for.", + "$ref": "NodeId" }, { - "name": "backendNodeId", - "description": "`Node`'s id, corresponds to DOM.Node.backendNodeId.", - "optional": true, - "type": "array", - "items": { - "$ref": "DOM.BackendNodeId" - } + "name": "text", + "description": "Text with a number of attributes. Will parse this text using HTML parser.", + "type": "string" }, { - "name": "attributes", - "description": "Attributes of an `Element` node. Flatten name, value pairs.", + "name": "name", + "description": "Attribute name to replace with new attributes derived from text in case text parsed\nsuccessfully.", "optional": true, + "type": "string" + } + ] + }, + { + "name": "setFileInputFiles", + "description": "Sets files for the given file input element.", + "parameters": [ + { + "name": "files", + "description": "Array of file paths to set.", "type": "array", "items": { - "$ref": "ArrayOfStrings" + "type": "string" } }, { - "name": "textValue", - "description": "Only set for textarea elements, contains the text value.", - "optional": true, - "$ref": "RareStringData" - }, - { - "name": "inputValue", - "description": "Only set for input elements, contains the input's associated text value.", + "name": "nodeId", + "description": "Identifier of the node.", "optional": true, - "$ref": "RareStringData" + "$ref": "NodeId" }, { - "name": "inputChecked", - "description": "Only set for radio and checkbox input elements, indicates if the element has been checked", + "name": "backendNodeId", + "description": "Identifier of the backend node.", "optional": true, - "$ref": "RareBooleanData" + "$ref": "BackendNodeId" }, { - "name": "optionSelected", - "description": "Only set for option elements, indicates if the element has been selected", + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", "optional": true, - "$ref": "RareBooleanData" - }, + "$ref": "Runtime.RemoteObjectId" + } + ] + }, + { + "name": "setNodeStackTracesEnabled", + "description": "Sets if stack traces should be captured for Nodes. See `Node.getNodeStackTraces`. Default is disabled.", + "experimental": true, + "parameters": [ { - "name": "contentDocumentIndex", - "description": "The index of the document in the list of the snapshot documents.", - "optional": true, - "$ref": "RareIntegerData" - }, + "name": "enable", + "description": "Enable or disable.", + "type": "boolean" + } + ] + }, + { + "name": "getNodeStackTraces", + "description": "Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation.", + "experimental": true, + "parameters": [ { - "name": "pseudoType", - "description": "Type of a pseudo element node.", - "optional": true, - "$ref": "RareStringData" - }, + "name": "nodeId", + "description": "Id of the node to get stack traces for.", + "$ref": "NodeId" + } + ], + "returns": [ { - "name": "isClickable", - "description": "Whether this DOM node responds to mouse clicks. This includes nodes that have had click\nevent listeners attached via JavaScript as well as anchor tags that naturally navigate when\nclicked.", + "name": "creation", + "description": "Creation stack trace, if available.", "optional": true, - "$ref": "RareBooleanData" - }, + "$ref": "Runtime.StackTrace" + } + ] + }, + { + "name": "getFileInfo", + "description": "Returns file information for the given\nFile wrapper.", + "experimental": true, + "parameters": [ { - "name": "currentSourceURL", - "description": "The selected url for nodes with a srcset attribute.", - "optional": true, - "$ref": "RareStringData" - }, + "name": "objectId", + "description": "JavaScript object id of the node wrapper.", + "$ref": "Runtime.RemoteObjectId" + } + ], + "returns": [ { - "name": "originURL", - "description": "The url of the script (if any) that generates this node.", - "optional": true, - "$ref": "RareStringData" + "name": "path", + "type": "string" } ] }, { - "id": "LayoutTreeSnapshot", - "description": "Table of details of an element in the DOM tree with a LayoutObject.", - "type": "object", - "properties": [ - { - "name": "nodeIndex", - "description": "Index of the corresponding node in the `NodeTreeSnapshot` array returned by `captureSnapshot`.", - "type": "array", - "items": { - "type": "integer" - } - }, - { - "name": "styles", - "description": "Array of indexes specifying computed style strings, filtered according to the `computedStyles` parameter passed to `captureSnapshot`.", - "type": "array", - "items": { - "$ref": "ArrayOfStrings" - } - }, - { - "name": "bounds", - "description": "The absolute position bounding box.", - "type": "array", - "items": { - "$ref": "Rectangle" - } - }, - { - "name": "text", - "description": "Contents of the LayoutText, if any.", - "type": "array", - "items": { - "$ref": "StringIndex" - } - }, + "name": "setInspectedNode", + "description": "Enables console to refer to the node with given id via $x (see Command Line API for more details\n$x functions).", + "experimental": true, + "parameters": [ { - "name": "stackingContexts", - "description": "Stacking context information.", - "$ref": "RareBooleanData" - }, + "name": "nodeId", + "description": "DOM node id to be accessible by means of $x command line API.", + "$ref": "NodeId" + } + ] + }, + { + "name": "setNodeName", + "description": "Sets node name for a node with given id.", + "parameters": [ { - "name": "offsetRects", - "description": "The offset rect of nodes. Only available when includeDOMRects is set to true", - "optional": true, - "type": "array", - "items": { - "$ref": "Rectangle" - } + "name": "nodeId", + "description": "Id of the node to set name for.", + "$ref": "NodeId" }, { - "name": "scrollRects", - "description": "The scroll rect of nodes. Only available when includeDOMRects is set to true", - "optional": true, - "type": "array", - "items": { - "$ref": "Rectangle" - } - }, + "name": "name", + "description": "New node's name.", + "type": "string" + } + ], + "returns": [ { - "name": "clientRects", - "description": "The client rect of nodes. Only available when includeDOMRects is set to true", - "optional": true, - "type": "array", - "items": { - "$ref": "Rectangle" - } + "name": "nodeId", + "description": "New node's id.", + "$ref": "NodeId" } ] }, { - "id": "TextBoxSnapshot", - "description": "Table of details of the post layout rendered text positions. The exact layout should not be regarded as\nstable and may change between versions.", - "type": "object", - "properties": [ + "name": "setNodeValue", + "description": "Sets node value for a node with given id.", + "parameters": [ { - "name": "layoutIndex", - "description": "Index of the layout tree node that owns this box collection.", - "type": "array", - "items": { - "type": "integer" - } + "name": "nodeId", + "description": "Id of the node to set value for.", + "$ref": "NodeId" }, { - "name": "bounds", - "description": "The absolute position bounding box.", - "type": "array", - "items": { - "$ref": "Rectangle" - } - }, + "name": "value", + "description": "New node's value.", + "type": "string" + } + ] + }, + { + "name": "setOuterHTML", + "description": "Sets node HTML markup, returns new node id.", + "parameters": [ { - "name": "start", - "description": "The starting index in characters, for this post layout textbox substring. Characters that\nwould be represented as a surrogate pair in UTF-16 have length 2.", - "type": "array", - "items": { - "type": "integer" - } + "name": "nodeId", + "description": "Id of the node to set markup for.", + "$ref": "NodeId" }, { - "name": "length", - "description": "The number of characters in this post layout textbox substring. Characters that would be\nrepresented as a surrogate pair in UTF-16 have length 2.", - "type": "array", - "items": { - "type": "integer" - } + "name": "outerHTML", + "description": "Outer HTML markup to set.", + "type": "string" } ] - } - ], - "commands": [ - { - "name": "disable", - "description": "Disables DOM snapshot agent for the given page." }, { - "name": "enable", - "description": "Enables DOM snapshot agent for the given page." + "name": "undo", + "description": "Undoes the last performed action.", + "experimental": true }, { - "name": "getSnapshot", - "description": "Returns a document snapshot, including the full DOM tree of the root node (including iframes,\ntemplate contents, and imported documents) in a flattened array, as well as layout and\nwhite-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is\nflattened.", - "deprecated": true, + "name": "getFrameOwner", + "description": "Returns iframe node that owns iframe with the given domain.", + "experimental": true, "parameters": [ { - "name": "computedStyleWhitelist", - "description": "Whitelist of computed styles to return.", - "type": "array", - "items": { - "type": "string" - } - }, + "name": "frameId", + "$ref": "Page.FrameId" + } + ], + "returns": [ { - "name": "includeEventListeners", - "description": "Whether or not to retrieve details of DOM listeners (default false).", - "optional": true, - "type": "boolean" + "name": "backendNodeId", + "description": "Resulting node.", + "$ref": "BackendNodeId" }, { - "name": "includePaintOrder", - "description": "Whether to determine and include the paint order index of LayoutTreeNodes (default false).", + "name": "nodeId", + "description": "Id of the node at given coordinates, only when enabled and requested document.", "optional": true, - "type": "boolean" + "$ref": "NodeId" + } + ] + }, + { + "name": "getContainerForNode", + "description": "Returns the container of the given node based on container query conditions.\nIf containerName is given, it will find the nearest container with a matching name;\notherwise it will find the nearest container regardless of its container name.", + "experimental": true, + "parameters": [ + { + "name": "nodeId", + "$ref": "NodeId" }, { - "name": "includeUserAgentShadowTree", - "description": "Whether to include UA shadow tree in the snapshot (default false).", + "name": "containerName", "optional": true, - "type": "boolean" + "type": "string" } ], "returns": [ { - "name": "domNodes", - "description": "The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.", - "type": "array", - "items": { - "$ref": "DOMNode" - } - }, - { - "name": "layoutTreeNodes", - "description": "The nodes in the layout tree.", - "type": "array", - "items": { - "$ref": "LayoutTreeNode" - } - }, - { - "name": "computedStyles", - "description": "Whitelisted ComputedStyle properties for each node in the layout tree.", - "type": "array", - "items": { - "$ref": "ComputedStyle" - } + "name": "nodeId", + "description": "The container node for the given node, or null if not found.", + "optional": true, + "$ref": "NodeId" } ] }, { - "name": "captureSnapshot", - "description": "Returns a document snapshot, including the full DOM tree of the root node (including iframes,\ntemplate contents, and imported documents) in a flattened array, as well as layout and\nwhite-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is\nflattened.", + "name": "getQueryingDescendantsForContainer", + "description": "Returns the descendants of a container query container that have\ncontainer queries against this container.", + "experimental": true, "parameters": [ { - "name": "computedStyles", - "description": "Whitelist of computed styles to return.", - "type": "array", - "items": { - "type": "string" - } - }, - { - "name": "includeDOMRects", - "description": "Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot", - "optional": true, - "type": "boolean" + "name": "nodeId", + "description": "Id of the container node to find querying descendants from.", + "$ref": "NodeId" } ], "returns": [ { - "name": "documents", - "description": "The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.", - "type": "array", - "items": { - "$ref": "DocumentSnapshot" - } - }, - { - "name": "strings", - "description": "Shared string table that all string properties refer to with indexes.", + "name": "nodeIds", + "description": "Descendant nodes with container queries against the given container.", "type": "array", "items": { - "type": "string" + "$ref": "NodeId" } } ] } - ] - }, - { - "domain": "DOMStorage", - "description": "Query and modify DOM storage.", - "experimental": true, - "types": [ + ], + "events": [ { - "id": "StorageId", - "description": "DOM Storage identifier.", - "type": "object", - "properties": [ + "name": "attributeModified", + "description": "Fired when `Element`'s attribute is modified.", + "parameters": [ { - "name": "securityOrigin", - "description": "Security origin for the storage.", - "type": "string" + "name": "nodeId", + "description": "Id of the node that has changed.", + "$ref": "NodeId" }, { - "name": "isLocalStorage", - "description": "Whether the storage is local storage (not session storage).", - "type": "boolean" - } - ] - }, - { - "id": "Item", - "description": "DOM Storage item.", - "type": "array", - "items": { - "type": "string" - } - } - ], - "commands": [ - { - "name": "clear", - "parameters": [ + "name": "name", + "description": "Attribute name.", + "type": "string" + }, { - "name": "storageId", - "$ref": "StorageId" + "name": "value", + "description": "Attribute value.", + "type": "string" } ] }, { - "name": "disable", - "description": "Disables storage tracking, prevents storage events from being sent to the client." - }, - { - "name": "enable", - "description": "Enables storage tracking, storage events will now be delivered to the client." - }, - { - "name": "getDOMStorageItems", + "name": "attributeRemoved", + "description": "Fired when `Element`'s attribute is removed.", "parameters": [ { - "name": "storageId", - "$ref": "StorageId" - } - ], - "returns": [ + "name": "nodeId", + "description": "Id of the node that has changed.", + "$ref": "NodeId" + }, { - "name": "entries", - "type": "array", - "items": { - "$ref": "Item" - } + "name": "name", + "description": "A ttribute name.", + "type": "string" } ] }, { - "name": "removeDOMStorageItem", + "name": "characterDataModified", + "description": "Mirrors `DOMCharacterDataModified` event.", "parameters": [ { - "name": "storageId", - "$ref": "StorageId" + "name": "nodeId", + "description": "Id of the node that has changed.", + "$ref": "NodeId" }, { - "name": "key", + "name": "characterData", + "description": "New text value.", "type": "string" } ] }, { - "name": "setDOMStorageItem", + "name": "childNodeCountUpdated", + "description": "Fired when `Container`'s child node count has changed.", "parameters": [ { - "name": "storageId", - "$ref": "StorageId" - }, - { - "name": "key", - "type": "string" + "name": "nodeId", + "description": "Id of the node that has changed.", + "$ref": "NodeId" }, { - "name": "value", - "type": "string" + "name": "childNodeCount", + "description": "New node count.", + "type": "integer" } ] - } - ], - "events": [ + }, { - "name": "domStorageItemAdded", + "name": "childNodeInserted", + "description": "Mirrors `DOMNodeInserted` event.", "parameters": [ { - "name": "storageId", - "$ref": "StorageId" + "name": "parentNodeId", + "description": "Id of the node that has changed.", + "$ref": "NodeId" }, { - "name": "key", - "type": "string" + "name": "previousNodeId", + "description": "If of the previous siblint.", + "$ref": "NodeId" }, { - "name": "newValue", - "type": "string" + "name": "node", + "description": "Inserted node data.", + "$ref": "Node" } ] }, { - "name": "domStorageItemRemoved", + "name": "childNodeRemoved", + "description": "Mirrors `DOMNodeRemoved` event.", "parameters": [ { - "name": "storageId", - "$ref": "StorageId" + "name": "parentNodeId", + "description": "Parent id.", + "$ref": "NodeId" }, { - "name": "key", - "type": "string" + "name": "nodeId", + "description": "Id of the node that has been removed.", + "$ref": "NodeId" } ] }, { - "name": "domStorageItemUpdated", + "name": "distributedNodesUpdated", + "description": "Called when distribution is changed.", + "experimental": true, "parameters": [ { - "name": "storageId", - "$ref": "StorageId" - }, - { - "name": "key", - "type": "string" - }, - { - "name": "oldValue", - "type": "string" + "name": "insertionPointId", + "description": "Insertion point where distributed nodes were updated.", + "$ref": "NodeId" }, { - "name": "newValue", - "type": "string" + "name": "distributedNodes", + "description": "Distributed nodes for given insertion point.", + "type": "array", + "items": { + "$ref": "BackendNode" + } } ] }, { - "name": "domStorageItemsCleared", + "name": "documentUpdated", + "description": "Fired when `Document` has been totally updated. Node ids are no longer valid." + }, + { + "name": "inlineStyleInvalidated", + "description": "Fired when `Element`'s inline style is modified via a CSS property modification.", + "experimental": true, "parameters": [ { - "name": "storageId", - "$ref": "StorageId" + "name": "nodeIds", + "description": "Ids of the nodes for which the inline styles have been invalidated.", + "type": "array", + "items": { + "$ref": "NodeId" + } } ] - } - ] - }, - { - "domain": "Database", - "experimental": true, - "types": [ - { - "id": "DatabaseId", - "description": "Unique identifier of Database object.", - "type": "string" }, { - "id": "Database", - "description": "Database object.", - "type": "object", - "properties": [ - { - "name": "id", - "description": "Database ID.", - "$ref": "DatabaseId" - }, - { - "name": "domain", - "description": "Database domain.", - "type": "string" - }, + "name": "pseudoElementAdded", + "description": "Called when a pseudo element is added to an element.", + "experimental": true, + "parameters": [ { - "name": "name", - "description": "Database name.", - "type": "string" + "name": "parentId", + "description": "Pseudo element's parent element id.", + "$ref": "NodeId" }, { - "name": "version", - "description": "Database version.", - "type": "string" + "name": "pseudoElement", + "description": "The added pseudo element.", + "$ref": "Node" } ] }, { - "id": "Error", - "description": "Database error.", - "type": "object", - "properties": [ + "name": "pseudoElementRemoved", + "description": "Called when a pseudo element is removed from an element.", + "experimental": true, + "parameters": [ { - "name": "message", - "description": "Error message.", - "type": "string" + "name": "parentId", + "description": "Pseudo element's parent element id.", + "$ref": "NodeId" }, { - "name": "code", - "description": "Error code.", - "type": "integer" + "name": "pseudoElementId", + "description": "The removed pseudo element id.", + "$ref": "NodeId" } ] - } - ], - "commands": [ - { - "name": "disable", - "description": "Disables database tracking, prevents database events from being sent to the client." - }, - { - "name": "enable", - "description": "Enables database tracking, database events will now be delivered to the client." }, { - "name": "executeSQL", + "name": "setChildNodes", + "description": "Fired when backend wants to provide client with the missing DOM structure. This happens upon\nmost of the calls requesting node ids.", "parameters": [ { - "name": "databaseId", - "$ref": "DatabaseId" + "name": "parentId", + "description": "Parent node id to populate with children.", + "$ref": "NodeId" }, { - "name": "query", - "type": "string" - } - ], - "returns": [ - { - "name": "columnNames", - "optional": true, + "name": "nodes", + "description": "Child nodes array.", "type": "array", "items": { - "type": "string" - } - }, - { - "name": "values", - "optional": true, - "type": "array", - "items": { - "type": "any" + "$ref": "Node" } - }, - { - "name": "sqlError", - "optional": true, - "$ref": "Error" } ] }, { - "name": "getDatabaseTableNames", + "name": "shadowRootPopped", + "description": "Called when shadow root is popped from the element.", + "experimental": true, "parameters": [ { - "name": "databaseId", - "$ref": "DatabaseId" - } - ], - "returns": [ - { - "name": "tableNames", - "type": "array", - "items": { - "type": "string" - } - } - ] - } - ], - "events": [ - { - "name": "addDatabase", - "parameters": [ + "name": "hostId", + "description": "Host element id.", + "$ref": "NodeId" + }, { - "name": "database", - "$ref": "Database" + "name": "rootId", + "description": "Shadow root id.", + "$ref": "NodeId" } ] - } - ] - }, - { - "domain": "DeviceOrientation", - "experimental": true, - "commands": [ - { - "name": "clearDeviceOrientationOverride", - "description": "Clears the overridden Device Orientation." }, { - "name": "setDeviceOrientationOverride", - "description": "Overrides the Device Orientation.", + "name": "shadowRootPushed", + "description": "Called when shadow root is pushed into the element.", + "experimental": true, "parameters": [ { - "name": "alpha", - "description": "Mock alpha", - "type": "number" - }, - { - "name": "beta", - "description": "Mock beta", - "type": "number" + "name": "hostId", + "description": "Host element id.", + "$ref": "NodeId" }, { - "name": "gamma", - "description": "Mock gamma", - "type": "number" + "name": "root", + "description": "Shadow root.", + "$ref": "Node" } ] } ] }, { - "domain": "Emulation", - "description": "This domain emulates different environments for the page.", + "domain": "DOMDebugger", + "description": "DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript\nexecution will stop on these operations as if there was a regular breakpoint set.", "dependencies": [ "DOM", - "Page", + "Debugger", "Runtime" ], "types": [ { - "id": "ScreenOrientation", - "description": "Screen orientation.", - "type": "object", - "properties": [ - { - "name": "type", - "description": "Orientation type.", - "type": "string", - "enum": [ - "portraitPrimary", - "portraitSecondary", - "landscapePrimary", - "landscapeSecondary" - ] - }, - { - "name": "angle", - "description": "Orientation angle.", - "type": "integer" - } - ] - }, - { - "id": "VirtualTimePolicy", - "description": "advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to\nallow the next delayed task (if any) to run; pause: The virtual time base may not advance;\npauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending\nresource fetches.", - "experimental": true, + "id": "DOMBreakpointType", + "description": "DOM breakpoint type.", "type": "string", "enum": [ - "advance", - "pause", - "pauseIfNetworkFetchesPending" - ] - } - ], - "commands": [ - { - "name": "canEmulate", - "description": "Tells whether emulation is supported.", - "returns": [ - { - "name": "result", - "description": "True if emulation is supported.", - "type": "boolean" - } - ] - }, - { - "name": "clearDeviceMetricsOverride", - "description": "Clears the overriden device metrics." - }, - { - "name": "clearGeolocationOverride", - "description": "Clears the overriden Geolocation Position and Error." - }, - { - "name": "resetPageScaleFactor", - "description": "Requests that page scale factor is reset to initial values.", - "experimental": true - }, - { - "name": "setFocusEmulationEnabled", - "description": "Enables or disables simulating a focused and active page.", - "experimental": true, - "parameters": [ - { - "name": "enabled", - "description": "Whether to enable to disable focus emulation.", - "type": "boolean" - } + "subtree-modified", + "attribute-modified", + "node-removed" ] }, { - "name": "setCPUThrottlingRate", - "description": "Enables CPU throttling to emulate slow CPUs.", + "id": "CSPViolationType", + "description": "CSP Violation type.", "experimental": true, - "parameters": [ - { - "name": "rate", - "description": "Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).", - "type": "number" - } - ] - }, - { - "name": "setDefaultBackgroundColorOverride", - "description": "Sets or clears an override of the default background color of the frame. This override is used\nif the content does not specify one.", - "parameters": [ - { - "name": "color", - "description": "RGBA of the default background color. If not specified, any existing override will be\ncleared.", - "optional": true, - "$ref": "DOM.RGBA" - } + "type": "string", + "enum": [ + "trustedtype-sink-violation", + "trustedtype-policy-violation" ] }, { - "name": "setDeviceMetricsOverride", - "description": "Overrides the values of device screen dimensions (window.screen.width, window.screen.height,\nwindow.innerWidth, window.innerHeight, and \"device-width\"/\"device-height\"-related CSS media\nquery results).", - "parameters": [ - { - "name": "width", - "description": "Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.", - "type": "integer" - }, + "id": "EventListener", + "description": "Object event listener.", + "type": "object", + "properties": [ { - "name": "height", - "description": "Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.", - "type": "integer" + "name": "type", + "description": "`EventListener`'s type.", + "type": "string" }, { - "name": "deviceScaleFactor", - "description": "Overriding device scale factor value. 0 disables the override.", - "type": "number" + "name": "useCapture", + "description": "`EventListener`'s useCapture.", + "type": "boolean" }, { - "name": "mobile", - "description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text\nautosizing and more.", + "name": "passive", + "description": "`EventListener`'s passive flag.", "type": "boolean" }, { - "name": "scale", - "description": "Scale to apply to resulting view image.", - "experimental": true, - "optional": true, - "type": "number" + "name": "once", + "description": "`EventListener`'s once flag.", + "type": "boolean" }, { - "name": "screenWidth", - "description": "Overriding screen width value in pixels (minimum 0, maximum 10000000).", - "experimental": true, - "optional": true, - "type": "integer" + "name": "scriptId", + "description": "Script id of the handler code.", + "$ref": "Runtime.ScriptId" }, { - "name": "screenHeight", - "description": "Overriding screen height value in pixels (minimum 0, maximum 10000000).", - "experimental": true, - "optional": true, + "name": "lineNumber", + "description": "Line number in the script (0-based).", "type": "integer" }, { - "name": "positionX", - "description": "Overriding view X position on screen in pixels (minimum 0, maximum 10000000).", - "experimental": true, - "optional": true, + "name": "columnNumber", + "description": "Column number in the script (0-based).", "type": "integer" }, { - "name": "positionY", - "description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).", - "experimental": true, + "name": "handler", + "description": "Event handler function value.", "optional": true, - "type": "integer" + "$ref": "Runtime.RemoteObject" }, { - "name": "dontSetVisibleSize", - "description": "Do not set visible view size, rely upon explicit setVisibleSize call.", - "experimental": true, + "name": "originalHandler", + "description": "Event original handler function value.", "optional": true, - "type": "boolean" + "$ref": "Runtime.RemoteObject" }, { - "name": "screenOrientation", - "description": "Screen orientation override.", + "name": "backendNodeId", + "description": "Node the listener is added to (if any).", "optional": true, - "$ref": "ScreenOrientation" - }, - { - "name": "viewport", - "description": "If set, the visible area of the page will be overridden to this viewport. This viewport\nchange is not observed by the page, e.g. viewport-relative elements do not change positions.", - "experimental": true, - "optional": true, - "$ref": "Page.Viewport" + "$ref": "DOM.BackendNodeId" } ] - }, + } + ], + "commands": [ { - "name": "setScrollbarsHidden", - "experimental": true, + "name": "getEventListeners", + "description": "Returns event listeners of the given object.", "parameters": [ { - "name": "hidden", - "description": "Whether scrollbars should be always hidden.", + "name": "objectId", + "description": "Identifier of the object to return listeners for.", + "$ref": "Runtime.RemoteObjectId" + }, + { + "name": "depth", + "description": "The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the\nentire subtree or provide an integer larger than 0.", + "optional": true, + "type": "integer" + }, + { + "name": "pierce", + "description": "Whether or not iframes and shadow roots should be traversed when returning the subtree\n(default is false). Reports listeners for all contexts if pierce is enabled.", + "optional": true, "type": "boolean" } - ] - }, - { - "name": "setDocumentCookieDisabled", - "experimental": true, - "parameters": [ + ], + "returns": [ { - "name": "disabled", - "description": "Whether document.coookie API should be disabled.", - "type": "boolean" + "name": "listeners", + "description": "Array of relevant listeners.", + "type": "array", + "items": { + "$ref": "EventListener" + } } ] }, { - "name": "setEmitTouchEventsForMouse", - "experimental": true, + "name": "removeDOMBreakpoint", + "description": "Removes DOM breakpoint that was set using `setDOMBreakpoint`.", "parameters": [ { - "name": "enabled", - "description": "Whether touch emulation based on mouse input should be enabled.", - "type": "boolean" + "name": "nodeId", + "description": "Identifier of the node to remove breakpoint from.", + "$ref": "DOM.NodeId" }, { - "name": "configuration", - "description": "Touch/gesture events configuration. Default: current platform.", - "optional": true, - "type": "string", - "enum": [ - "mobile", - "desktop" - ] + "name": "type", + "description": "Type of the breakpoint to remove.", + "$ref": "DOMBreakpointType" } ] }, { - "name": "setEmulatedMedia", - "description": "Emulates the given media for CSS media queries.", + "name": "removeEventListenerBreakpoint", + "description": "Removes breakpoint on particular DOM event.", "parameters": [ { - "name": "media", - "description": "Media type to emulate. Empty string disables the override.", + "name": "eventName", + "description": "Event name.", "type": "string" - } - ] - }, - { - "name": "setGeolocationOverride", - "description": "Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position\nunavailable.", - "parameters": [ - { - "name": "latitude", - "description": "Mock latitude", - "optional": true, - "type": "number" - }, - { - "name": "longitude", - "description": "Mock longitude", - "optional": true, - "type": "number" }, { - "name": "accuracy", - "description": "Mock accuracy", + "name": "targetName", + "description": "EventTarget interface name.", + "experimental": true, "optional": true, - "type": "number" + "type": "string" } ] }, { - "name": "setNavigatorOverrides", - "description": "Overrides value returned by the javascript navigator object.", + "name": "removeInstrumentationBreakpoint", + "description": "Removes breakpoint on particular native event.", "experimental": true, - "deprecated": true, "parameters": [ { - "name": "platform", - "description": "The platform navigator.platform should return.", + "name": "eventName", + "description": "Instrumentation name to stop on.", "type": "string" } ] }, { - "name": "setPageScaleFactor", - "description": "Sets a specified page scale factor.", - "experimental": true, + "name": "removeXHRBreakpoint", + "description": "Removes breakpoint from XMLHttpRequest.", "parameters": [ { - "name": "pageScaleFactor", - "description": "Page scale factor.", - "type": "number" + "name": "url", + "description": "Resource URL substring.", + "type": "string" } ] }, { - "name": "setScriptExecutionDisabled", - "description": "Switches script execution in the page.", + "name": "setBreakOnCSPViolation", + "description": "Sets breakpoint on particular CSP violations.", + "experimental": true, "parameters": [ { - "name": "value", - "description": "Whether script execution should be disabled in the page.", - "type": "boolean" + "name": "violationTypes", + "description": "CSP Violations to stop upon.", + "type": "array", + "items": { + "$ref": "CSPViolationType" + } } ] }, { - "name": "setTouchEmulationEnabled", - "description": "Enables touch on platforms which do not support them.", + "name": "setDOMBreakpoint", + "description": "Sets breakpoint on particular operation with DOM.", "parameters": [ { - "name": "enabled", - "description": "Whether the touch event emulation should be enabled.", - "type": "boolean" + "name": "nodeId", + "description": "Identifier of the node to set breakpoint on.", + "$ref": "DOM.NodeId" }, { - "name": "maxTouchPoints", - "description": "Maximum touch points supported. Defaults to one.", - "optional": true, - "type": "integer" + "name": "type", + "description": "Type of the operation to stop upon.", + "$ref": "DOMBreakpointType" } ] }, { - "name": "setVirtualTimePolicy", - "description": "Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets\nthe current virtual time policy. Note this supersedes any previous time budget.", - "experimental": true, + "name": "setEventListenerBreakpoint", + "description": "Sets breakpoint on particular DOM event.", "parameters": [ { - "name": "policy", - "$ref": "VirtualTimePolicy" - }, - { - "name": "budget", - "description": "If set, after this many virtual milliseconds have elapsed virtual time will be paused and a\nvirtualTimeBudgetExpired event is sent.", - "optional": true, - "type": "number" - }, - { - "name": "maxVirtualTimeTaskStarvationCount", - "description": "If set this specifies the maximum number of tasks that can be run before virtual is forced\nforwards to prevent deadlock.", - "optional": true, - "type": "integer" - }, - { - "name": "waitForNavigation", - "description": "If set the virtual time policy change should be deferred until any frame starts navigating.\nNote any previous deferred policy change is superseded.", - "optional": true, - "type": "boolean" + "name": "eventName", + "description": "DOM Event name to stop on (any DOM event will do).", + "type": "string" }, { - "name": "initialVirtualTime", - "description": "If set, base::Time::Now will be overriden to initially return this value.", + "name": "targetName", + "description": "EventTarget interface name to stop on. If equal to `\"*\"` or not provided, will stop on any\nEventTarget.", + "experimental": true, "optional": true, - "$ref": "Network.TimeSinceEpoch" - } - ], - "returns": [ - { - "name": "virtualTimeTicksBase", - "description": "Absolute timestamp at which virtual time was first enabled (up time in milliseconds).", - "type": "number" + "type": "string" } ] }, { - "name": "setTimezoneOverride", - "description": "Overrides default host system timezone with the specified one.", + "name": "setInstrumentationBreakpoint", + "description": "Sets breakpoint on particular native event.", "experimental": true, "parameters": [ { - "name": "timezoneId", - "description": "The timezone identifier. If empty, disables the override and\nrestores default host system timezone.", + "name": "eventName", + "description": "Instrumentation name to stop on.", "type": "string" } ] }, { - "name": "setVisibleSize", - "description": "Resizes the frame/viewport of the page. Note that this does not affect the frame's container\n(e.g. browser window). Can be used to produce screenshots of the specified size. Not supported\non Android.", - "experimental": true, - "deprecated": true, + "name": "setXHRBreakpoint", + "description": "Sets breakpoint on XMLHttpRequest.", "parameters": [ { - "name": "width", - "description": "Frame width (DIP).", - "type": "integer" - }, - { - "name": "height", - "description": "Frame height (DIP).", - "type": "integer" + "name": "url", + "description": "Resource URL substring. All XHRs having this substring in the URL will get stopped upon.", + "type": "string" } ] - }, + } + ] + }, + { + "domain": "EventBreakpoints", + "description": "EventBreakpoints permits setting breakpoints on particular operations and\nevents in targets that run JavaScript but do not have a DOM.\nJavaScript execution will stop on these operations as if there was a regular\nbreakpoint set.", + "experimental": true, + "commands": [ { - "name": "setUserAgentOverride", - "description": "Allows overriding user agent with the given string.", + "name": "setInstrumentationBreakpoint", + "description": "Sets breakpoint on particular native event.", "parameters": [ { - "name": "userAgent", - "description": "User agent to use.", - "type": "string" - }, - { - "name": "acceptLanguage", - "description": "Browser langugage to emulate.", - "optional": true, + "name": "eventName", + "description": "Instrumentation name to stop on.", "type": "string" - }, + } + ] + }, + { + "name": "removeInstrumentationBreakpoint", + "description": "Removes breakpoint on particular native event.", + "parameters": [ { - "name": "platform", - "description": "The platform navigator.platform should return.", - "optional": true, + "name": "eventName", + "description": "Instrumentation name to stop on.", "type": "string" } ] } - ], - "events": [ - { - "name": "virtualTimeBudgetExpired", - "description": "Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.", - "experimental": true - } ] }, { - "domain": "HeadlessExperimental", - "description": "This domain provides experimental commands only supported in headless mode.", + "domain": "DOMSnapshot", + "description": "This domain facilitates obtaining document snapshots with DOM, layout, and style information.", "experimental": true, "dependencies": [ - "Page", - "Runtime" + "CSS", + "DOM", + "DOMDebugger", + "Page" ], "types": [ { - "id": "ScreenshotParams", - "description": "Encoding options for a screenshot.", + "id": "DOMNode", + "description": "A Node in the DOM tree.", "type": "object", "properties": [ { - "name": "format", - "description": "Image compression format (defaults to png).", - "optional": true, - "type": "string", - "enum": [ - "jpeg", - "png" - ] + "name": "nodeType", + "description": "`Node`'s nodeType.", + "type": "integer" }, { - "name": "quality", - "description": "Compression quality from range [0..100] (jpeg only).", - "optional": true, - "type": "integer" - } - ] - } - ], - "commands": [ - { - "name": "beginFrame", - "description": "Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a\nscreenshot from the resulting frame. Requires that the target was created with enabled\nBeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also\nhttps://goo.gl/3zHXhB for more background.", - "parameters": [ + "name": "nodeName", + "description": "`Node`'s nodeName.", + "type": "string" + }, { - "name": "frameTimeTicks", - "description": "Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set,\nthe current time will be used.", - "optional": true, - "type": "number" + "name": "nodeValue", + "description": "`Node`'s nodeValue.", + "type": "string" }, { - "name": "interval", - "description": "The interval between BeginFrames that is reported to the compositor, in milliseconds.\nDefaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.", + "name": "textValue", + "description": "Only set for textarea elements, contains the text value.", "optional": true, - "type": "number" + "type": "string" }, { - "name": "noDisplayUpdates", - "description": "Whether updates should not be committed and drawn onto the display. False by default. If\ntrue, only side effects of the BeginFrame will be run, such as layout and animations, but\nany visual updates may not be visible on the display or in screenshots.", + "name": "inputValue", + "description": "Only set for input elements, contains the input's associated text value.", "optional": true, - "type": "boolean" + "type": "string" }, { - "name": "screenshot", - "description": "If set, a screenshot of the frame will be captured and returned in the response. Otherwise,\nno screenshot will be captured. Note that capturing a screenshot can fail, for example,\nduring renderer initialization. In such a case, no screenshot data will be returned.", + "name": "inputChecked", + "description": "Only set for radio and checkbox input elements, indicates if the element has been checked", "optional": true, - "$ref": "ScreenshotParams" - } - ], - "returns": [ - { - "name": "hasDamage", - "description": "Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the\ndisplay. Reported for diagnostic uses, may be removed in the future.", "type": "boolean" }, { - "name": "screenshotData", - "description": "Base64-encoded image data of the screenshot, if one was requested and successfully taken.", + "name": "optionSelected", + "description": "Only set for option elements, indicates if the element has been selected", "optional": true, - "type": "string" - } - ] - }, - { - "name": "disable", - "description": "Disables headless events for the target." - }, - { - "name": "enable", - "description": "Enables headless events for the target." - } - ], - "events": [ - { - "name": "needsBeginFramesChanged", - "description": "Issued when the target starts or stops needing BeginFrames.", - "parameters": [ - { - "name": "needsBeginFrames", - "description": "True if BeginFrames are needed, false otherwise.", "type": "boolean" - } - ] - } - ] - }, - { - "domain": "IO", - "description": "Input/Output operations for streams produced by DevTools.", - "types": [ - { - "id": "StreamHandle", - "description": "This is either obtained from another method or specifed as `blob:<uuid>` where\n`<uuid>` is an UUID of a Blob.", - "type": "string" - } - ], - "commands": [ - { - "name": "close", - "description": "Close the stream, discard any temporary backing storage.", - "parameters": [ + }, { - "name": "handle", - "description": "Handle of the stream to close.", - "$ref": "StreamHandle" - } - ] - }, - { - "name": "read", - "description": "Read a chunk of the stream", - "parameters": [ + "name": "backendNodeId", + "description": "`Node`'s id, corresponds to DOM.Node.backendNodeId.", + "$ref": "DOM.BackendNodeId" + }, { - "name": "handle", - "description": "Handle of the stream to read.", - "$ref": "StreamHandle" + "name": "childNodeIndexes", + "description": "The indexes of the node's child nodes in the `domNodes` array returned by `getSnapshot`, if\nany.", + "optional": true, + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "offset", - "description": "Seek to the specified offset before reading (if not specificed, proceed with offset\nfollowing the last read). Some types of streams may only support sequential reads.", + "name": "attributes", + "description": "Attributes of an `Element` node.", "optional": true, - "type": "integer" + "type": "array", + "items": { + "$ref": "NameValue" + } }, { - "name": "size", - "description": "Maximum number of bytes to read (left upon the agent discretion if not specified).", + "name": "pseudoElementIndexes", + "description": "Indexes of pseudo elements associated with this node in the `domNodes` array returned by\n`getSnapshot`, if any.", "optional": true, - "type": "integer" - } - ], - "returns": [ + "type": "array", + "items": { + "type": "integer" + } + }, { - "name": "base64Encoded", - "description": "Set if the data is base64-encoded", + "name": "layoutNodeIndex", + "description": "The index of the node's related layout tree node in the `layoutTreeNodes` array returned by\n`getSnapshot`, if any.", "optional": true, - "type": "boolean" + "type": "integer" }, { - "name": "data", - "description": "Data that were read.", + "name": "documentURL", + "description": "Document URL that `Document` or `FrameOwner` node points to.", + "optional": true, "type": "string" }, { - "name": "eof", - "description": "Set if the end-of-file condition occured while reading.", - "type": "boolean" - } - ] - }, - { - "name": "resolveBlob", - "description": "Return UUID of Blob object specified by a remote object id.", - "parameters": [ - { - "name": "objectId", - "description": "Object id of a Blob object wrapper.", - "$ref": "Runtime.RemoteObjectId" - } - ], - "returns": [ - { - "name": "uuid", - "description": "UUID of the specified Blob.", + "name": "baseURL", + "description": "Base URL that `Document` or `FrameOwner` node uses for URL completion.", + "optional": true, "type": "string" - } - ] - } - ] - }, - { - "domain": "IndexedDB", - "experimental": true, - "dependencies": [ - "Runtime" - ], - "types": [ - { - "id": "DatabaseWithObjectStores", - "description": "Database with an array of object stores.", - "type": "object", - "properties": [ + }, { - "name": "name", - "description": "Database name.", + "name": "contentLanguage", + "description": "Only set for documents, contains the document's content language.", + "optional": true, "type": "string" }, { - "name": "version", - "description": "Database version (type is not 'integer', as the standard\nrequires the version number to be 'unsigned long long')", - "type": "number" + "name": "documentEncoding", + "description": "Only set for documents, contains the document's character set encoding.", + "optional": true, + "type": "string" }, { - "name": "objectStores", - "description": "Object stores in this database.", - "type": "array", - "items": { - "$ref": "ObjectStore" - } - } - ] - }, - { - "id": "ObjectStore", - "description": "Object store.", - "type": "object", - "properties": [ - { - "name": "name", - "description": "Object store name.", + "name": "publicId", + "description": "`DocumentType` node's publicId.", + "optional": true, "type": "string" }, { - "name": "keyPath", - "description": "Object store key path.", - "$ref": "KeyPath" + "name": "systemId", + "description": "`DocumentType` node's systemId.", + "optional": true, + "type": "string" }, { - "name": "autoIncrement", - "description": "If true, object store has auto increment flag set.", - "type": "boolean" + "name": "frameId", + "description": "Frame ID for frame owner elements and also for the document node.", + "optional": true, + "$ref": "Page.FrameId" }, { - "name": "indexes", - "description": "Indexes in this object store.", - "type": "array", - "items": { - "$ref": "ObjectStoreIndex" - } - } - ] - }, - { - "id": "ObjectStoreIndex", - "description": "Object store index.", - "type": "object", - "properties": [ - { - "name": "name", - "description": "Index name.", - "type": "string" - }, - { - "name": "keyPath", - "description": "Index key path.", - "$ref": "KeyPath" - }, - { - "name": "unique", - "description": "If true, index is unique.", - "type": "boolean" - }, - { - "name": "multiEntry", - "description": "If true, index allows multiple entries for a key.", - "type": "boolean" - } - ] - }, - { - "id": "Key", - "description": "Key.", - "type": "object", - "properties": [ - { - "name": "type", - "description": "Key type.", - "type": "string", - "enum": [ - "number", - "string", - "date", - "array" - ] + "name": "contentDocumentIndex", + "description": "The index of a frame owner element's content document in the `domNodes` array returned by\n`getSnapshot`, if any.", + "optional": true, + "type": "integer" }, { - "name": "number", - "description": "Number value.", + "name": "pseudoType", + "description": "Type of a pseudo element node.", "optional": true, - "type": "number" + "$ref": "DOM.PseudoType" }, { - "name": "string", - "description": "String value.", + "name": "shadowRootType", + "description": "Shadow root type.", "optional": true, - "type": "string" + "$ref": "DOM.ShadowRootType" }, { - "name": "date", - "description": "Date value.", + "name": "isClickable", + "description": "Whether this DOM node responds to mouse clicks. This includes nodes that have had click\nevent listeners attached via JavaScript as well as anchor tags that naturally navigate when\nclicked.", "optional": true, - "type": "number" + "type": "boolean" }, { - "name": "array", - "description": "Array value.", + "name": "eventListeners", + "description": "Details of the node's event listeners, if any.", "optional": true, "type": "array", "items": { - "$ref": "Key" + "$ref": "DOMDebugger.EventListener" } - } - ] - }, - { - "id": "KeyRange", - "description": "Key range.", - "type": "object", - "properties": [ + }, { - "name": "lower", - "description": "Lower bound.", + "name": "currentSourceURL", + "description": "The selected url for nodes with a srcset attribute.", "optional": true, - "$ref": "Key" + "type": "string" }, { - "name": "upper", - "description": "Upper bound.", + "name": "originURL", + "description": "The url of the script (if any) that generates this node.", "optional": true, - "$ref": "Key" + "type": "string" }, { - "name": "lowerOpen", - "description": "If true lower bound is open.", - "type": "boolean" + "name": "scrollOffsetX", + "description": "Scroll offsets, set when this node is a Document.", + "optional": true, + "type": "number" }, { - "name": "upperOpen", - "description": "If true upper bound is open.", - "type": "boolean" + "name": "scrollOffsetY", + "optional": true, + "type": "number" } ] }, { - "id": "DataEntry", - "description": "Data entry.", + "id": "InlineTextBox", + "description": "Details of post layout rendered text positions. The exact layout should not be regarded as\nstable and may change between versions.", "type": "object", "properties": [ { - "name": "key", - "description": "Key object.", - "$ref": "Runtime.RemoteObject" + "name": "boundingBox", + "description": "The bounding box in document coordinates. Note that scroll offset of the document is ignored.", + "$ref": "DOM.Rect" }, { - "name": "primaryKey", - "description": "Primary key object.", - "$ref": "Runtime.RemoteObject" + "name": "startCharacterIndex", + "description": "The starting index in characters, for this post layout textbox substring. Characters that\nwould be represented as a surrogate pair in UTF-16 have length 2.", + "type": "integer" }, { - "name": "value", - "description": "Value object.", - "$ref": "Runtime.RemoteObject" + "name": "numCharacters", + "description": "The number of characters in this post layout textbox substring. Characters that would be\nrepresented as a surrogate pair in UTF-16 have length 2.", + "type": "integer" } ] }, { - "id": "KeyPath", - "description": "Key path.", + "id": "LayoutTreeNode", + "description": "Details of an element in the DOM tree with a LayoutObject.", "type": "object", "properties": [ { - "name": "type", - "description": "Key path type.", - "type": "string", - "enum": [ - "null", - "string", - "array" - ] + "name": "domNodeIndex", + "description": "The index of the related DOM node in the `domNodes` array returned by `getSnapshot`.", + "type": "integer" }, { - "name": "string", - "description": "String value.", + "name": "boundingBox", + "description": "The bounding box in document coordinates. Note that scroll offset of the document is ignored.", + "$ref": "DOM.Rect" + }, + { + "name": "layoutText", + "description": "Contents of the LayoutText, if any.", "optional": true, "type": "string" }, { - "name": "array", - "description": "Array value.", + "name": "inlineTextNodes", + "description": "The post-layout inline text nodes, if any.", "optional": true, "type": "array", "items": { - "type": "string" + "$ref": "InlineTextBox" } - } - ] - } - ], - "commands": [ - { - "name": "clearObjectStore", - "description": "Clears all entries from an object store.", - "parameters": [ + }, { - "name": "securityOrigin", - "description": "Security origin.", - "type": "string" + "name": "styleIndex", + "description": "Index into the `computedStyles` array returned by `getSnapshot`.", + "optional": true, + "type": "integer" }, { - "name": "databaseName", - "description": "Database name.", - "type": "string" + "name": "paintOrder", + "description": "Global paint order index, which is determined by the stacking order of the nodes. Nodes\nthat are painted together will have the same index. Only provided if includePaintOrder in\ngetSnapshot was true.", + "optional": true, + "type": "integer" }, { - "name": "objectStoreName", - "description": "Object store name.", - "type": "string" + "name": "isStackingContext", + "description": "Set to true to indicate the element begins a new stacking context.", + "optional": true, + "type": "boolean" } ] }, { - "name": "deleteDatabase", - "description": "Deletes a database.", - "parameters": [ - { - "name": "securityOrigin", - "description": "Security origin.", - "type": "string" - }, + "id": "ComputedStyle", + "description": "A subset of the full ComputedStyle as defined by the request whitelist.", + "type": "object", + "properties": [ { - "name": "databaseName", - "description": "Database name.", - "type": "string" + "name": "properties", + "description": "Name/value pairs of computed style properties.", + "type": "array", + "items": { + "$ref": "NameValue" + } } ] }, { - "name": "deleteObjectStoreEntries", - "description": "Delete a range of entries from an object store", - "parameters": [ - { - "name": "securityOrigin", - "type": "string" - }, + "id": "NameValue", + "description": "A name/value pair.", + "type": "object", + "properties": [ { - "name": "databaseName", + "name": "name", + "description": "Attribute/property name.", "type": "string" }, { - "name": "objectStoreName", + "name": "value", + "description": "Attribute/property value.", "type": "string" - }, - { - "name": "keyRange", - "description": "Range of entry keys to delete", - "$ref": "KeyRange" } ] }, { - "name": "disable", - "description": "Disables events from backend." + "id": "StringIndex", + "description": "Index of the string in the strings table.", + "type": "integer" }, { - "name": "enable", - "description": "Enables events from backend." + "id": "ArrayOfStrings", + "description": "Index of the string in the strings table.", + "type": "array", + "items": { + "$ref": "StringIndex" + } }, { - "name": "requestData", - "description": "Requests data from object store or index.", - "parameters": [ + "id": "RareStringData", + "description": "Data that is only present on rare nodes.", + "type": "object", + "properties": [ { - "name": "securityOrigin", - "description": "Security origin.", - "type": "string" - }, - { - "name": "databaseName", - "description": "Database name.", - "type": "string" - }, - { - "name": "objectStoreName", - "description": "Object store name.", - "type": "string" - }, - { - "name": "indexName", - "description": "Index name, empty string for object store data requests.", - "type": "string" - }, - { - "name": "skipCount", - "description": "Number of records to skip.", - "type": "integer" + "name": "index", + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "pageSize", - "description": "Number of records to fetch.", - "type": "integer" - }, + "name": "value", + "type": "array", + "items": { + "$ref": "StringIndex" + } + } + ] + }, + { + "id": "RareBooleanData", + "type": "object", + "properties": [ { - "name": "keyRange", - "description": "Key range.", - "optional": true, - "$ref": "KeyRange" + "name": "index", + "type": "array", + "items": { + "type": "integer" + } } - ], - "returns": [ + ] + }, + { + "id": "RareIntegerData", + "type": "object", + "properties": [ { - "name": "objectStoreDataEntries", - "description": "Array of object store data entries.", + "name": "index", "type": "array", "items": { - "$ref": "DataEntry" + "type": "integer" } }, { - "name": "hasMore", - "description": "If true, there are more entries to fetch in the given range.", - "type": "boolean" + "name": "value", + "type": "array", + "items": { + "type": "integer" + } } ] }, { - "name": "getMetadata", - "description": "Gets metadata of an object store", - "parameters": [ + "id": "Rectangle", + "type": "array", + "items": { + "type": "number" + } + }, + { + "id": "DocumentSnapshot", + "description": "Document snapshot.", + "type": "object", + "properties": [ { - "name": "securityOrigin", - "description": "Security origin.", - "type": "string" + "name": "documentURL", + "description": "Document URL that `Document` or `FrameOwner` node points to.", + "$ref": "StringIndex" }, { - "name": "databaseName", - "description": "Database name.", - "type": "string" + "name": "title", + "description": "Document title.", + "$ref": "StringIndex" }, { - "name": "objectStoreName", - "description": "Object store name.", - "type": "string" - } - ], - "returns": [ - { - "name": "entriesCount", - "description": "the entries count", - "type": "number" + "name": "baseURL", + "description": "Base URL that `Document` or `FrameOwner` node uses for URL completion.", + "$ref": "StringIndex" }, { - "name": "keyGeneratorValue", - "description": "the current value of key generator, to become the next inserted\nkey into the object store. Valid if objectStore.autoIncrement\nis true.", - "type": "number" - } - ] - }, - { - "name": "requestDatabase", - "description": "Requests database with given name in given frame.", - "parameters": [ - { - "name": "securityOrigin", - "description": "Security origin.", - "type": "string" + "name": "contentLanguage", + "description": "Contains the document's content language.", + "$ref": "StringIndex" }, { - "name": "databaseName", - "description": "Database name.", - "type": "string" - } - ], - "returns": [ + "name": "encodingName", + "description": "Contains the document's character set encoding.", + "$ref": "StringIndex" + }, { - "name": "databaseWithObjectStores", - "description": "Database with an array of object stores.", - "$ref": "DatabaseWithObjectStores" - } - ] - }, - { - "name": "requestDatabaseNames", - "description": "Requests database names for given security origin.", - "parameters": [ + "name": "publicId", + "description": "`DocumentType` node's publicId.", + "$ref": "StringIndex" + }, { - "name": "securityOrigin", - "description": "Security origin.", - "type": "string" - } - ], - "returns": [ + "name": "systemId", + "description": "`DocumentType` node's systemId.", + "$ref": "StringIndex" + }, { - "name": "databaseNames", - "description": "Database names for origin.", - "type": "array", - "items": { - "type": "string" - } - } - ] - } - ] - }, - { - "domain": "Input", - "types": [ - { - "id": "TouchPoint", - "type": "object", - "properties": [ + "name": "frameId", + "description": "Frame ID for frame owner elements and also for the document node.", + "$ref": "StringIndex" + }, { - "name": "x", - "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels.", - "type": "number" + "name": "nodes", + "description": "A table with dom nodes.", + "$ref": "NodeTreeSnapshot" }, { - "name": "y", - "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport.", - "type": "number" + "name": "layout", + "description": "The nodes in the layout tree.", + "$ref": "LayoutTreeSnapshot" }, { - "name": "radiusX", - "description": "X radius of the touch area (default: 1.0).", - "optional": true, - "type": "number" + "name": "textBoxes", + "description": "The post-layout inline text nodes.", + "$ref": "TextBoxSnapshot" }, { - "name": "radiusY", - "description": "Y radius of the touch area (default: 1.0).", + "name": "scrollOffsetX", + "description": "Horizontal scroll offset.", "optional": true, "type": "number" }, { - "name": "rotationAngle", - "description": "Rotation angle (default: 0.0).", + "name": "scrollOffsetY", + "description": "Vertical scroll offset.", "optional": true, "type": "number" }, { - "name": "force", - "description": "Force (default: 1.0).", + "name": "contentWidth", + "description": "Document content width.", "optional": true, "type": "number" }, { - "name": "id", - "description": "Identifier used to track touch sources between events, must be unique within an event.", + "name": "contentHeight", + "description": "Document content height.", "optional": true, "type": "number" } ] }, { - "id": "GestureSourceType", - "experimental": true, - "type": "string", - "enum": [ - "default", - "touch", - "mouse" - ] - }, - { - "id": "TimeSinceEpoch", - "description": "UTC time in seconds, counted from January 1, 1970.", - "type": "number" - } - ], - "commands": [ - { - "name": "dispatchKeyEvent", - "description": "Dispatches a key event to the page.", - "parameters": [ + "id": "NodeTreeSnapshot", + "description": "Table containing nodes.", + "type": "object", + "properties": [ { - "name": "type", - "description": "Type of the key event.", - "type": "string", - "enum": [ - "keyDown", - "keyUp", - "rawKeyDown", - "char" - ] + "name": "parentIndex", + "description": "Parent node index.", + "optional": true, + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "modifiers", - "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", + "name": "nodeType", + "description": "`Node`'s nodeType.", "optional": true, - "type": "integer" + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "timestamp", - "description": "Time at which the event occurred.", + "name": "shadowRootType", + "description": "Type of the shadow root the `Node` is in. String values are equal to the `ShadowRootType` enum.", "optional": true, - "$ref": "TimeSinceEpoch" + "$ref": "RareStringData" }, { - "name": "text", - "description": "Text as generated by processing a virtual key code with a keyboard layout. Not needed for\nfor `keyUp` and `rawKeyDown` events (default: \"\")", + "name": "nodeName", + "description": "`Node`'s nodeName.", "optional": true, - "type": "string" + "type": "array", + "items": { + "$ref": "StringIndex" + } }, { - "name": "unmodifiedText", - "description": "Text that would have been generated by the keyboard if no modifiers were pressed (except for\nshift). Useful for shortcut (accelerator) key handling (default: \"\").", + "name": "nodeValue", + "description": "`Node`'s nodeValue.", "optional": true, - "type": "string" + "type": "array", + "items": { + "$ref": "StringIndex" + } }, { - "name": "keyIdentifier", - "description": "Unique key identifier (e.g., 'U+0041') (default: \"\").", + "name": "backendNodeId", + "description": "`Node`'s id, corresponds to DOM.Node.backendNodeId.", "optional": true, - "type": "string" + "type": "array", + "items": { + "$ref": "DOM.BackendNodeId" + } }, { - "name": "code", - "description": "Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: \"\").", + "name": "attributes", + "description": "Attributes of an `Element` node. Flatten name, value pairs.", "optional": true, - "type": "string" + "type": "array", + "items": { + "$ref": "ArrayOfStrings" + } }, { - "name": "key", - "description": "Unique DOM defined string value describing the meaning of the key in the context of active\nmodifiers, keyboard layout, etc (e.g., 'AltGr') (default: \"\").", + "name": "textValue", + "description": "Only set for textarea elements, contains the text value.", "optional": true, - "type": "string" + "$ref": "RareStringData" }, { - "name": "windowsVirtualKeyCode", - "description": "Windows virtual key code (default: 0).", + "name": "inputValue", + "description": "Only set for input elements, contains the input's associated text value.", "optional": true, - "type": "integer" + "$ref": "RareStringData" }, { - "name": "nativeVirtualKeyCode", - "description": "Native virtual key code (default: 0).", + "name": "inputChecked", + "description": "Only set for radio and checkbox input elements, indicates if the element has been checked", "optional": true, - "type": "integer" + "$ref": "RareBooleanData" }, { - "name": "autoRepeat", - "description": "Whether the event was generated from auto repeat (default: false).", + "name": "optionSelected", + "description": "Only set for option elements, indicates if the element has been selected", "optional": true, - "type": "boolean" + "$ref": "RareBooleanData" }, { - "name": "isKeypad", - "description": "Whether the event was generated from the keypad (default: false).", + "name": "contentDocumentIndex", + "description": "The index of the document in the list of the snapshot documents.", "optional": true, - "type": "boolean" + "$ref": "RareIntegerData" }, { - "name": "isSystemKey", - "description": "Whether the event was a system key event (default: false).", + "name": "pseudoType", + "description": "Type of a pseudo element node.", "optional": true, - "type": "boolean" + "$ref": "RareStringData" }, { - "name": "location", - "description": "Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:\n0).", + "name": "isClickable", + "description": "Whether this DOM node responds to mouse clicks. This includes nodes that have had click\nevent listeners attached via JavaScript as well as anchor tags that naturally navigate when\nclicked.", "optional": true, - "type": "integer" - } - ] - }, - { - "name": "insertText", - "description": "This method emulates inserting text that doesn't come from a key press,\nfor example an emoji keyboard or an IME.", - "experimental": true, - "parameters": [ + "$ref": "RareBooleanData" + }, { - "name": "text", - "description": "The text to insert.", - "type": "string" + "name": "currentSourceURL", + "description": "The selected url for nodes with a srcset attribute.", + "optional": true, + "$ref": "RareStringData" + }, + { + "name": "originURL", + "description": "The url of the script (if any) that generates this node.", + "optional": true, + "$ref": "RareStringData" } ] }, { - "name": "dispatchMouseEvent", - "description": "Dispatches a mouse event to the page.", - "parameters": [ + "id": "LayoutTreeSnapshot", + "description": "Table of details of an element in the DOM tree with a LayoutObject.", + "type": "object", + "properties": [ { - "name": "type", - "description": "Type of the mouse event.", - "type": "string", - "enum": [ - "mousePressed", - "mouseReleased", - "mouseMoved", - "mouseWheel" - ] + "name": "nodeIndex", + "description": "Index of the corresponding node in the `NodeTreeSnapshot` array returned by `captureSnapshot`.", + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "x", - "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels.", - "type": "number" + "name": "styles", + "description": "Array of indexes specifying computed style strings, filtered according to the `computedStyles` parameter passed to `captureSnapshot`.", + "type": "array", + "items": { + "$ref": "ArrayOfStrings" + } }, { - "name": "y", - "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport.", - "type": "number" + "name": "bounds", + "description": "The absolute position bounding box.", + "type": "array", + "items": { + "$ref": "Rectangle" + } }, { - "name": "modifiers", - "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", - "optional": true, - "type": "integer" + "name": "text", + "description": "Contents of the LayoutText, if any.", + "type": "array", + "items": { + "$ref": "StringIndex" + } }, { - "name": "timestamp", - "description": "Time at which the event occurred.", - "optional": true, - "$ref": "TimeSinceEpoch" + "name": "stackingContexts", + "description": "Stacking context information.", + "$ref": "RareBooleanData" }, { - "name": "button", - "description": "Mouse button (default: \"none\").", + "name": "paintOrders", + "description": "Global paint order index, which is determined by the stacking order of the nodes. Nodes\nthat are painted together will have the same index. Only provided if includePaintOrder in\ncaptureSnapshot was true.", "optional": true, - "type": "string", - "enum": [ - "none", - "left", - "middle", - "right", - "back", - "forward" - ] + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "buttons", - "description": "A number indicating which buttons are pressed on the mouse when a mouse event is triggered.\nLeft=1, Right=2, Middle=4, Back=8, Forward=16, None=0.", + "name": "offsetRects", + "description": "The offset rect of nodes. Only available when includeDOMRects is set to true", "optional": true, - "type": "integer" + "type": "array", + "items": { + "$ref": "Rectangle" + } }, { - "name": "clickCount", - "description": "Number of times the mouse button was clicked (default: 0).", + "name": "scrollRects", + "description": "The scroll rect of nodes. Only available when includeDOMRects is set to true", "optional": true, - "type": "integer" + "type": "array", + "items": { + "$ref": "Rectangle" + } }, { - "name": "deltaX", - "description": "X delta in CSS pixels for mouse wheel event (default: 0).", + "name": "clientRects", + "description": "The client rect of nodes. Only available when includeDOMRects is set to true", "optional": true, - "type": "number" + "type": "array", + "items": { + "$ref": "Rectangle" + } }, { - "name": "deltaY", - "description": "Y delta in CSS pixels for mouse wheel event (default: 0).", + "name": "blendedBackgroundColors", + "description": "The list of background colors that are blended with colors of overlapping elements.", + "experimental": true, "optional": true, - "type": "number" + "type": "array", + "items": { + "$ref": "StringIndex" + } }, { - "name": "pointerType", - "description": "Pointer type (default: \"mouse\").", + "name": "textColorOpacities", + "description": "The list of computed text opacities.", + "experimental": true, "optional": true, - "type": "string", - "enum": [ - "mouse", - "pen" - ] + "type": "array", + "items": { + "type": "number" + } } ] }, { - "name": "dispatchTouchEvent", - "description": "Dispatches a touch event to the page.", - "parameters": [ + "id": "TextBoxSnapshot", + "description": "Table of details of the post layout rendered text positions. The exact layout should not be regarded as\nstable and may change between versions.", + "type": "object", + "properties": [ { - "name": "type", - "description": "Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while\nTouchStart and TouchMove must contains at least one.", - "type": "string", - "enum": [ - "touchStart", - "touchEnd", - "touchMove", - "touchCancel" - ] + "name": "layoutIndex", + "description": "Index of the layout tree node that owns this box collection.", + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "touchPoints", - "description": "Active touch points on the touch device. One event per any changed point (compared to\nprevious touch event in a sequence) is generated, emulating pressing/moving/releasing points\none by one.", + "name": "bounds", + "description": "The absolute position bounding box.", "type": "array", "items": { - "$ref": "TouchPoint" + "$ref": "Rectangle" } }, { - "name": "modifiers", - "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", - "optional": true, - "type": "integer" + "name": "start", + "description": "The starting index in characters, for this post layout textbox substring. Characters that\nwould be represented as a surrogate pair in UTF-16 have length 2.", + "type": "array", + "items": { + "type": "integer" + } }, { - "name": "timestamp", - "description": "Time at which the event occurred.", - "optional": true, - "$ref": "TimeSinceEpoch" + "name": "length", + "description": "The number of characters in this post layout textbox substring. Characters that would be\nrepresented as a surrogate pair in UTF-16 have length 2.", + "type": "array", + "items": { + "type": "integer" + } } ] + } + ], + "commands": [ + { + "name": "disable", + "description": "Disables DOM snapshot agent for the given page." }, { - "name": "emulateTouchFromMouseEvent", - "description": "Emulates touch event from the mouse event parameters.", - "experimental": true, + "name": "enable", + "description": "Enables DOM snapshot agent for the given page." + }, + { + "name": "getSnapshot", + "description": "Returns a document snapshot, including the full DOM tree of the root node (including iframes,\ntemplate contents, and imported documents) in a flattened array, as well as layout and\nwhite-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is\nflattened.", + "deprecated": true, "parameters": [ { - "name": "type", - "description": "Type of the mouse event.", - "type": "string", - "enum": [ - "mousePressed", - "mouseReleased", - "mouseMoved", - "mouseWheel" - ] + "name": "computedStyleWhitelist", + "description": "Whitelist of computed styles to return.", + "type": "array", + "items": { + "type": "string" + } }, { - "name": "x", - "description": "X coordinate of the mouse pointer in DIP.", - "type": "integer" + "name": "includeEventListeners", + "description": "Whether or not to retrieve details of DOM listeners (default false).", + "optional": true, + "type": "boolean" }, { - "name": "y", - "description": "Y coordinate of the mouse pointer in DIP.", - "type": "integer" + "name": "includePaintOrder", + "description": "Whether to determine and include the paint order index of LayoutTreeNodes (default false).", + "optional": true, + "type": "boolean" }, { - "name": "button", - "description": "Mouse button.", - "type": "string", - "enum": [ - "none", - "left", - "middle", - "right" - ] + "name": "includeUserAgentShadowTree", + "description": "Whether to include UA shadow tree in the snapshot (default false).", + "optional": true, + "type": "boolean" + } + ], + "returns": [ + { + "name": "domNodes", + "description": "The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.", + "type": "array", + "items": { + "$ref": "DOMNode" + } }, { - "name": "timestamp", - "description": "Time at which the event occurred (default: current time).", - "optional": true, - "$ref": "TimeSinceEpoch" + "name": "layoutTreeNodes", + "description": "The nodes in the layout tree.", + "type": "array", + "items": { + "$ref": "LayoutTreeNode" + } }, { - "name": "deltaX", - "description": "X delta in DIP for mouse wheel event (default: 0).", + "name": "computedStyles", + "description": "Whitelisted ComputedStyle properties for each node in the layout tree.", + "type": "array", + "items": { + "$ref": "ComputedStyle" + } + } + ] + }, + { + "name": "captureSnapshot", + "description": "Returns a document snapshot, including the full DOM tree of the root node (including iframes,\ntemplate contents, and imported documents) in a flattened array, as well as layout and\nwhite-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is\nflattened.", + "parameters": [ + { + "name": "computedStyles", + "description": "Whitelist of computed styles to return.", + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "includePaintOrder", + "description": "Whether to include layout object paint orders into the snapshot.", "optional": true, - "type": "number" + "type": "boolean" }, { - "name": "deltaY", - "description": "Y delta in DIP for mouse wheel event (default: 0).", + "name": "includeDOMRects", + "description": "Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot", "optional": true, - "type": "number" + "type": "boolean" }, { - "name": "modifiers", - "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", + "name": "includeBlendedBackgroundColors", + "description": "Whether to include blended background colors in the snapshot (default: false).\nBlended background color is achieved by blending background colors of all elements\nthat overlap with the current element.", + "experimental": true, "optional": true, - "type": "integer" + "type": "boolean" }, { - "name": "clickCount", - "description": "Number of times the mouse button was clicked (default: 0).", + "name": "includeTextColorOpacities", + "description": "Whether to include text color opacity in the snapshot (default: false).\nAn element might have the opacity property set that affects the text color of the element.\nThe final text color opacity is computed based on the opacity of all overlapping elements.", + "experimental": true, "optional": true, - "type": "integer" + "type": "boolean" + } + ], + "returns": [ + { + "name": "documents", + "description": "The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.", + "type": "array", + "items": { + "$ref": "DocumentSnapshot" + } + }, + { + "name": "strings", + "description": "Shared string table that all string properties refer to with indexes.", + "type": "array", + "items": { + "type": "string" + } } ] - }, + } + ] + }, + { + "domain": "DOMStorage", + "description": "Query and modify DOM storage.", + "experimental": true, + "types": [ { - "name": "setIgnoreInputEvents", - "description": "Ignores input events (useful while auditing page).", - "parameters": [ + "id": "StorageId", + "description": "DOM Storage identifier.", + "type": "object", + "properties": [ { - "name": "ignore", - "description": "Ignores input events processing when set to true.", + "name": "securityOrigin", + "description": "Security origin for the storage.", + "type": "string" + }, + { + "name": "isLocalStorage", + "description": "Whether the storage is local storage (not session storage).", "type": "boolean" } ] }, { - "name": "synthesizePinchGesture", - "description": "Synthesizes a pinch gesture over a time period by issuing appropriate touch events.", - "experimental": true, + "id": "Item", + "description": "DOM Storage item.", + "type": "array", + "items": { + "type": "string" + } + } + ], + "commands": [ + { + "name": "clear", "parameters": [ { - "name": "x", - "description": "X coordinate of the start of the gesture in CSS pixels.", - "type": "number" - }, + "name": "storageId", + "$ref": "StorageId" + } + ] + }, + { + "name": "disable", + "description": "Disables storage tracking, prevents storage events from being sent to the client." + }, + { + "name": "enable", + "description": "Enables storage tracking, storage events will now be delivered to the client." + }, + { + "name": "getDOMStorageItems", + "parameters": [ { - "name": "y", - "description": "Y coordinate of the start of the gesture in CSS pixels.", - "type": "number" - }, + "name": "storageId", + "$ref": "StorageId" + } + ], + "returns": [ { - "name": "scaleFactor", - "description": "Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).", - "type": "number" - }, + "name": "entries", + "type": "array", + "items": { + "$ref": "Item" + } + } + ] + }, + { + "name": "removeDOMStorageItem", + "parameters": [ { - "name": "relativeSpeed", - "description": "Relative pointer speed in pixels per second (default: 800).", - "optional": true, - "type": "integer" + "name": "storageId", + "$ref": "StorageId" }, { - "name": "gestureSourceType", - "description": "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type).", - "optional": true, - "$ref": "GestureSourceType" + "name": "key", + "type": "string" } ] }, { - "name": "synthesizeScrollGesture", - "description": "Synthesizes a scroll gesture over a time period by issuing appropriate touch events.", - "experimental": true, + "name": "setDOMStorageItem", "parameters": [ { - "name": "x", - "description": "X coordinate of the start of the gesture in CSS pixels.", - "type": "number" - }, - { - "name": "y", - "description": "Y coordinate of the start of the gesture in CSS pixels.", - "type": "number" - }, - { - "name": "xDistance", - "description": "The distance to scroll along the X axis (positive to scroll left).", - "optional": true, - "type": "number" - }, - { - "name": "yDistance", - "description": "The distance to scroll along the Y axis (positive to scroll up).", - "optional": true, - "type": "number" - }, - { - "name": "xOverscroll", - "description": "The number of additional pixels to scroll back along the X axis, in addition to the given\ndistance.", - "optional": true, - "type": "number" + "name": "storageId", + "$ref": "StorageId" }, { - "name": "yOverscroll", - "description": "The number of additional pixels to scroll back along the Y axis, in addition to the given\ndistance.", - "optional": true, - "type": "number" + "name": "key", + "type": "string" }, { - "name": "preventFling", - "description": "Prevent fling (default: true).", - "optional": true, - "type": "boolean" - }, + "name": "value", + "type": "string" + } + ] + } + ], + "events": [ + { + "name": "domStorageItemAdded", + "parameters": [ { - "name": "speed", - "description": "Swipe speed in pixels per second (default: 800).", - "optional": true, - "type": "integer" + "name": "storageId", + "$ref": "StorageId" }, { - "name": "gestureSourceType", - "description": "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type).", - "optional": true, - "$ref": "GestureSourceType" + "name": "key", + "type": "string" }, { - "name": "repeatCount", - "description": "The number of times to repeat the gesture (default: 0).", - "optional": true, - "type": "integer" - }, + "name": "newValue", + "type": "string" + } + ] + }, + { + "name": "domStorageItemRemoved", + "parameters": [ { - "name": "repeatDelayMs", - "description": "The number of milliseconds delay between each repeat. (default: 250).", - "optional": true, - "type": "integer" + "name": "storageId", + "$ref": "StorageId" }, { - "name": "interactionMarkerName", - "description": "The name of the interaction markers to generate, if not empty (default: \"\").", - "optional": true, + "name": "key", "type": "string" } ] }, { - "name": "synthesizeTapGesture", - "description": "Synthesizes a tap gesture over a time period by issuing appropriate touch events.", - "experimental": true, + "name": "domStorageItemUpdated", "parameters": [ { - "name": "x", - "description": "X coordinate of the start of the gesture in CSS pixels.", - "type": "number" - }, - { - "name": "y", - "description": "Y coordinate of the start of the gesture in CSS pixels.", - "type": "number" + "name": "storageId", + "$ref": "StorageId" }, { - "name": "duration", - "description": "Duration between touchdown and touchup events in ms (default: 50).", - "optional": true, - "type": "integer" + "name": "key", + "type": "string" }, { - "name": "tapCount", - "description": "Number of times to perform the tap (e.g. 2 for double tap, default: 1).", - "optional": true, - "type": "integer" + "name": "oldValue", + "type": "string" }, { - "name": "gestureSourceType", - "description": "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type).", - "optional": true, - "$ref": "GestureSourceType" + "name": "newValue", + "type": "string" } ] - } - ] - }, - { - "domain": "Inspector", - "experimental": true, - "commands": [ - { - "name": "disable", - "description": "Disables inspector domain notifications." }, { - "name": "enable", - "description": "Enables inspector domain notifications." - } - ], - "events": [ - { - "name": "detached", - "description": "Fired when remote debugging connection is about to be terminated. Contains detach reason.", + "name": "domStorageItemsCleared", "parameters": [ { - "name": "reason", - "description": "The reason why connection has been terminated.", - "type": "string" + "name": "storageId", + "$ref": "StorageId" } ] - }, - { - "name": "targetCrashed", - "description": "Fired when debugging target has crashed" - }, - { - "name": "targetReloadedAfterCrash", - "description": "Fired when debugging target has reloaded after crash" } ] }, { - "domain": "LayerTree", + "domain": "Database", "experimental": true, - "dependencies": [ - "DOM" - ], "types": [ { - "id": "LayerId", - "description": "Unique Layer identifier.", - "type": "string" - }, - { - "id": "SnapshotId", - "description": "Unique snapshot identifier.", + "id": "DatabaseId", + "description": "Unique identifier of Database object.", "type": "string" }, { - "id": "ScrollRect", - "description": "Rectangle where scrolling happens on the main thread.", - "type": "object", - "properties": [ - { - "name": "rect", - "description": "Rectangle itself.", - "$ref": "DOM.Rect" - }, - { - "name": "type", - "description": "Reason for rectangle to force scrolling on the main thread", - "type": "string", - "enum": [ - "RepaintsOnScroll", - "TouchEventHandler", - "WheelEventHandler" - ] - } - ] - }, - { - "id": "StickyPositionConstraint", - "description": "Sticky position constraints.", + "id": "Database", + "description": "Database object.", "type": "object", "properties": [ { - "name": "stickyBoxRect", - "description": "Layout rectangle of the sticky element before being shifted", - "$ref": "DOM.Rect" + "name": "id", + "description": "Database ID.", + "$ref": "DatabaseId" }, { - "name": "containingBlockRect", - "description": "Layout rectangle of the containing block of the sticky element", - "$ref": "DOM.Rect" + "name": "domain", + "description": "Database domain.", + "type": "string" }, { - "name": "nearestLayerShiftingStickyBox", - "description": "The nearest sticky layer that shifts the sticky box", - "optional": true, - "$ref": "LayerId" + "name": "name", + "description": "Database name.", + "type": "string" }, { - "name": "nearestLayerShiftingContainingBlock", - "description": "The nearest sticky layer that shifts the containing block", - "optional": true, - "$ref": "LayerId" + "name": "version", + "description": "Database version.", + "type": "string" } ] }, { - "id": "PictureTile", - "description": "Serialized fragment of layer picture along with its offset within the layer.", + "id": "Error", + "description": "Database error.", "type": "object", "properties": [ { - "name": "x", - "description": "Offset from owning layer left boundary", - "type": "number" - }, - { - "name": "y", - "description": "Offset from owning layer top boundary", - "type": "number" + "name": "message", + "description": "Error message.", + "type": "string" }, { - "name": "picture", - "description": "Base64-encoded snapshot data.", - "type": "string" + "name": "code", + "description": "Error code.", + "type": "integer" } ] + } + ], + "commands": [ + { + "name": "disable", + "description": "Disables database tracking, prevents database events from being sent to the client." }, { - "id": "Layer", - "description": "Information about a compositing layer.", - "type": "object", - "properties": [ + "name": "enable", + "description": "Enables database tracking, database events will now be delivered to the client." + }, + { + "name": "executeSQL", + "parameters": [ { - "name": "layerId", - "description": "The unique id for this layer.", - "$ref": "LayerId" + "name": "databaseId", + "$ref": "DatabaseId" }, { - "name": "parentLayerId", - "description": "The id of parent (not present for root).", - "optional": true, - "$ref": "LayerId" - }, - { - "name": "backendNodeId", - "description": "The backend id for the node associated with this layer.", - "optional": true, - "$ref": "DOM.BackendNodeId" - }, - { - "name": "offsetX", - "description": "Offset from parent layer, X coordinate.", - "type": "number" - }, - { - "name": "offsetY", - "description": "Offset from parent layer, Y coordinate.", - "type": "number" - }, - { - "name": "width", - "description": "Layer width.", - "type": "number" - }, - { - "name": "height", - "description": "Layer height.", - "type": "number" - }, + "name": "query", + "type": "string" + } + ], + "returns": [ { - "name": "transform", - "description": "Transformation matrix for layer, default is identity matrix", + "name": "columnNames", "optional": true, "type": "array", "items": { - "type": "number" + "type": "string" } }, { - "name": "anchorX", - "description": "Transform anchor point X, absent if no transform specified", - "optional": true, - "type": "number" - }, - { - "name": "anchorY", - "description": "Transform anchor point Y, absent if no transform specified", - "optional": true, - "type": "number" - }, - { - "name": "anchorZ", - "description": "Transform anchor point Z, absent if no transform specified", - "optional": true, - "type": "number" - }, - { - "name": "paintCount", - "description": "Indicates how many time this layer has painted.", - "type": "integer" - }, - { - "name": "drawsContent", - "description": "Indicates whether this layer hosts any content, rather than being used for\ntransform/scrolling purposes only.", - "type": "boolean" - }, - { - "name": "invisible", - "description": "Set if layer is not visible.", - "optional": true, - "type": "boolean" - }, - { - "name": "scrollRects", - "description": "Rectangles scrolling on main thread only.", + "name": "values", "optional": true, "type": "array", "items": { - "$ref": "ScrollRect" + "type": "any" } }, { - "name": "stickyPositionConstraint", - "description": "Sticky position constraint information", + "name": "sqlError", "optional": true, - "$ref": "StickyPositionConstraint" + "$ref": "Error" } ] }, { - "id": "PaintProfile", - "description": "Array of timings, one per paint step.", - "type": "array", - "items": { - "type": "number" - } - } - ], - "commands": [ - { - "name": "compositingReasons", - "description": "Provides the reasons why the given layer was composited.", + "name": "getDatabaseTableNames", "parameters": [ { - "name": "layerId", - "description": "The id of the layer for which we want to get the reasons it was composited.", - "$ref": "LayerId" + "name": "databaseId", + "$ref": "DatabaseId" } ], "returns": [ { - "name": "compositingReasons", - "description": "A list of strings specifying reasons for the given layer to become composited.", + "name": "tableNames", "type": "array", "items": { "type": "string" } } ] - }, + } + ], + "events": [ { - "name": "disable", - "description": "Disables compositing tree inspection." - }, + "name": "addDatabase", + "parameters": [ + { + "name": "database", + "$ref": "Database" + } + ] + } + ] + }, + { + "domain": "DeviceOrientation", + "experimental": true, + "commands": [ { - "name": "enable", - "description": "Enables compositing tree inspection." + "name": "clearDeviceOrientationOverride", + "description": "Clears the overridden Device Orientation." }, { - "name": "loadSnapshot", - "description": "Returns the snapshot identifier.", + "name": "setDeviceOrientationOverride", + "description": "Overrides the Device Orientation.", "parameters": [ { - "name": "tiles", - "description": "An array of tiles composing the snapshot.", - "type": "array", - "items": { - "$ref": "PictureTile" - } - } - ], - "returns": [ + "name": "alpha", + "description": "Mock alpha", + "type": "number" + }, { - "name": "snapshotId", - "description": "The id of the snapshot.", - "$ref": "SnapshotId" + "name": "beta", + "description": "Mock beta", + "type": "number" + }, + { + "name": "gamma", + "description": "Mock gamma", + "type": "number" } ] - }, + } + ] + }, + { + "domain": "Emulation", + "description": "This domain emulates different environments for the page.", + "dependencies": [ + "DOM", + "Page", + "Runtime" + ], + "types": [ { - "name": "makeSnapshot", - "description": "Returns the layer snapshot identifier.", - "parameters": [ + "id": "ScreenOrientation", + "description": "Screen orientation.", + "type": "object", + "properties": [ { - "name": "layerId", - "description": "The id of the layer.", - "$ref": "LayerId" - } - ], - "returns": [ + "name": "type", + "description": "Orientation type.", + "type": "string", + "enum": [ + "portraitPrimary", + "portraitSecondary", + "landscapePrimary", + "landscapeSecondary" + ] + }, { - "name": "snapshotId", - "description": "The id of the layer snapshot.", - "$ref": "SnapshotId" + "name": "angle", + "description": "Orientation angle.", + "type": "integer" } ] }, { - "name": "profileSnapshot", - "parameters": [ + "id": "DisplayFeature", + "type": "object", + "properties": [ { - "name": "snapshotId", - "description": "The id of the layer snapshot.", - "$ref": "SnapshotId" + "name": "orientation", + "description": "Orientation of a display feature in relation to screen", + "type": "string", + "enum": [ + "vertical", + "horizontal" + ] }, { - "name": "minRepeatCount", - "description": "The maximum number of times to replay the snapshot (1, if not specified).", - "optional": true, + "name": "offset", + "description": "The offset from the screen origin in either the x (for vertical\norientation) or y (for horizontal orientation) direction.", "type": "integer" }, { - "name": "minDuration", - "description": "The minimum duration (in seconds) to replay the snapshot.", - "optional": true, - "type": "number" - }, - { - "name": "clipRect", - "description": "The clip rectangle to apply when replaying the snapshot.", - "optional": true, - "$ref": "DOM.Rect" - } - ], - "returns": [ - { - "name": "timings", - "description": "The array of paint profiles, one per run.", - "type": "array", - "items": { - "$ref": "PaintProfile" - } + "name": "maskLength", + "description": "A display feature may mask content such that it is not physically\ndisplayed - this length along with the offset describes this area.\nA display feature that only splits content will have a 0 mask_length.", + "type": "integer" } ] }, { - "name": "releaseSnapshot", - "description": "Releases layer snapshot captured by the back-end.", - "parameters": [ + "id": "MediaFeature", + "type": "object", + "properties": [ { - "name": "snapshotId", - "description": "The id of the layer snapshot.", - "$ref": "SnapshotId" + "name": "name", + "type": "string" + }, + { + "name": "value", + "type": "string" } ] }, { - "name": "replaySnapshot", - "description": "Replays the layer snapshot and returns the resulting bitmap.", - "parameters": [ - { - "name": "snapshotId", - "description": "The id of the layer snapshot.", - "$ref": "SnapshotId" - }, - { - "name": "fromStep", - "description": "The first step to replay from (replay from the very start if not specified).", - "optional": true, - "type": "integer" - }, + "id": "VirtualTimePolicy", + "description": "advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to\nallow the next delayed task (if any) to run; pause: The virtual time base may not advance;\npauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending\nresource fetches.", + "experimental": true, + "type": "string", + "enum": [ + "advance", + "pause", + "pauseIfNetworkFetchesPending" + ] + }, + { + "id": "UserAgentBrandVersion", + "description": "Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints", + "experimental": true, + "type": "object", + "properties": [ { - "name": "toStep", - "description": "The last step to replay to (replay till the end if not specified).", - "optional": true, - "type": "integer" + "name": "brand", + "type": "string" }, { - "name": "scale", - "description": "The scale to apply while replaying (defaults to 1).", - "optional": true, - "type": "number" - } - ], - "returns": [ - { - "name": "dataURL", - "description": "A data: URL for resulting image.", + "name": "version", "type": "string" } ] }, { - "name": "snapshotCommandLog", - "description": "Replays the layer snapshot and returns canvas log.", - "parameters": [ - { - "name": "snapshotId", - "description": "The id of the layer snapshot.", - "$ref": "SnapshotId" - } - ], - "returns": [ + "id": "UserAgentMetadata", + "description": "Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints\nMissing optional values will be filled in by the target with what it would normally use.", + "experimental": true, + "type": "object", + "properties": [ { - "name": "commandLog", - "description": "The array of canvas function calls.", + "name": "brands", + "optional": true, "type": "array", "items": { - "type": "object" + "$ref": "UserAgentBrandVersion" } - } - ] - } - ], - "events": [ - { - "name": "layerPainted", - "parameters": [ - { - "name": "layerId", - "description": "The id of the painted layer.", - "$ref": "LayerId" }, { - "name": "clip", - "description": "Clip rectangle.", - "$ref": "DOM.Rect" - } - ] - }, - { - "name": "layerTreeDidChange", - "parameters": [ - { - "name": "layers", - "description": "Layer tree, absent if not in the comspositing mode.", + "name": "fullVersionList", "optional": true, "type": "array", "items": { - "$ref": "Layer" + "$ref": "UserAgentBrandVersion" } - } - ] - } - ] - }, - { - "domain": "Log", - "description": "Provides access to log entries.", - "dependencies": [ - "Runtime", - "Network" - ], - "types": [ - { - "id": "LogEntry", - "description": "Log entry.", - "type": "object", - "properties": [ - { - "name": "source", - "description": "Log entry source.", - "type": "string", - "enum": [ - "xml", - "javascript", - "network", - "storage", - "appcache", - "rendering", - "security", - "deprecation", - "worker", - "violation", - "intervention", - "recommendation", - "other" - ] - }, - { - "name": "level", - "description": "Log entry severity.", - "type": "string", - "enum": [ - "verbose", - "info", - "warning", - "error" - ] - }, - { - "name": "text", - "description": "Logged text.", - "type": "string" - }, - { - "name": "timestamp", - "description": "Timestamp when this entry was added.", - "$ref": "Runtime.Timestamp" }, { - "name": "url", - "description": "URL of the resource if known.", + "name": "fullVersion", + "deprecated": true, "optional": true, "type": "string" }, { - "name": "lineNumber", - "description": "Line number in the resource.", - "optional": true, - "type": "integer" + "name": "platform", + "type": "string" }, { - "name": "stackTrace", - "description": "JavaScript stack trace.", - "optional": true, - "$ref": "Runtime.StackTrace" + "name": "platformVersion", + "type": "string" }, { - "name": "networkRequestId", - "description": "Identifier of the network request associated with this entry.", - "optional": true, - "$ref": "Network.RequestId" + "name": "architecture", + "type": "string" }, { - "name": "workerId", - "description": "Identifier of the worker associated with this entry.", - "optional": true, + "name": "model", "type": "string" }, { - "name": "args", - "description": "Call arguments.", - "optional": true, - "type": "array", - "items": { - "$ref": "Runtime.RemoteObject" - } + "name": "mobile", + "type": "boolean" } ] }, { - "id": "ViolationSetting", - "description": "Violation configuration setting.", - "type": "object", - "properties": [ - { - "name": "name", - "description": "Violation type.", - "type": "string", - "enum": [ - "longTask", - "longLayout", - "blockedEvent", - "blockedParser", - "discouragedAPIUse", - "handler", - "recurringHandler" - ] - }, - { - "name": "threshold", - "description": "Time threshold to trigger upon.", - "type": "number" - } + "id": "DisabledImageType", + "description": "Enum of image types that can be disabled.", + "experimental": true, + "type": "string", + "enum": [ + "avif", + "jxl", + "webp" ] } ], "commands": [ { - "name": "clear", - "description": "Clears the log." + "name": "canEmulate", + "description": "Tells whether emulation is supported.", + "returns": [ + { + "name": "result", + "description": "True if emulation is supported.", + "type": "boolean" + } + ] }, { - "name": "disable", - "description": "Disables log domain, prevents further log entries from being reported to the client." + "name": "clearDeviceMetricsOverride", + "description": "Clears the overridden device metrics." }, { - "name": "enable", - "description": "Enables log domain, sends the entries collected so far to the client by means of the\n`entryAdded` notification." + "name": "clearGeolocationOverride", + "description": "Clears the overridden Geolocation Position and Error." }, { - "name": "startViolationsReport", - "description": "start violation reporting.", + "name": "resetPageScaleFactor", + "description": "Requests that page scale factor is reset to initial values.", + "experimental": true + }, + { + "name": "setFocusEmulationEnabled", + "description": "Enables or disables simulating a focused and active page.", + "experimental": true, "parameters": [ { - "name": "config", - "description": "Configuration for violations.", - "type": "array", - "items": { - "$ref": "ViolationSetting" - } + "name": "enabled", + "description": "Whether to enable to disable focus emulation.", + "type": "boolean" } ] }, { - "name": "stopViolationsReport", - "description": "Stop violation reporting." - } - ], - "events": [ - { - "name": "entryAdded", - "description": "Issued when new message was logged.", + "name": "setAutoDarkModeOverride", + "description": "Automatically render all web contents using a dark theme.", + "experimental": true, "parameters": [ { - "name": "entry", - "description": "The entry.", - "$ref": "LogEntry" + "name": "enabled", + "description": "Whether to enable or disable automatic dark mode.\nIf not specified, any existing override will be cleared.", + "optional": true, + "type": "boolean" } ] - } - ] - }, - { - "domain": "Memory", - "experimental": true, - "types": [ + }, { - "id": "PressureLevel", - "description": "Memory pressure level.", - "type": "string", - "enum": [ - "moderate", - "critical" - ] - }, - { - "id": "SamplingProfileNode", - "description": "Heap profile sample.", - "type": "object", - "properties": [ - { - "name": "size", - "description": "Size of the sampled allocation.", - "type": "number" - }, + "name": "setCPUThrottlingRate", + "description": "Enables CPU throttling to emulate slow CPUs.", + "experimental": true, + "parameters": [ { - "name": "total", - "description": "Total bytes attributed to this sample.", + "name": "rate", + "description": "Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).", "type": "number" - }, - { - "name": "stack", - "description": "Execution stack at the point of allocation.", - "type": "array", - "items": { - "type": "string" - } } ] }, { - "id": "SamplingProfile", - "description": "Array of heap profile samples.", - "type": "object", - "properties": [ - { - "name": "samples", - "type": "array", - "items": { - "$ref": "SamplingProfileNode" - } - }, + "name": "setDefaultBackgroundColorOverride", + "description": "Sets or clears an override of the default background color of the frame. This override is used\nif the content does not specify one.", + "parameters": [ { - "name": "modules", - "type": "array", - "items": { - "$ref": "Module" - } + "name": "color", + "description": "RGBA of the default background color. If not specified, any existing override will be\ncleared.", + "optional": true, + "$ref": "DOM.RGBA" } ] }, { - "id": "Module", - "description": "Executable module information", - "type": "object", - "properties": [ + "name": "setDeviceMetricsOverride", + "description": "Overrides the values of device screen dimensions (window.screen.width, window.screen.height,\nwindow.innerWidth, window.innerHeight, and \"device-width\"/\"device-height\"-related CSS media\nquery results).", + "parameters": [ { - "name": "name", - "description": "Name of the module.", - "type": "string" + "name": "width", + "description": "Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.", + "type": "integer" }, { - "name": "uuid", - "description": "UUID of the module.", - "type": "string" + "name": "height", + "description": "Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.", + "type": "integer" }, { - "name": "baseAddress", - "description": "Base address where the module is loaded into memory. Encoded as a decimal\nor hexadecimal (0x prefixed) string.", - "type": "string" + "name": "deviceScaleFactor", + "description": "Overriding device scale factor value. 0 disables the override.", + "type": "number" }, { - "name": "size", - "description": "Size of the module in bytes.", + "name": "mobile", + "description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text\nautosizing and more.", + "type": "boolean" + }, + { + "name": "scale", + "description": "Scale to apply to resulting view image.", + "experimental": true, + "optional": true, "type": "number" - } - ] - } - ], - "commands": [ - { - "name": "getDOMCounters", - "returns": [ + }, { - "name": "documents", + "name": "screenWidth", + "description": "Overriding screen width value in pixels (minimum 0, maximum 10000000).", + "experimental": true, + "optional": true, "type": "integer" }, { - "name": "nodes", + "name": "screenHeight", + "description": "Overriding screen height value in pixels (minimum 0, maximum 10000000).", + "experimental": true, + "optional": true, "type": "integer" }, { - "name": "jsEventListeners", + "name": "positionX", + "description": "Overriding view X position on screen in pixels (minimum 0, maximum 10000000).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "positionY", + "description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).", + "experimental": true, + "optional": true, "type": "integer" + }, + { + "name": "dontSetVisibleSize", + "description": "Do not set visible view size, rely upon explicit setVisibleSize call.", + "experimental": true, + "optional": true, + "type": "boolean" + }, + { + "name": "screenOrientation", + "description": "Screen orientation override.", + "optional": true, + "$ref": "ScreenOrientation" + }, + { + "name": "viewport", + "description": "If set, the visible area of the page will be overridden to this viewport. This viewport\nchange is not observed by the page, e.g. viewport-relative elements do not change positions.", + "experimental": true, + "optional": true, + "$ref": "Page.Viewport" + }, + { + "name": "displayFeature", + "description": "If set, the display feature of a multi-segment screen. If not set, multi-segment support\nis turned-off.", + "experimental": true, + "optional": true, + "$ref": "DisplayFeature" } ] }, { - "name": "prepareForLeakDetection" - }, - { - "name": "forciblyPurgeJavaScriptMemory", - "description": "Simulate OomIntervention by purging V8 memory." + "name": "setScrollbarsHidden", + "experimental": true, + "parameters": [ + { + "name": "hidden", + "description": "Whether scrollbars should be always hidden.", + "type": "boolean" + } + ] }, { - "name": "setPressureNotificationsSuppressed", - "description": "Enable/disable suppressing memory pressure notifications in all processes.", + "name": "setDocumentCookieDisabled", + "experimental": true, "parameters": [ { - "name": "suppressed", - "description": "If true, memory pressure notifications will be suppressed.", + "name": "disabled", + "description": "Whether document.coookie API should be disabled.", "type": "boolean" } ] }, { - "name": "simulatePressureNotification", - "description": "Simulate a memory pressure notification in all processes.", + "name": "setEmitTouchEventsForMouse", + "experimental": true, "parameters": [ { - "name": "level", - "description": "Memory pressure level of the notification.", - "$ref": "PressureLevel" + "name": "enabled", + "description": "Whether touch emulation based on mouse input should be enabled.", + "type": "boolean" + }, + { + "name": "configuration", + "description": "Touch/gesture events configuration. Default: current platform.", + "optional": true, + "type": "string", + "enum": [ + "mobile", + "desktop" + ] } ] }, { - "name": "startSampling", - "description": "Start collecting native memory profile.", + "name": "setEmulatedMedia", + "description": "Emulates the given media type or media feature for CSS media queries.", "parameters": [ { - "name": "samplingInterval", - "description": "Average number of bytes between samples.", + "name": "media", + "description": "Media type to emulate. Empty string disables the override.", "optional": true, - "type": "integer" + "type": "string" }, { - "name": "suppressRandomness", - "description": "Do not randomize intervals between samples.", + "name": "features", + "description": "Media features to emulate.", "optional": true, - "type": "boolean" + "type": "array", + "items": { + "$ref": "MediaFeature" + } } ] }, { - "name": "stopSampling", - "description": "Stop collecting native memory profile." - }, - { - "name": "getAllTimeSamplingProfile", - "description": "Retrieve native memory allocations profile\ncollected since renderer process startup.", - "returns": [ + "name": "setEmulatedVisionDeficiency", + "description": "Emulates the given vision deficiency.", + "experimental": true, + "parameters": [ { - "name": "profile", - "$ref": "SamplingProfile" + "name": "type", + "description": "Vision deficiency to emulate.", + "type": "string", + "enum": [ + "none", + "achromatopsia", + "blurredVision", + "deuteranopia", + "protanopia", + "tritanopia" + ] } ] }, { - "name": "getBrowserSamplingProfile", - "description": "Retrieve native memory allocations profile\ncollected since browser process startup.", - "returns": [ + "name": "setGeolocationOverride", + "description": "Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position\nunavailable.", + "parameters": [ { - "name": "profile", - "$ref": "SamplingProfile" + "name": "latitude", + "description": "Mock latitude", + "optional": true, + "type": "number" + }, + { + "name": "longitude", + "description": "Mock longitude", + "optional": true, + "type": "number" + }, + { + "name": "accuracy", + "description": "Mock accuracy", + "optional": true, + "type": "number" } ] }, { - "name": "getSamplingProfile", - "description": "Retrieve native memory allocations profile collected since last\n`startSampling` call.", - "returns": [ + "name": "setIdleOverride", + "description": "Overrides the Idle state.", + "experimental": true, + "parameters": [ { - "name": "profile", - "$ref": "SamplingProfile" + "name": "isUserActive", + "description": "Mock isUserActive", + "type": "boolean" + }, + { + "name": "isScreenUnlocked", + "description": "Mock isScreenUnlocked", + "type": "boolean" } ] - } - ] - }, - { - "domain": "Network", - "description": "Network domain allows tracking network activities of the page. It exposes information about http,\nfile, data and other requests and responses, their headers, bodies, timing, etc.", - "dependencies": [ - "Debugger", - "Runtime", - "Security" - ], - "types": [ + }, { - "id": "ResourceType", - "description": "Resource type as it was perceived by the rendering engine.", - "type": "string", - "enum": [ - "Document", - "Stylesheet", - "Image", - "Media", - "Font", - "Script", - "TextTrack", - "XHR", - "Fetch", - "EventSource", - "WebSocket", - "Manifest", - "SignedExchange", - "Ping", - "CSPViolationReport", - "Other" + "name": "clearIdleOverride", + "description": "Clears Idle state overrides.", + "experimental": true + }, + { + "name": "setNavigatorOverrides", + "description": "Overrides value returned by the javascript navigator object.", + "experimental": true, + "deprecated": true, + "parameters": [ + { + "name": "platform", + "description": "The platform navigator.platform should return.", + "type": "string" + } ] }, { - "id": "LoaderId", - "description": "Unique loader identifier.", - "type": "string" + "name": "setPageScaleFactor", + "description": "Sets a specified page scale factor.", + "experimental": true, + "parameters": [ + { + "name": "pageScaleFactor", + "description": "Page scale factor.", + "type": "number" + } + ] }, { - "id": "RequestId", - "description": "Unique request identifier.", - "type": "string" + "name": "setScriptExecutionDisabled", + "description": "Switches script execution in the page.", + "parameters": [ + { + "name": "value", + "description": "Whether script execution should be disabled in the page.", + "type": "boolean" + } + ] }, { - "id": "InterceptionId", - "description": "Unique intercepted request identifier.", - "type": "string" + "name": "setTouchEmulationEnabled", + "description": "Enables touch on platforms which do not support them.", + "parameters": [ + { + "name": "enabled", + "description": "Whether the touch event emulation should be enabled.", + "type": "boolean" + }, + { + "name": "maxTouchPoints", + "description": "Maximum touch points supported. Defaults to one.", + "optional": true, + "type": "integer" + } + ] }, { - "id": "ErrorReason", - "description": "Network level fetch failure reason.", - "type": "string", - "enum": [ - "Failed", - "Aborted", - "TimedOut", - "AccessDenied", - "ConnectionClosed", - "ConnectionReset", - "ConnectionRefused", - "ConnectionAborted", - "ConnectionFailed", - "NameNotResolved", - "InternetDisconnected", - "AddressUnreachable", - "BlockedByClient", - "BlockedByResponse" + "name": "setVirtualTimePolicy", + "description": "Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets\nthe current virtual time policy. Note this supersedes any previous time budget.", + "experimental": true, + "parameters": [ + { + "name": "policy", + "$ref": "VirtualTimePolicy" + }, + { + "name": "budget", + "description": "If set, after this many virtual milliseconds have elapsed virtual time will be paused and a\nvirtualTimeBudgetExpired event is sent.", + "optional": true, + "type": "number" + }, + { + "name": "maxVirtualTimeTaskStarvationCount", + "description": "If set this specifies the maximum number of tasks that can be run before virtual is forced\nforwards to prevent deadlock.", + "optional": true, + "type": "integer" + }, + { + "name": "waitForNavigation", + "description": "If set the virtual time policy change should be deferred until any frame starts navigating.\nNote any previous deferred policy change is superseded.", + "optional": true, + "type": "boolean" + }, + { + "name": "initialVirtualTime", + "description": "If set, base::Time::Now will be overridden to initially return this value.", + "optional": true, + "$ref": "Network.TimeSinceEpoch" + } + ], + "returns": [ + { + "name": "virtualTimeTicksBase", + "description": "Absolute timestamp at which virtual time was first enabled (up time in milliseconds).", + "type": "number" + } ] }, { - "id": "TimeSinceEpoch", - "description": "UTC time in seconds, counted from January 1, 1970.", - "type": "number" + "name": "setLocaleOverride", + "description": "Overrides default host system locale with the specified one.", + "experimental": true, + "parameters": [ + { + "name": "locale", + "description": "ICU style C locale (e.g. \"en_US\"). If not specified or empty, disables the override and\nrestores default host system locale.", + "optional": true, + "type": "string" + } + ] }, { - "id": "MonotonicTime", - "description": "Monotonically increasing time in seconds since an arbitrary point in the past.", - "type": "number" + "name": "setTimezoneOverride", + "description": "Overrides default host system timezone with the specified one.", + "experimental": true, + "parameters": [ + { + "name": "timezoneId", + "description": "The timezone identifier. If empty, disables the override and\nrestores default host system timezone.", + "type": "string" + } + ] }, { - "id": "Headers", - "description": "Request / response headers as keys / values of JSON object.", - "type": "object" + "name": "setVisibleSize", + "description": "Resizes the frame/viewport of the page. Note that this does not affect the frame's container\n(e.g. browser window). Can be used to produce screenshots of the specified size. Not supported\non Android.", + "experimental": true, + "deprecated": true, + "parameters": [ + { + "name": "width", + "description": "Frame width (DIP).", + "type": "integer" + }, + { + "name": "height", + "description": "Frame height (DIP).", + "type": "integer" + } + ] }, { - "id": "ConnectionType", - "description": "The underlying connection technology that the browser is supposedly using.", - "type": "string", - "enum": [ - "none", - "cellular2g", - "cellular3g", - "cellular4g", - "bluetooth", - "ethernet", - "wifi", - "wimax", - "other" + "name": "setDisabledImageTypes", + "experimental": true, + "parameters": [ + { + "name": "imageTypes", + "description": "Image types to disable.", + "type": "array", + "items": { + "$ref": "DisabledImageType" + } + } ] }, { - "id": "CookieSameSite", - "description": "Represents the cookie's 'SameSite' status:\nhttps://tools.ietf.org/html/draft-west-first-party-cookies", - "type": "string", - "enum": [ - "Strict", - "Lax", - "Extended", - "None" + "name": "setUserAgentOverride", + "description": "Allows overriding user agent with the given string.", + "parameters": [ + { + "name": "userAgent", + "description": "User agent to use.", + "type": "string" + }, + { + "name": "acceptLanguage", + "description": "Browser langugage to emulate.", + "optional": true, + "type": "string" + }, + { + "name": "platform", + "description": "The platform navigator.platform should return.", + "optional": true, + "type": "string" + }, + { + "name": "userAgentMetadata", + "description": "To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData", + "experimental": true, + "optional": true, + "$ref": "UserAgentMetadata" + } + ] + } + ], + "events": [ + { + "name": "virtualTimeBudgetExpired", + "description": "Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.", + "experimental": true + } + ] + }, + { + "domain": "HeadlessExperimental", + "description": "This domain provides experimental commands only supported in headless mode.", + "experimental": true, + "dependencies": [ + "Page", + "Runtime" + ], + "types": [ + { + "id": "ScreenshotParams", + "description": "Encoding options for a screenshot.", + "type": "object", + "properties": [ + { + "name": "format", + "description": "Image compression format (defaults to png).", + "optional": true, + "type": "string", + "enum": [ + "jpeg", + "png" + ] + }, + { + "name": "quality", + "description": "Compression quality from range [0..100] (jpeg only).", + "optional": true, + "type": "integer" + } + ] + } + ], + "commands": [ + { + "name": "beginFrame", + "description": "Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a\nscreenshot from the resulting frame. Requires that the target was created with enabled\nBeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also\nhttps://goo.gl/3zHXhB for more background.", + "parameters": [ + { + "name": "frameTimeTicks", + "description": "Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set,\nthe current time will be used.", + "optional": true, + "type": "number" + }, + { + "name": "interval", + "description": "The interval between BeginFrames that is reported to the compositor, in milliseconds.\nDefaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.", + "optional": true, + "type": "number" + }, + { + "name": "noDisplayUpdates", + "description": "Whether updates should not be committed and drawn onto the display. False by default. If\ntrue, only side effects of the BeginFrame will be run, such as layout and animations, but\nany visual updates may not be visible on the display or in screenshots.", + "optional": true, + "type": "boolean" + }, + { + "name": "screenshot", + "description": "If set, a screenshot of the frame will be captured and returned in the response. Otherwise,\nno screenshot will be captured. Note that capturing a screenshot can fail, for example,\nduring renderer initialization. In such a case, no screenshot data will be returned.", + "optional": true, + "$ref": "ScreenshotParams" + } + ], + "returns": [ + { + "name": "hasDamage", + "description": "Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the\ndisplay. Reported for diagnostic uses, may be removed in the future.", + "type": "boolean" + }, + { + "name": "screenshotData", + "description": "Base64-encoded image data of the screenshot, if one was requested and successfully taken. (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" + } + ] + }, + { + "name": "disable", + "description": "Disables headless events for the target." + }, + { + "name": "enable", + "description": "Enables headless events for the target." + } + ], + "events": [ + { + "name": "needsBeginFramesChanged", + "description": "Issued when the target starts or stops needing BeginFrames.\nDeprecated. Issue beginFrame unconditionally instead and use result from\nbeginFrame to detect whether the frames were suppressed.", + "deprecated": true, + "parameters": [ + { + "name": "needsBeginFrames", + "description": "True if BeginFrames are needed, false otherwise.", + "type": "boolean" + } + ] + } + ] + }, + { + "domain": "IO", + "description": "Input/Output operations for streams produced by DevTools.", + "types": [ + { + "id": "StreamHandle", + "description": "This is either obtained from another method or specified as `blob:<uuid>` where\n`<uuid>` is an UUID of a Blob.", + "type": "string" + } + ], + "commands": [ + { + "name": "close", + "description": "Close the stream, discard any temporary backing storage.", + "parameters": [ + { + "name": "handle", + "description": "Handle of the stream to close.", + "$ref": "StreamHandle" + } + ] + }, + { + "name": "read", + "description": "Read a chunk of the stream", + "parameters": [ + { + "name": "handle", + "description": "Handle of the stream to read.", + "$ref": "StreamHandle" + }, + { + "name": "offset", + "description": "Seek to the specified offset before reading (if not specificed, proceed with offset\nfollowing the last read). Some types of streams may only support sequential reads.", + "optional": true, + "type": "integer" + }, + { + "name": "size", + "description": "Maximum number of bytes to read (left upon the agent discretion if not specified).", + "optional": true, + "type": "integer" + } + ], + "returns": [ + { + "name": "base64Encoded", + "description": "Set if the data is base64-encoded", + "optional": true, + "type": "boolean" + }, + { + "name": "data", + "description": "Data that were read.", + "type": "string" + }, + { + "name": "eof", + "description": "Set if the end-of-file condition occurred while reading.", + "type": "boolean" + } + ] + }, + { + "name": "resolveBlob", + "description": "Return UUID of Blob object specified by a remote object id.", + "parameters": [ + { + "name": "objectId", + "description": "Object id of a Blob object wrapper.", + "$ref": "Runtime.RemoteObjectId" + } + ], + "returns": [ + { + "name": "uuid", + "description": "UUID of the specified Blob.", + "type": "string" + } + ] + } + ] + }, + { + "domain": "IndexedDB", + "experimental": true, + "dependencies": [ + "Runtime" + ], + "types": [ + { + "id": "DatabaseWithObjectStores", + "description": "Database with an array of object stores.", + "type": "object", + "properties": [ + { + "name": "name", + "description": "Database name.", + "type": "string" + }, + { + "name": "version", + "description": "Database version (type is not 'integer', as the standard\nrequires the version number to be 'unsigned long long')", + "type": "number" + }, + { + "name": "objectStores", + "description": "Object stores in this database.", + "type": "array", + "items": { + "$ref": "ObjectStore" + } + } + ] + }, + { + "id": "ObjectStore", + "description": "Object store.", + "type": "object", + "properties": [ + { + "name": "name", + "description": "Object store name.", + "type": "string" + }, + { + "name": "keyPath", + "description": "Object store key path.", + "$ref": "KeyPath" + }, + { + "name": "autoIncrement", + "description": "If true, object store has auto increment flag set.", + "type": "boolean" + }, + { + "name": "indexes", + "description": "Indexes in this object store.", + "type": "array", + "items": { + "$ref": "ObjectStoreIndex" + } + } + ] + }, + { + "id": "ObjectStoreIndex", + "description": "Object store index.", + "type": "object", + "properties": [ + { + "name": "name", + "description": "Index name.", + "type": "string" + }, + { + "name": "keyPath", + "description": "Index key path.", + "$ref": "KeyPath" + }, + { + "name": "unique", + "description": "If true, index is unique.", + "type": "boolean" + }, + { + "name": "multiEntry", + "description": "If true, index allows multiple entries for a key.", + "type": "boolean" + } + ] + }, + { + "id": "Key", + "description": "Key.", + "type": "object", + "properties": [ + { + "name": "type", + "description": "Key type.", + "type": "string", + "enum": [ + "number", + "string", + "date", + "array" + ] + }, + { + "name": "number", + "description": "Number value.", + "optional": true, + "type": "number" + }, + { + "name": "string", + "description": "String value.", + "optional": true, + "type": "string" + }, + { + "name": "date", + "description": "Date value.", + "optional": true, + "type": "number" + }, + { + "name": "array", + "description": "Array value.", + "optional": true, + "type": "array", + "items": { + "$ref": "Key" + } + } + ] + }, + { + "id": "KeyRange", + "description": "Key range.", + "type": "object", + "properties": [ + { + "name": "lower", + "description": "Lower bound.", + "optional": true, + "$ref": "Key" + }, + { + "name": "upper", + "description": "Upper bound.", + "optional": true, + "$ref": "Key" + }, + { + "name": "lowerOpen", + "description": "If true lower bound is open.", + "type": "boolean" + }, + { + "name": "upperOpen", + "description": "If true upper bound is open.", + "type": "boolean" + } + ] + }, + { + "id": "DataEntry", + "description": "Data entry.", + "type": "object", + "properties": [ + { + "name": "key", + "description": "Key object.", + "$ref": "Runtime.RemoteObject" + }, + { + "name": "primaryKey", + "description": "Primary key object.", + "$ref": "Runtime.RemoteObject" + }, + { + "name": "value", + "description": "Value object.", + "$ref": "Runtime.RemoteObject" + } + ] + }, + { + "id": "KeyPath", + "description": "Key path.", + "type": "object", + "properties": [ + { + "name": "type", + "description": "Key path type.", + "type": "string", + "enum": [ + "null", + "string", + "array" + ] + }, + { + "name": "string", + "description": "String value.", + "optional": true, + "type": "string" + }, + { + "name": "array", + "description": "Array value.", + "optional": true, + "type": "array", + "items": { + "type": "string" + } + } + ] + } + ], + "commands": [ + { + "name": "clearObjectStore", + "description": "Clears all entries from an object store.", + "parameters": [ + { + "name": "securityOrigin", + "description": "Security origin.", + "type": "string" + }, + { + "name": "databaseName", + "description": "Database name.", + "type": "string" + }, + { + "name": "objectStoreName", + "description": "Object store name.", + "type": "string" + } + ] + }, + { + "name": "deleteDatabase", + "description": "Deletes a database.", + "parameters": [ + { + "name": "securityOrigin", + "description": "Security origin.", + "type": "string" + }, + { + "name": "databaseName", + "description": "Database name.", + "type": "string" + } + ] + }, + { + "name": "deleteObjectStoreEntries", + "description": "Delete a range of entries from an object store", + "parameters": [ + { + "name": "securityOrigin", + "type": "string" + }, + { + "name": "databaseName", + "type": "string" + }, + { + "name": "objectStoreName", + "type": "string" + }, + { + "name": "keyRange", + "description": "Range of entry keys to delete", + "$ref": "KeyRange" + } + ] + }, + { + "name": "disable", + "description": "Disables events from backend." + }, + { + "name": "enable", + "description": "Enables events from backend." + }, + { + "name": "requestData", + "description": "Requests data from object store or index.", + "parameters": [ + { + "name": "securityOrigin", + "description": "Security origin.", + "type": "string" + }, + { + "name": "databaseName", + "description": "Database name.", + "type": "string" + }, + { + "name": "objectStoreName", + "description": "Object store name.", + "type": "string" + }, + { + "name": "indexName", + "description": "Index name, empty string for object store data requests.", + "type": "string" + }, + { + "name": "skipCount", + "description": "Number of records to skip.", + "type": "integer" + }, + { + "name": "pageSize", + "description": "Number of records to fetch.", + "type": "integer" + }, + { + "name": "keyRange", + "description": "Key range.", + "optional": true, + "$ref": "KeyRange" + } + ], + "returns": [ + { + "name": "objectStoreDataEntries", + "description": "Array of object store data entries.", + "type": "array", + "items": { + "$ref": "DataEntry" + } + }, + { + "name": "hasMore", + "description": "If true, there are more entries to fetch in the given range.", + "type": "boolean" + } + ] + }, + { + "name": "getMetadata", + "description": "Gets metadata of an object store", + "parameters": [ + { + "name": "securityOrigin", + "description": "Security origin.", + "type": "string" + }, + { + "name": "databaseName", + "description": "Database name.", + "type": "string" + }, + { + "name": "objectStoreName", + "description": "Object store name.", + "type": "string" + } + ], + "returns": [ + { + "name": "entriesCount", + "description": "the entries count", + "type": "number" + }, + { + "name": "keyGeneratorValue", + "description": "the current value of key generator, to become the next inserted\nkey into the object store. Valid if objectStore.autoIncrement\nis true.", + "type": "number" + } + ] + }, + { + "name": "requestDatabase", + "description": "Requests database with given name in given frame.", + "parameters": [ + { + "name": "securityOrigin", + "description": "Security origin.", + "type": "string" + }, + { + "name": "databaseName", + "description": "Database name.", + "type": "string" + } + ], + "returns": [ + { + "name": "databaseWithObjectStores", + "description": "Database with an array of object stores.", + "$ref": "DatabaseWithObjectStores" + } + ] + }, + { + "name": "requestDatabaseNames", + "description": "Requests database names for given security origin.", + "parameters": [ + { + "name": "securityOrigin", + "description": "Security origin.", + "type": "string" + } + ], + "returns": [ + { + "name": "databaseNames", + "description": "Database names for origin.", + "type": "array", + "items": { + "type": "string" + } + } + ] + } + ] + }, + { + "domain": "Input", + "types": [ + { + "id": "TouchPoint", + "type": "object", + "properties": [ + { + "name": "x", + "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels.", + "type": "number" + }, + { + "name": "y", + "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport.", + "type": "number" + }, + { + "name": "radiusX", + "description": "X radius of the touch area (default: 1.0).", + "optional": true, + "type": "number" + }, + { + "name": "radiusY", + "description": "Y radius of the touch area (default: 1.0).", + "optional": true, + "type": "number" + }, + { + "name": "rotationAngle", + "description": "Rotation angle (default: 0.0).", + "optional": true, + "type": "number" + }, + { + "name": "force", + "description": "Force (default: 1.0).", + "optional": true, + "type": "number" + }, + { + "name": "tangentialPressure", + "description": "The normalized tangential pressure, which has a range of [-1,1] (default: 0).", + "experimental": true, + "optional": true, + "type": "number" + }, + { + "name": "tiltX", + "description": "The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0)", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "tiltY", + "description": "The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "twist", + "description": "The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "id", + "description": "Identifier used to track touch sources between events, must be unique within an event.", + "optional": true, + "type": "number" + } + ] + }, + { + "id": "GestureSourceType", + "experimental": true, + "type": "string", + "enum": [ + "default", + "touch", + "mouse" + ] + }, + { + "id": "MouseButton", + "type": "string", + "enum": [ + "none", + "left", + "middle", + "right", + "back", + "forward" + ] + }, + { + "id": "TimeSinceEpoch", + "description": "UTC time in seconds, counted from January 1, 1970.", + "type": "number" + }, + { + "id": "DragDataItem", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "mimeType", + "description": "Mime type of the dragged data.", + "type": "string" + }, + { + "name": "data", + "description": "Depending of the value of `mimeType`, it contains the dragged link,\ntext, HTML markup or any other data.", + "type": "string" + }, + { + "name": "title", + "description": "Title associated with a link. Only valid when `mimeType` == \"text/uri-list\".", + "optional": true, + "type": "string" + }, + { + "name": "baseURL", + "description": "Stores the base URL for the contained markup. Only valid when `mimeType`\n== \"text/html\".", + "optional": true, + "type": "string" + } + ] + }, + { + "id": "DragData", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "items", + "type": "array", + "items": { + "$ref": "DragDataItem" + } + }, + { + "name": "files", + "description": "List of filenames that should be included when dropping", + "optional": true, + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "dragOperationsMask", + "description": "Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16", + "type": "integer" + } + ] + } + ], + "commands": [ + { + "name": "dispatchDragEvent", + "description": "Dispatches a drag event into the page.", + "experimental": true, + "parameters": [ + { + "name": "type", + "description": "Type of the drag event.", + "type": "string", + "enum": [ + "dragEnter", + "dragOver", + "drop", + "dragCancel" + ] + }, + { + "name": "x", + "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels.", + "type": "number" + }, + { + "name": "y", + "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport.", + "type": "number" + }, + { + "name": "data", + "$ref": "DragData" + }, + { + "name": "modifiers", + "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", + "optional": true, + "type": "integer" + } + ] + }, + { + "name": "dispatchKeyEvent", + "description": "Dispatches a key event to the page.", + "parameters": [ + { + "name": "type", + "description": "Type of the key event.", + "type": "string", + "enum": [ + "keyDown", + "keyUp", + "rawKeyDown", + "char" + ] + }, + { + "name": "modifiers", + "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "timestamp", + "description": "Time at which the event occurred.", + "optional": true, + "$ref": "TimeSinceEpoch" + }, + { + "name": "text", + "description": "Text as generated by processing a virtual key code with a keyboard layout. Not needed for\nfor `keyUp` and `rawKeyDown` events (default: \"\")", + "optional": true, + "type": "string" + }, + { + "name": "unmodifiedText", + "description": "Text that would have been generated by the keyboard if no modifiers were pressed (except for\nshift). Useful for shortcut (accelerator) key handling (default: \"\").", + "optional": true, + "type": "string" + }, + { + "name": "keyIdentifier", + "description": "Unique key identifier (e.g., 'U+0041') (default: \"\").", + "optional": true, + "type": "string" + }, + { + "name": "code", + "description": "Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: \"\").", + "optional": true, + "type": "string" + }, + { + "name": "key", + "description": "Unique DOM defined string value describing the meaning of the key in the context of active\nmodifiers, keyboard layout, etc (e.g., 'AltGr') (default: \"\").", + "optional": true, + "type": "string" + }, + { + "name": "windowsVirtualKeyCode", + "description": "Windows virtual key code (default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "nativeVirtualKeyCode", + "description": "Native virtual key code (default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "autoRepeat", + "description": "Whether the event was generated from auto repeat (default: false).", + "optional": true, + "type": "boolean" + }, + { + "name": "isKeypad", + "description": "Whether the event was generated from the keypad (default: false).", + "optional": true, + "type": "boolean" + }, + { + "name": "isSystemKey", + "description": "Whether the event was a system key event (default: false).", + "optional": true, + "type": "boolean" + }, + { + "name": "location", + "description": "Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:\n0).", + "optional": true, + "type": "integer" + }, + { + "name": "commands", + "description": "Editing commands to send with the key event (e.g., 'selectAll') (default: []).\nThese are related to but not equal the command names used in `document.execCommand` and NSStandardKeyBindingResponding.\nSee https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.", + "experimental": true, + "optional": true, + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "name": "insertText", + "description": "This method emulates inserting text that doesn't come from a key press,\nfor example an emoji keyboard or an IME.", + "experimental": true, + "parameters": [ + { + "name": "text", + "description": "The text to insert.", + "type": "string" + } + ] + }, + { + "name": "imeSetComposition", + "description": "This method sets the current candidate text for ime.\nUse imeCommitComposition to commit the final text.\nUse imeSetComposition with empty string as text to cancel composition.", + "experimental": true, + "parameters": [ + { + "name": "text", + "description": "The text to insert", + "type": "string" + }, + { + "name": "selectionStart", + "description": "selection start", + "type": "integer" + }, + { + "name": "selectionEnd", + "description": "selection end", + "type": "integer" + }, + { + "name": "replacementStart", + "description": "replacement start", + "optional": true, + "type": "integer" + }, + { + "name": "replacementEnd", + "description": "replacement end", + "optional": true, + "type": "integer" + } + ] + }, + { + "name": "dispatchMouseEvent", + "description": "Dispatches a mouse event to the page.", + "parameters": [ + { + "name": "type", + "description": "Type of the mouse event.", + "type": "string", + "enum": [ + "mousePressed", + "mouseReleased", + "mouseMoved", + "mouseWheel" + ] + }, + { + "name": "x", + "description": "X coordinate of the event relative to the main frame's viewport in CSS pixels.", + "type": "number" + }, + { + "name": "y", + "description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport.", + "type": "number" + }, + { + "name": "modifiers", + "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "timestamp", + "description": "Time at which the event occurred.", + "optional": true, + "$ref": "TimeSinceEpoch" + }, + { + "name": "button", + "description": "Mouse button (default: \"none\").", + "optional": true, + "$ref": "MouseButton" + }, + { + "name": "buttons", + "description": "A number indicating which buttons are pressed on the mouse when a mouse event is triggered.\nLeft=1, Right=2, Middle=4, Back=8, Forward=16, None=0.", + "optional": true, + "type": "integer" + }, + { + "name": "clickCount", + "description": "Number of times the mouse button was clicked (default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "force", + "description": "The normalized pressure, which has a range of [0,1] (default: 0).", + "experimental": true, + "optional": true, + "type": "number" + }, + { + "name": "tangentialPressure", + "description": "The normalized tangential pressure, which has a range of [-1,1] (default: 0).", + "experimental": true, + "optional": true, + "type": "number" + }, + { + "name": "tiltX", + "description": "The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "tiltY", + "description": "The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "twist", + "description": "The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "deltaX", + "description": "X delta in CSS pixels for mouse wheel event (default: 0).", + "optional": true, + "type": "number" + }, + { + "name": "deltaY", + "description": "Y delta in CSS pixels for mouse wheel event (default: 0).", + "optional": true, + "type": "number" + }, + { + "name": "pointerType", + "description": "Pointer type (default: \"mouse\").", + "optional": true, + "type": "string", + "enum": [ + "mouse", + "pen" + ] + } + ] + }, + { + "name": "dispatchTouchEvent", + "description": "Dispatches a touch event to the page.", + "parameters": [ + { + "name": "type", + "description": "Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while\nTouchStart and TouchMove must contains at least one.", + "type": "string", + "enum": [ + "touchStart", + "touchEnd", + "touchMove", + "touchCancel" + ] + }, + { + "name": "touchPoints", + "description": "Active touch points on the touch device. One event per any changed point (compared to\nprevious touch event in a sequence) is generated, emulating pressing/moving/releasing points\none by one.", + "type": "array", + "items": { + "$ref": "TouchPoint" + } + }, + { + "name": "modifiers", + "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "timestamp", + "description": "Time at which the event occurred.", + "optional": true, + "$ref": "TimeSinceEpoch" + } + ] + }, + { + "name": "emulateTouchFromMouseEvent", + "description": "Emulates touch event from the mouse event parameters.", + "experimental": true, + "parameters": [ + { + "name": "type", + "description": "Type of the mouse event.", + "type": "string", + "enum": [ + "mousePressed", + "mouseReleased", + "mouseMoved", + "mouseWheel" + ] + }, + { + "name": "x", + "description": "X coordinate of the mouse pointer in DIP.", + "type": "integer" + }, + { + "name": "y", + "description": "Y coordinate of the mouse pointer in DIP.", + "type": "integer" + }, + { + "name": "button", + "description": "Mouse button. Only \"none\", \"left\", \"right\" are supported.", + "$ref": "MouseButton" + }, + { + "name": "timestamp", + "description": "Time at which the event occurred (default: current time).", + "optional": true, + "$ref": "TimeSinceEpoch" + }, + { + "name": "deltaX", + "description": "X delta in DIP for mouse wheel event (default: 0).", + "optional": true, + "type": "number" + }, + { + "name": "deltaY", + "description": "Y delta in DIP for mouse wheel event (default: 0).", + "optional": true, + "type": "number" + }, + { + "name": "modifiers", + "description": "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "clickCount", + "description": "Number of times the mouse button was clicked (default: 0).", + "optional": true, + "type": "integer" + } + ] + }, + { + "name": "setIgnoreInputEvents", + "description": "Ignores input events (useful while auditing page).", + "parameters": [ + { + "name": "ignore", + "description": "Ignores input events processing when set to true.", + "type": "boolean" + } + ] + }, + { + "name": "setInterceptDrags", + "description": "Prevents default drag and drop behavior and instead emits `Input.dragIntercepted` events.\nDrag and drop behavior can be directly controlled via `Input.dispatchDragEvent`.", + "experimental": true, + "parameters": [ + { + "name": "enabled", + "type": "boolean" + } + ] + }, + { + "name": "synthesizePinchGesture", + "description": "Synthesizes a pinch gesture over a time period by issuing appropriate touch events.", + "experimental": true, + "parameters": [ + { + "name": "x", + "description": "X coordinate of the start of the gesture in CSS pixels.", + "type": "number" + }, + { + "name": "y", + "description": "Y coordinate of the start of the gesture in CSS pixels.", + "type": "number" + }, + { + "name": "scaleFactor", + "description": "Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).", + "type": "number" + }, + { + "name": "relativeSpeed", + "description": "Relative pointer speed in pixels per second (default: 800).", + "optional": true, + "type": "integer" + }, + { + "name": "gestureSourceType", + "description": "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type).", + "optional": true, + "$ref": "GestureSourceType" + } + ] + }, + { + "name": "synthesizeScrollGesture", + "description": "Synthesizes a scroll gesture over a time period by issuing appropriate touch events.", + "experimental": true, + "parameters": [ + { + "name": "x", + "description": "X coordinate of the start of the gesture in CSS pixels.", + "type": "number" + }, + { + "name": "y", + "description": "Y coordinate of the start of the gesture in CSS pixels.", + "type": "number" + }, + { + "name": "xDistance", + "description": "The distance to scroll along the X axis (positive to scroll left).", + "optional": true, + "type": "number" + }, + { + "name": "yDistance", + "description": "The distance to scroll along the Y axis (positive to scroll up).", + "optional": true, + "type": "number" + }, + { + "name": "xOverscroll", + "description": "The number of additional pixels to scroll back along the X axis, in addition to the given\ndistance.", + "optional": true, + "type": "number" + }, + { + "name": "yOverscroll", + "description": "The number of additional pixels to scroll back along the Y axis, in addition to the given\ndistance.", + "optional": true, + "type": "number" + }, + { + "name": "preventFling", + "description": "Prevent fling (default: true).", + "optional": true, + "type": "boolean" + }, + { + "name": "speed", + "description": "Swipe speed in pixels per second (default: 800).", + "optional": true, + "type": "integer" + }, + { + "name": "gestureSourceType", + "description": "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type).", + "optional": true, + "$ref": "GestureSourceType" + }, + { + "name": "repeatCount", + "description": "The number of times to repeat the gesture (default: 0).", + "optional": true, + "type": "integer" + }, + { + "name": "repeatDelayMs", + "description": "The number of milliseconds delay between each repeat. (default: 250).", + "optional": true, + "type": "integer" + }, + { + "name": "interactionMarkerName", + "description": "The name of the interaction markers to generate, if not empty (default: \"\").", + "optional": true, + "type": "string" + } + ] + }, + { + "name": "synthesizeTapGesture", + "description": "Synthesizes a tap gesture over a time period by issuing appropriate touch events.", + "experimental": true, + "parameters": [ + { + "name": "x", + "description": "X coordinate of the start of the gesture in CSS pixels.", + "type": "number" + }, + { + "name": "y", + "description": "Y coordinate of the start of the gesture in CSS pixels.", + "type": "number" + }, + { + "name": "duration", + "description": "Duration between touchdown and touchup events in ms (default: 50).", + "optional": true, + "type": "integer" + }, + { + "name": "tapCount", + "description": "Number of times to perform the tap (e.g. 2 for double tap, default: 1).", + "optional": true, + "type": "integer" + }, + { + "name": "gestureSourceType", + "description": "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type).", + "optional": true, + "$ref": "GestureSourceType" + } + ] + } + ], + "events": [ + { + "name": "dragIntercepted", + "description": "Emitted only when `Input.setInterceptDrags` is enabled. Use this data with `Input.dispatchDragEvent` to\nrestore normal drag and drop behavior.", + "experimental": true, + "parameters": [ + { + "name": "data", + "$ref": "DragData" + } + ] + } + ] + }, + { + "domain": "Inspector", + "experimental": true, + "commands": [ + { + "name": "disable", + "description": "Disables inspector domain notifications." + }, + { + "name": "enable", + "description": "Enables inspector domain notifications." + } + ], + "events": [ + { + "name": "detached", + "description": "Fired when remote debugging connection is about to be terminated. Contains detach reason.", + "parameters": [ + { + "name": "reason", + "description": "The reason why connection has been terminated.", + "type": "string" + } + ] + }, + { + "name": "targetCrashed", + "description": "Fired when debugging target has crashed" + }, + { + "name": "targetReloadedAfterCrash", + "description": "Fired when debugging target has reloaded after crash" + } + ] + }, + { + "domain": "LayerTree", + "experimental": true, + "dependencies": [ + "DOM" + ], + "types": [ + { + "id": "LayerId", + "description": "Unique Layer identifier.", + "type": "string" + }, + { + "id": "SnapshotId", + "description": "Unique snapshot identifier.", + "type": "string" + }, + { + "id": "ScrollRect", + "description": "Rectangle where scrolling happens on the main thread.", + "type": "object", + "properties": [ + { + "name": "rect", + "description": "Rectangle itself.", + "$ref": "DOM.Rect" + }, + { + "name": "type", + "description": "Reason for rectangle to force scrolling on the main thread", + "type": "string", + "enum": [ + "RepaintsOnScroll", + "TouchEventHandler", + "WheelEventHandler" + ] + } + ] + }, + { + "id": "StickyPositionConstraint", + "description": "Sticky position constraints.", + "type": "object", + "properties": [ + { + "name": "stickyBoxRect", + "description": "Layout rectangle of the sticky element before being shifted", + "$ref": "DOM.Rect" + }, + { + "name": "containingBlockRect", + "description": "Layout rectangle of the containing block of the sticky element", + "$ref": "DOM.Rect" + }, + { + "name": "nearestLayerShiftingStickyBox", + "description": "The nearest sticky layer that shifts the sticky box", + "optional": true, + "$ref": "LayerId" + }, + { + "name": "nearestLayerShiftingContainingBlock", + "description": "The nearest sticky layer that shifts the containing block", + "optional": true, + "$ref": "LayerId" + } + ] + }, + { + "id": "PictureTile", + "description": "Serialized fragment of layer picture along with its offset within the layer.", + "type": "object", + "properties": [ + { + "name": "x", + "description": "Offset from owning layer left boundary", + "type": "number" + }, + { + "name": "y", + "description": "Offset from owning layer top boundary", + "type": "number" + }, + { + "name": "picture", + "description": "Base64-encoded snapshot data. (Encoded as a base64 string when passed over JSON)", + "type": "string" + } + ] + }, + { + "id": "Layer", + "description": "Information about a compositing layer.", + "type": "object", + "properties": [ + { + "name": "layerId", + "description": "The unique id for this layer.", + "$ref": "LayerId" + }, + { + "name": "parentLayerId", + "description": "The id of parent (not present for root).", + "optional": true, + "$ref": "LayerId" + }, + { + "name": "backendNodeId", + "description": "The backend id for the node associated with this layer.", + "optional": true, + "$ref": "DOM.BackendNodeId" + }, + { + "name": "offsetX", + "description": "Offset from parent layer, X coordinate.", + "type": "number" + }, + { + "name": "offsetY", + "description": "Offset from parent layer, Y coordinate.", + "type": "number" + }, + { + "name": "width", + "description": "Layer width.", + "type": "number" + }, + { + "name": "height", + "description": "Layer height.", + "type": "number" + }, + { + "name": "transform", + "description": "Transformation matrix for layer, default is identity matrix", + "optional": true, + "type": "array", + "items": { + "type": "number" + } + }, + { + "name": "anchorX", + "description": "Transform anchor point X, absent if no transform specified", + "optional": true, + "type": "number" + }, + { + "name": "anchorY", + "description": "Transform anchor point Y, absent if no transform specified", + "optional": true, + "type": "number" + }, + { + "name": "anchorZ", + "description": "Transform anchor point Z, absent if no transform specified", + "optional": true, + "type": "number" + }, + { + "name": "paintCount", + "description": "Indicates how many time this layer has painted.", + "type": "integer" + }, + { + "name": "drawsContent", + "description": "Indicates whether this layer hosts any content, rather than being used for\ntransform/scrolling purposes only.", + "type": "boolean" + }, + { + "name": "invisible", + "description": "Set if layer is not visible.", + "optional": true, + "type": "boolean" + }, + { + "name": "scrollRects", + "description": "Rectangles scrolling on main thread only.", + "optional": true, + "type": "array", + "items": { + "$ref": "ScrollRect" + } + }, + { + "name": "stickyPositionConstraint", + "description": "Sticky position constraint information", + "optional": true, + "$ref": "StickyPositionConstraint" + } + ] + }, + { + "id": "PaintProfile", + "description": "Array of timings, one per paint step.", + "type": "array", + "items": { + "type": "number" + } + } + ], + "commands": [ + { + "name": "compositingReasons", + "description": "Provides the reasons why the given layer was composited.", + "parameters": [ + { + "name": "layerId", + "description": "The id of the layer for which we want to get the reasons it was composited.", + "$ref": "LayerId" + } + ], + "returns": [ + { + "name": "compositingReasons", + "description": "A list of strings specifying reasons for the given layer to become composited.", + "deprecated": true, + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "compositingReasonIds", + "description": "A list of strings specifying reason IDs for the given layer to become composited.", + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "name": "disable", + "description": "Disables compositing tree inspection." + }, + { + "name": "enable", + "description": "Enables compositing tree inspection." + }, + { + "name": "loadSnapshot", + "description": "Returns the snapshot identifier.", + "parameters": [ + { + "name": "tiles", + "description": "An array of tiles composing the snapshot.", + "type": "array", + "items": { + "$ref": "PictureTile" + } + } + ], + "returns": [ + { + "name": "snapshotId", + "description": "The id of the snapshot.", + "$ref": "SnapshotId" + } + ] + }, + { + "name": "makeSnapshot", + "description": "Returns the layer snapshot identifier.", + "parameters": [ + { + "name": "layerId", + "description": "The id of the layer.", + "$ref": "LayerId" + } + ], + "returns": [ + { + "name": "snapshotId", + "description": "The id of the layer snapshot.", + "$ref": "SnapshotId" + } + ] + }, + { + "name": "profileSnapshot", + "parameters": [ + { + "name": "snapshotId", + "description": "The id of the layer snapshot.", + "$ref": "SnapshotId" + }, + { + "name": "minRepeatCount", + "description": "The maximum number of times to replay the snapshot (1, if not specified).", + "optional": true, + "type": "integer" + }, + { + "name": "minDuration", + "description": "The minimum duration (in seconds) to replay the snapshot.", + "optional": true, + "type": "number" + }, + { + "name": "clipRect", + "description": "The clip rectangle to apply when replaying the snapshot.", + "optional": true, + "$ref": "DOM.Rect" + } + ], + "returns": [ + { + "name": "timings", + "description": "The array of paint profiles, one per run.", + "type": "array", + "items": { + "$ref": "PaintProfile" + } + } + ] + }, + { + "name": "releaseSnapshot", + "description": "Releases layer snapshot captured by the back-end.", + "parameters": [ + { + "name": "snapshotId", + "description": "The id of the layer snapshot.", + "$ref": "SnapshotId" + } + ] + }, + { + "name": "replaySnapshot", + "description": "Replays the layer snapshot and returns the resulting bitmap.", + "parameters": [ + { + "name": "snapshotId", + "description": "The id of the layer snapshot.", + "$ref": "SnapshotId" + }, + { + "name": "fromStep", + "description": "The first step to replay from (replay from the very start if not specified).", + "optional": true, + "type": "integer" + }, + { + "name": "toStep", + "description": "The last step to replay to (replay till the end if not specified).", + "optional": true, + "type": "integer" + }, + { + "name": "scale", + "description": "The scale to apply while replaying (defaults to 1).", + "optional": true, + "type": "number" + } + ], + "returns": [ + { + "name": "dataURL", + "description": "A data: URL for resulting image.", + "type": "string" + } + ] + }, + { + "name": "snapshotCommandLog", + "description": "Replays the layer snapshot and returns canvas log.", + "parameters": [ + { + "name": "snapshotId", + "description": "The id of the layer snapshot.", + "$ref": "SnapshotId" + } + ], + "returns": [ + { + "name": "commandLog", + "description": "The array of canvas function calls.", + "type": "array", + "items": { + "type": "object" + } + } + ] + } + ], + "events": [ + { + "name": "layerPainted", + "parameters": [ + { + "name": "layerId", + "description": "The id of the painted layer.", + "$ref": "LayerId" + }, + { + "name": "clip", + "description": "Clip rectangle.", + "$ref": "DOM.Rect" + } + ] + }, + { + "name": "layerTreeDidChange", + "parameters": [ + { + "name": "layers", + "description": "Layer tree, absent if not in the comspositing mode.", + "optional": true, + "type": "array", + "items": { + "$ref": "Layer" + } + } + ] + } + ] + }, + { + "domain": "Log", + "description": "Provides access to log entries.", + "dependencies": [ + "Runtime", + "Network" + ], + "types": [ + { + "id": "LogEntry", + "description": "Log entry.", + "type": "object", + "properties": [ + { + "name": "source", + "description": "Log entry source.", + "type": "string", + "enum": [ + "xml", + "javascript", + "network", + "storage", + "appcache", + "rendering", + "security", + "deprecation", + "worker", + "violation", + "intervention", + "recommendation", + "other" + ] + }, + { + "name": "level", + "description": "Log entry severity.", + "type": "string", + "enum": [ + "verbose", + "info", + "warning", + "error" + ] + }, + { + "name": "text", + "description": "Logged text.", + "type": "string" + }, + { + "name": "category", + "optional": true, + "type": "string", + "enum": [ + "cors" + ] + }, + { + "name": "timestamp", + "description": "Timestamp when this entry was added.", + "$ref": "Runtime.Timestamp" + }, + { + "name": "url", + "description": "URL of the resource if known.", + "optional": true, + "type": "string" + }, + { + "name": "lineNumber", + "description": "Line number in the resource.", + "optional": true, + "type": "integer" + }, + { + "name": "stackTrace", + "description": "JavaScript stack trace.", + "optional": true, + "$ref": "Runtime.StackTrace" + }, + { + "name": "networkRequestId", + "description": "Identifier of the network request associated with this entry.", + "optional": true, + "$ref": "Network.RequestId" + }, + { + "name": "workerId", + "description": "Identifier of the worker associated with this entry.", + "optional": true, + "type": "string" + }, + { + "name": "args", + "description": "Call arguments.", + "optional": true, + "type": "array", + "items": { + "$ref": "Runtime.RemoteObject" + } + } + ] + }, + { + "id": "ViolationSetting", + "description": "Violation configuration setting.", + "type": "object", + "properties": [ + { + "name": "name", + "description": "Violation type.", + "type": "string", + "enum": [ + "longTask", + "longLayout", + "blockedEvent", + "blockedParser", + "discouragedAPIUse", + "handler", + "recurringHandler" + ] + }, + { + "name": "threshold", + "description": "Time threshold to trigger upon.", + "type": "number" + } + ] + } + ], + "commands": [ + { + "name": "clear", + "description": "Clears the log." + }, + { + "name": "disable", + "description": "Disables log domain, prevents further log entries from being reported to the client." + }, + { + "name": "enable", + "description": "Enables log domain, sends the entries collected so far to the client by means of the\n`entryAdded` notification." + }, + { + "name": "startViolationsReport", + "description": "start violation reporting.", + "parameters": [ + { + "name": "config", + "description": "Configuration for violations.", + "type": "array", + "items": { + "$ref": "ViolationSetting" + } + } + ] + }, + { + "name": "stopViolationsReport", + "description": "Stop violation reporting." + } + ], + "events": [ + { + "name": "entryAdded", + "description": "Issued when new message was logged.", + "parameters": [ + { + "name": "entry", + "description": "The entry.", + "$ref": "LogEntry" + } + ] + } + ] + }, + { + "domain": "Memory", + "experimental": true, + "types": [ + { + "id": "PressureLevel", + "description": "Memory pressure level.", + "type": "string", + "enum": [ + "moderate", + "critical" + ] + }, + { + "id": "SamplingProfileNode", + "description": "Heap profile sample.", + "type": "object", + "properties": [ + { + "name": "size", + "description": "Size of the sampled allocation.", + "type": "number" + }, + { + "name": "total", + "description": "Total bytes attributed to this sample.", + "type": "number" + }, + { + "name": "stack", + "description": "Execution stack at the point of allocation.", + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "id": "SamplingProfile", + "description": "Array of heap profile samples.", + "type": "object", + "properties": [ + { + "name": "samples", + "type": "array", + "items": { + "$ref": "SamplingProfileNode" + } + }, + { + "name": "modules", + "type": "array", + "items": { + "$ref": "Module" + } + } + ] + }, + { + "id": "Module", + "description": "Executable module information", + "type": "object", + "properties": [ + { + "name": "name", + "description": "Name of the module.", + "type": "string" + }, + { + "name": "uuid", + "description": "UUID of the module.", + "type": "string" + }, + { + "name": "baseAddress", + "description": "Base address where the module is loaded into memory. Encoded as a decimal\nor hexadecimal (0x prefixed) string.", + "type": "string" + }, + { + "name": "size", + "description": "Size of the module in bytes.", + "type": "number" + } + ] + } + ], + "commands": [ + { + "name": "getDOMCounters", + "returns": [ + { + "name": "documents", + "type": "integer" + }, + { + "name": "nodes", + "type": "integer" + }, + { + "name": "jsEventListeners", + "type": "integer" + } + ] + }, + { + "name": "prepareForLeakDetection" + }, + { + "name": "forciblyPurgeJavaScriptMemory", + "description": "Simulate OomIntervention by purging V8 memory." + }, + { + "name": "setPressureNotificationsSuppressed", + "description": "Enable/disable suppressing memory pressure notifications in all processes.", + "parameters": [ + { + "name": "suppressed", + "description": "If true, memory pressure notifications will be suppressed.", + "type": "boolean" + } + ] + }, + { + "name": "simulatePressureNotification", + "description": "Simulate a memory pressure notification in all processes.", + "parameters": [ + { + "name": "level", + "description": "Memory pressure level of the notification.", + "$ref": "PressureLevel" + } + ] + }, + { + "name": "startSampling", + "description": "Start collecting native memory profile.", + "parameters": [ + { + "name": "samplingInterval", + "description": "Average number of bytes between samples.", + "optional": true, + "type": "integer" + }, + { + "name": "suppressRandomness", + "description": "Do not randomize intervals between samples.", + "optional": true, + "type": "boolean" + } + ] + }, + { + "name": "stopSampling", + "description": "Stop collecting native memory profile." + }, + { + "name": "getAllTimeSamplingProfile", + "description": "Retrieve native memory allocations profile\ncollected since renderer process startup.", + "returns": [ + { + "name": "profile", + "$ref": "SamplingProfile" + } + ] + }, + { + "name": "getBrowserSamplingProfile", + "description": "Retrieve native memory allocations profile\ncollected since browser process startup.", + "returns": [ + { + "name": "profile", + "$ref": "SamplingProfile" + } + ] + }, + { + "name": "getSamplingProfile", + "description": "Retrieve native memory allocations profile collected since last\n`startSampling` call.", + "returns": [ + { + "name": "profile", + "$ref": "SamplingProfile" + } + ] + } + ] + }, + { + "domain": "Network", + "description": "Network domain allows tracking network activities of the page. It exposes information about http,\nfile, data and other requests and responses, their headers, bodies, timing, etc.", + "dependencies": [ + "Debugger", + "Runtime", + "Security" + ], + "types": [ + { + "id": "ResourceType", + "description": "Resource type as it was perceived by the rendering engine.", + "type": "string", + "enum": [ + "Document", + "Stylesheet", + "Image", + "Media", + "Font", + "Script", + "TextTrack", + "XHR", + "Fetch", + "EventSource", + "WebSocket", + "Manifest", + "SignedExchange", + "Ping", + "CSPViolationReport", + "Preflight", + "Other" + ] + }, + { + "id": "LoaderId", + "description": "Unique loader identifier.", + "type": "string" + }, + { + "id": "RequestId", + "description": "Unique request identifier.", + "type": "string" + }, + { + "id": "InterceptionId", + "description": "Unique intercepted request identifier.", + "type": "string" + }, + { + "id": "ErrorReason", + "description": "Network level fetch failure reason.", + "type": "string", + "enum": [ + "Failed", + "Aborted", + "TimedOut", + "AccessDenied", + "ConnectionClosed", + "ConnectionReset", + "ConnectionRefused", + "ConnectionAborted", + "ConnectionFailed", + "NameNotResolved", + "InternetDisconnected", + "AddressUnreachable", + "BlockedByClient", + "BlockedByResponse" + ] + }, + { + "id": "TimeSinceEpoch", + "description": "UTC time in seconds, counted from January 1, 1970.", + "type": "number" + }, + { + "id": "MonotonicTime", + "description": "Monotonically increasing time in seconds since an arbitrary point in the past.", + "type": "number" + }, + { + "id": "Headers", + "description": "Request / response headers as keys / values of JSON object.", + "type": "object" + }, + { + "id": "ConnectionType", + "description": "The underlying connection technology that the browser is supposedly using.", + "type": "string", + "enum": [ + "none", + "cellular2g", + "cellular3g", + "cellular4g", + "bluetooth", + "ethernet", + "wifi", + "wimax", + "other" + ] + }, + { + "id": "CookieSameSite", + "description": "Represents the cookie's 'SameSite' status:\nhttps://tools.ietf.org/html/draft-west-first-party-cookies", + "type": "string", + "enum": [ + "Strict", + "Lax", + "None" + ] + }, + { + "id": "CookiePriority", + "description": "Represents the cookie's 'Priority' status:\nhttps://tools.ietf.org/html/draft-west-cookie-priority-00", + "experimental": true, + "type": "string", + "enum": [ + "Low", + "Medium", + "High" + ] + }, + { + "id": "CookieSourceScheme", + "description": "Represents the source scheme of the origin that originally set the cookie.\nA value of \"Unset\" allows protocol clients to emulate legacy cookie scope for the scheme.\nThis is a temporary ability and it will be removed in the future.", + "experimental": true, + "type": "string", + "enum": [ + "Unset", + "NonSecure", + "Secure" + ] + }, + { + "id": "ResourceTiming", + "description": "Timing information for the request.", + "type": "object", + "properties": [ + { + "name": "requestTime", + "description": "Timing's requestTime is a baseline in seconds, while the other numbers are ticks in\nmilliseconds relatively to this requestTime.", + "type": "number" + }, + { + "name": "proxyStart", + "description": "Started resolving proxy.", + "type": "number" + }, + { + "name": "proxyEnd", + "description": "Finished resolving proxy.", + "type": "number" + }, + { + "name": "dnsStart", + "description": "Started DNS address resolve.", + "type": "number" + }, + { + "name": "dnsEnd", + "description": "Finished DNS address resolve.", + "type": "number" + }, + { + "name": "connectStart", + "description": "Started connecting to the remote host.", + "type": "number" + }, + { + "name": "connectEnd", + "description": "Connected to the remote host.", + "type": "number" + }, + { + "name": "sslStart", + "description": "Started SSL handshake.", + "type": "number" + }, + { + "name": "sslEnd", + "description": "Finished SSL handshake.", + "type": "number" + }, + { + "name": "workerStart", + "description": "Started running ServiceWorker.", + "experimental": true, + "type": "number" + }, + { + "name": "workerReady", + "description": "Finished Starting ServiceWorker.", + "experimental": true, + "type": "number" + }, + { + "name": "workerFetchStart", + "description": "Started fetch event.", + "experimental": true, + "type": "number" + }, + { + "name": "workerRespondWithSettled", + "description": "Settled fetch event respondWith promise.", + "experimental": true, + "type": "number" + }, + { + "name": "sendStart", + "description": "Started sending request.", + "type": "number" + }, + { + "name": "sendEnd", + "description": "Finished sending request.", + "type": "number" + }, + { + "name": "pushStart", + "description": "Time the server started pushing request.", + "experimental": true, + "type": "number" + }, + { + "name": "pushEnd", + "description": "Time the server finished pushing request.", + "experimental": true, + "type": "number" + }, + { + "name": "receiveHeadersEnd", + "description": "Finished receiving response headers.", + "type": "number" + } + ] + }, + { + "id": "ResourcePriority", + "description": "Loading priority of a resource request.", + "type": "string", + "enum": [ + "VeryLow", + "Low", + "Medium", + "High", + "VeryHigh" + ] + }, + { + "id": "PostDataEntry", + "description": "Post data entry for HTTP request", + "type": "object", + "properties": [ + { + "name": "bytes", + "optional": true, + "type": "string" + } + ] + }, + { + "id": "Request", + "description": "HTTP request data.", + "type": "object", + "properties": [ + { + "name": "url", + "description": "Request URL (without fragment).", + "type": "string" + }, + { + "name": "urlFragment", + "description": "Fragment of the requested URL starting with hash, if present.", + "optional": true, + "type": "string" + }, + { + "name": "method", + "description": "HTTP request method.", + "type": "string" + }, + { + "name": "headers", + "description": "HTTP request headers.", + "$ref": "Headers" + }, + { + "name": "postData", + "description": "HTTP POST request data.", + "optional": true, + "type": "string" + }, + { + "name": "hasPostData", + "description": "True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long.", + "optional": true, + "type": "boolean" + }, + { + "name": "postDataEntries", + "description": "Request body elements. This will be converted from base64 to binary", + "experimental": true, + "optional": true, + "type": "array", + "items": { + "$ref": "PostDataEntry" + } + }, + { + "name": "mixedContentType", + "description": "The mixed content type of the request.", + "optional": true, + "$ref": "Security.MixedContentType" + }, + { + "name": "initialPriority", + "description": "Priority of the resource request at the time request is sent.", + "$ref": "ResourcePriority" + }, + { + "name": "referrerPolicy", + "description": "The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/", + "type": "string", + "enum": [ + "unsafe-url", + "no-referrer-when-downgrade", + "no-referrer", + "origin", + "origin-when-cross-origin", + "same-origin", + "strict-origin", + "strict-origin-when-cross-origin" + ] + }, + { + "name": "isLinkPreload", + "description": "Whether is loaded via link preload.", + "optional": true, + "type": "boolean" + }, + { + "name": "trustTokenParams", + "description": "Set for requests when the TrustToken API is used. Contains the parameters\npassed by the developer (e.g. via \"fetch\") as understood by the backend.", + "experimental": true, + "optional": true, + "$ref": "TrustTokenParams" + }, + { + "name": "isSameSite", + "description": "True if this resource request is considered to be the 'same site' as the\nrequest correspondinfg to the main frame.", + "experimental": true, + "optional": true, + "type": "boolean" + } + ] + }, + { + "id": "SignedCertificateTimestamp", + "description": "Details of a signed certificate timestamp (SCT).", + "type": "object", + "properties": [ + { + "name": "status", + "description": "Validation status.", + "type": "string" + }, + { + "name": "origin", + "description": "Origin.", + "type": "string" + }, + { + "name": "logDescription", + "description": "Log name / description.", + "type": "string" + }, + { + "name": "logId", + "description": "Log ID.", + "type": "string" + }, + { + "name": "timestamp", + "description": "Issuance date. Unlike TimeSinceEpoch, this contains the number of\nmilliseconds since January 1, 1970, UTC, not the number of seconds.", + "type": "number" + }, + { + "name": "hashAlgorithm", + "description": "Hash algorithm.", + "type": "string" + }, + { + "name": "signatureAlgorithm", + "description": "Signature algorithm.", + "type": "string" + }, + { + "name": "signatureData", + "description": "Signature data.", + "type": "string" + } + ] + }, + { + "id": "SecurityDetails", + "description": "Security details about a request.", + "type": "object", + "properties": [ + { + "name": "protocol", + "description": "Protocol name (e.g. \"TLS 1.2\" or \"QUIC\").", + "type": "string" + }, + { + "name": "keyExchange", + "description": "Key Exchange used by the connection, or the empty string if not applicable.", + "type": "string" + }, + { + "name": "keyExchangeGroup", + "description": "(EC)DH group used by the connection, if applicable.", + "optional": true, + "type": "string" + }, + { + "name": "cipher", + "description": "Cipher name.", + "type": "string" + }, + { + "name": "mac", + "description": "TLS MAC. Note that AEAD ciphers do not have separate MACs.", + "optional": true, + "type": "string" + }, + { + "name": "certificateId", + "description": "Certificate ID value.", + "$ref": "Security.CertificateId" + }, + { + "name": "subjectName", + "description": "Certificate subject name.", + "type": "string" + }, + { + "name": "sanList", + "description": "Subject Alternative Name (SAN) DNS names and IP addresses.", + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "issuer", + "description": "Name of the issuing CA.", + "type": "string" + }, + { + "name": "validFrom", + "description": "Certificate valid from date.", + "$ref": "TimeSinceEpoch" + }, + { + "name": "validTo", + "description": "Certificate valid to (expiration) date", + "$ref": "TimeSinceEpoch" + }, + { + "name": "signedCertificateTimestampList", + "description": "List of signed certificate timestamps (SCTs).", + "type": "array", + "items": { + "$ref": "SignedCertificateTimestamp" + } + }, + { + "name": "certificateTransparencyCompliance", + "description": "Whether the request complied with Certificate Transparency policy", + "$ref": "CertificateTransparencyCompliance" + } + ] + }, + { + "id": "CertificateTransparencyCompliance", + "description": "Whether the request complied with Certificate Transparency policy.", + "type": "string", + "enum": [ + "unknown", + "not-compliant", + "compliant" + ] + }, + { + "id": "BlockedReason", + "description": "The reason why request was blocked.", + "type": "string", + "enum": [ + "other", + "csp", + "mixed-content", + "origin", + "inspector", + "subresource-filter", + "content-type", + "coep-frame-resource-needs-coep-header", + "coop-sandboxed-iframe-cannot-navigate-to-coop-page", + "corp-not-same-origin", + "corp-not-same-origin-after-defaulted-to-same-origin-by-coep", + "corp-not-same-site" + ] + }, + { + "id": "CorsError", + "description": "The reason why request was blocked.", + "type": "string", + "enum": [ + "DisallowedByMode", + "InvalidResponse", + "WildcardOriginNotAllowed", + "MissingAllowOriginHeader", + "MultipleAllowOriginValues", + "InvalidAllowOriginValue", + "AllowOriginMismatch", + "InvalidAllowCredentials", + "CorsDisabledScheme", + "PreflightInvalidStatus", + "PreflightDisallowedRedirect", + "PreflightWildcardOriginNotAllowed", + "PreflightMissingAllowOriginHeader", + "PreflightMultipleAllowOriginValues", + "PreflightInvalidAllowOriginValue", + "PreflightAllowOriginMismatch", + "PreflightInvalidAllowCredentials", + "PreflightMissingAllowExternal", + "PreflightInvalidAllowExternal", + "PreflightMissingAllowPrivateNetwork", + "PreflightInvalidAllowPrivateNetwork", + "InvalidAllowMethodsPreflightResponse", + "InvalidAllowHeadersPreflightResponse", + "MethodDisallowedByPreflightResponse", + "HeaderDisallowedByPreflightResponse", + "RedirectContainsCredentials", + "InsecurePrivateNetwork", + "InvalidPrivateNetworkAccess", + "UnexpectedPrivateNetworkAccess", + "NoCorsRedirectModeNotFollow" + ] + }, + { + "id": "CorsErrorStatus", + "type": "object", + "properties": [ + { + "name": "corsError", + "$ref": "CorsError" + }, + { + "name": "failedParameter", + "type": "string" + } + ] + }, + { + "id": "ServiceWorkerResponseSource", + "description": "Source of serviceworker response.", + "type": "string", + "enum": [ + "cache-storage", + "http-cache", + "fallback-code", + "network" + ] + }, + { + "id": "TrustTokenParams", + "description": "Determines what type of Trust Token operation is executed and\ndepending on the type, some additional parameters. The values\nare specified in third_party/blink/renderer/core/fetch/trust_token.idl.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "type", + "$ref": "TrustTokenOperationType" + }, + { + "name": "refreshPolicy", + "description": "Only set for \"token-redemption\" type and determine whether\nto request a fresh SRR or use a still valid cached SRR.", + "type": "string", + "enum": [ + "UseCached", + "Refresh" + ] + }, + { + "name": "issuers", + "description": "Origins of issuers from whom to request tokens or redemption\nrecords.", + "optional": true, + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "id": "TrustTokenOperationType", + "experimental": true, + "type": "string", + "enum": [ + "Issuance", + "Redemption", + "Signing" + ] + }, + { + "id": "Response", + "description": "HTTP response data.", + "type": "object", + "properties": [ + { + "name": "url", + "description": "Response URL. This URL can be different from CachedResource.url in case of redirect.", + "type": "string" + }, + { + "name": "status", + "description": "HTTP response status code.", + "type": "integer" + }, + { + "name": "statusText", + "description": "HTTP response status text.", + "type": "string" + }, + { + "name": "headers", + "description": "HTTP response headers.", + "$ref": "Headers" + }, + { + "name": "headersText", + "description": "HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo.", + "deprecated": true, + "optional": true, + "type": "string" + }, + { + "name": "mimeType", + "description": "Resource mimeType as determined by the browser.", + "type": "string" + }, + { + "name": "requestHeaders", + "description": "Refined HTTP request headers that were actually transmitted over the network.", + "optional": true, + "$ref": "Headers" + }, + { + "name": "requestHeadersText", + "description": "HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo.", + "deprecated": true, + "optional": true, + "type": "string" + }, + { + "name": "connectionReused", + "description": "Specifies whether physical connection was actually reused for this request.", + "type": "boolean" + }, + { + "name": "connectionId", + "description": "Physical connection id that was actually used for this request.", + "type": "number" + }, + { + "name": "remoteIPAddress", + "description": "Remote IP address.", + "optional": true, + "type": "string" + }, + { + "name": "remotePort", + "description": "Remote port.", + "optional": true, + "type": "integer" + }, + { + "name": "fromDiskCache", + "description": "Specifies that the request was served from the disk cache.", + "optional": true, + "type": "boolean" + }, + { + "name": "fromServiceWorker", + "description": "Specifies that the request was served from the ServiceWorker.", + "optional": true, + "type": "boolean" + }, + { + "name": "fromPrefetchCache", + "description": "Specifies that the request was served from the prefetch cache.", + "optional": true, + "type": "boolean" + }, + { + "name": "encodedDataLength", + "description": "Total number of bytes received for this request so far.", + "type": "number" + }, + { + "name": "timing", + "description": "Timing information for the given request.", + "optional": true, + "$ref": "ResourceTiming" + }, + { + "name": "serviceWorkerResponseSource", + "description": "Response source of response from ServiceWorker.", + "optional": true, + "$ref": "ServiceWorkerResponseSource" + }, + { + "name": "responseTime", + "description": "The time at which the returned response was generated.", + "optional": true, + "$ref": "TimeSinceEpoch" + }, + { + "name": "cacheStorageCacheName", + "description": "Cache Storage Cache Name.", + "optional": true, + "type": "string" + }, + { + "name": "protocol", + "description": "Protocol used to fetch this request.", + "optional": true, + "type": "string" + }, + { + "name": "securityState", + "description": "Security state of the request resource.", + "$ref": "Security.SecurityState" + }, + { + "name": "securityDetails", + "description": "Security details for the request.", + "optional": true, + "$ref": "SecurityDetails" + } + ] + }, + { + "id": "WebSocketRequest", + "description": "WebSocket request data.", + "type": "object", + "properties": [ + { + "name": "headers", + "description": "HTTP request headers.", + "$ref": "Headers" + } + ] + }, + { + "id": "WebSocketResponse", + "description": "WebSocket response data.", + "type": "object", + "properties": [ + { + "name": "status", + "description": "HTTP response status code.", + "type": "integer" + }, + { + "name": "statusText", + "description": "HTTP response status text.", + "type": "string" + }, + { + "name": "headers", + "description": "HTTP response headers.", + "$ref": "Headers" + }, + { + "name": "headersText", + "description": "HTTP response headers text.", + "optional": true, + "type": "string" + }, + { + "name": "requestHeaders", + "description": "HTTP request headers.", + "optional": true, + "$ref": "Headers" + }, + { + "name": "requestHeadersText", + "description": "HTTP request headers text.", + "optional": true, + "type": "string" + } + ] + }, + { + "id": "WebSocketFrame", + "description": "WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests.", + "type": "object", + "properties": [ + { + "name": "opcode", + "description": "WebSocket message opcode.", + "type": "number" + }, + { + "name": "mask", + "description": "WebSocket message mask.", + "type": "boolean" + }, + { + "name": "payloadData", + "description": "WebSocket message payload data.\nIf the opcode is 1, this is a text message and payloadData is a UTF-8 string.\nIf the opcode isn't 1, then payloadData is a base64 encoded string representing binary data.", + "type": "string" + } + ] + }, + { + "id": "CachedResource", + "description": "Information about the cached resource.", + "type": "object", + "properties": [ + { + "name": "url", + "description": "Resource URL. This is the url of the original network request.", + "type": "string" + }, + { + "name": "type", + "description": "Type of this resource.", + "$ref": "ResourceType" + }, + { + "name": "response", + "description": "Cached response data.", + "optional": true, + "$ref": "Response" + }, + { + "name": "bodySize", + "description": "Cached response body size.", + "type": "number" + } + ] + }, + { + "id": "Initiator", + "description": "Information about the request initiator.", + "type": "object", + "properties": [ + { + "name": "type", + "description": "Type of this initiator.", + "type": "string", + "enum": [ + "parser", + "script", + "preload", + "SignedExchange", + "preflight", + "other" + ] + }, + { + "name": "stack", + "description": "Initiator JavaScript stack trace, set for Script only.", + "optional": true, + "$ref": "Runtime.StackTrace" + }, + { + "name": "url", + "description": "Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type.", + "optional": true, + "type": "string" + }, + { + "name": "lineNumber", + "description": "Initiator line number, set for Parser type or for Script type (when script is importing\nmodule) (0-based).", + "optional": true, + "type": "number" + }, + { + "name": "columnNumber", + "description": "Initiator column number, set for Parser type or for Script type (when script is importing\nmodule) (0-based).", + "optional": true, + "type": "number" + }, + { + "name": "requestId", + "description": "Set if another request triggered this request (e.g. preflight).", + "optional": true, + "$ref": "RequestId" + } + ] + }, + { + "id": "Cookie", + "description": "Cookie object", + "type": "object", + "properties": [ + { + "name": "name", + "description": "Cookie name.", + "type": "string" + }, + { + "name": "value", + "description": "Cookie value.", + "type": "string" + }, + { + "name": "domain", + "description": "Cookie domain.", + "type": "string" + }, + { + "name": "path", + "description": "Cookie path.", + "type": "string" + }, + { + "name": "expires", + "description": "Cookie expiration date as the number of seconds since the UNIX epoch.", + "type": "number" + }, + { + "name": "size", + "description": "Cookie size.", + "type": "integer" + }, + { + "name": "httpOnly", + "description": "True if cookie is http-only.", + "type": "boolean" + }, + { + "name": "secure", + "description": "True if cookie is secure.", + "type": "boolean" + }, + { + "name": "session", + "description": "True in case of session cookie.", + "type": "boolean" + }, + { + "name": "sameSite", + "description": "Cookie SameSite type.", + "optional": true, + "$ref": "CookieSameSite" + }, + { + "name": "priority", + "description": "Cookie Priority", + "experimental": true, + "$ref": "CookiePriority" + }, + { + "name": "sameParty", + "description": "True if cookie is SameParty.", + "experimental": true, + "type": "boolean" + }, + { + "name": "sourceScheme", + "description": "Cookie source scheme type.", + "experimental": true, + "$ref": "CookieSourceScheme" + }, + { + "name": "sourcePort", + "description": "Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port.\nAn unspecified port value allows protocol clients to emulate legacy cookie scope for the port.\nThis is a temporary ability and it will be removed in the future.", + "experimental": true, + "type": "integer" + }, + { + "name": "partitionKey", + "description": "Cookie partition key. The site of the top-level URL the browser was visiting at the start\nof the request to the endpoint that set the cookie.", + "experimental": true, + "optional": true, + "type": "string" + }, + { + "name": "partitionKeyOpaque", + "description": "True if cookie partition key is opaque.", + "experimental": true, + "optional": true, + "type": "boolean" + } + ] + }, + { + "id": "SetCookieBlockedReason", + "description": "Types of reasons why a cookie may not be stored from a response.", + "experimental": true, + "type": "string", + "enum": [ + "SecureOnly", + "SameSiteStrict", + "SameSiteLax", + "SameSiteUnspecifiedTreatedAsLax", + "SameSiteNoneInsecure", + "UserPreferences", + "SyntaxError", + "SchemeNotSupported", + "OverwriteSecure", + "InvalidDomain", + "InvalidPrefix", + "UnknownError", + "SchemefulSameSiteStrict", + "SchemefulSameSiteLax", + "SchemefulSameSiteUnspecifiedTreatedAsLax", + "SamePartyFromCrossPartyContext", + "SamePartyConflictsWithOtherAttributes", + "NameValuePairExceedsMaxSize" + ] + }, + { + "id": "CookieBlockedReason", + "description": "Types of reasons why a cookie may not be sent with a request.", + "experimental": true, + "type": "string", + "enum": [ + "SecureOnly", + "NotOnPath", + "DomainMismatch", + "SameSiteStrict", + "SameSiteLax", + "SameSiteUnspecifiedTreatedAsLax", + "SameSiteNoneInsecure", + "UserPreferences", + "UnknownError", + "SchemefulSameSiteStrict", + "SchemefulSameSiteLax", + "SchemefulSameSiteUnspecifiedTreatedAsLax", + "SamePartyFromCrossPartyContext", + "NameValuePairExceedsMaxSize" + ] + }, + { + "id": "BlockedSetCookieWithReason", + "description": "A cookie which was not stored from a response with the corresponding reason.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "blockedReasons", + "description": "The reason(s) this cookie was blocked.", + "type": "array", + "items": { + "$ref": "SetCookieBlockedReason" + } + }, + { + "name": "cookieLine", + "description": "The string representing this individual cookie as it would appear in the header.\nThis is not the entire \"cookie\" or \"set-cookie\" header which could have multiple cookies.", + "type": "string" + }, + { + "name": "cookie", + "description": "The cookie object which represents the cookie which was not stored. It is optional because\nsometimes complete cookie information is not available, such as in the case of parsing\nerrors.", + "optional": true, + "$ref": "Cookie" + } + ] + }, + { + "id": "BlockedCookieWithReason", + "description": "A cookie with was not sent with a request with the corresponding reason.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "blockedReasons", + "description": "The reason(s) the cookie was blocked.", + "type": "array", + "items": { + "$ref": "CookieBlockedReason" + } + }, + { + "name": "cookie", + "description": "The cookie object representing the cookie which was not sent.", + "$ref": "Cookie" + } + ] + }, + { + "id": "CookieParam", + "description": "Cookie parameter object", + "type": "object", + "properties": [ + { + "name": "name", + "description": "Cookie name.", + "type": "string" + }, + { + "name": "value", + "description": "Cookie value.", + "type": "string" + }, + { + "name": "url", + "description": "The request-URI to associate with the setting of the cookie. This value can affect the\ndefault domain, path, source port, and source scheme values of the created cookie.", + "optional": true, + "type": "string" + }, + { + "name": "domain", + "description": "Cookie domain.", + "optional": true, + "type": "string" + }, + { + "name": "path", + "description": "Cookie path.", + "optional": true, + "type": "string" + }, + { + "name": "secure", + "description": "True if cookie is secure.", + "optional": true, + "type": "boolean" + }, + { + "name": "httpOnly", + "description": "True if cookie is http-only.", + "optional": true, + "type": "boolean" + }, + { + "name": "sameSite", + "description": "Cookie SameSite type.", + "optional": true, + "$ref": "CookieSameSite" + }, + { + "name": "expires", + "description": "Cookie expiration date, session cookie if not set", + "optional": true, + "$ref": "TimeSinceEpoch" + }, + { + "name": "priority", + "description": "Cookie Priority.", + "experimental": true, + "optional": true, + "$ref": "CookiePriority" + }, + { + "name": "sameParty", + "description": "True if cookie is SameParty.", + "experimental": true, + "optional": true, + "type": "boolean" + }, + { + "name": "sourceScheme", + "description": "Cookie source scheme type.", + "experimental": true, + "optional": true, + "$ref": "CookieSourceScheme" + }, + { + "name": "sourcePort", + "description": "Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port.\nAn unspecified port value allows protocol clients to emulate legacy cookie scope for the port.\nThis is a temporary ability and it will be removed in the future.", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "partitionKey", + "description": "Cookie partition key. The site of the top-level URL the browser was visiting at the start\nof the request to the endpoint that set the cookie.\nIf not set, the cookie will be set as not partitioned.", + "experimental": true, + "optional": true, + "type": "string" + } + ] + }, + { + "id": "AuthChallenge", + "description": "Authorization challenge for HTTP status code 401 or 407.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "source", + "description": "Source of the authentication challenge.", + "optional": true, + "type": "string", + "enum": [ + "Server", + "Proxy" + ] + }, + { + "name": "origin", + "description": "Origin of the challenger.", + "type": "string" + }, + { + "name": "scheme", + "description": "The authentication scheme used, such as basic or digest", + "type": "string" + }, + { + "name": "realm", + "description": "The realm of the challenge. May be empty.", + "type": "string" + } + ] + }, + { + "id": "AuthChallengeResponse", + "description": "Response to an AuthChallenge.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "response", + "description": "The decision on what to do in response to the authorization challenge. Default means\ndeferring to the default behavior of the net stack, which will likely either the Cancel\nauthentication or display a popup dialog box.", + "type": "string", + "enum": [ + "Default", + "CancelAuth", + "ProvideCredentials" + ] + }, + { + "name": "username", + "description": "The username to provide, possibly empty. Should only be set if response is\nProvideCredentials.", + "optional": true, + "type": "string" + }, + { + "name": "password", + "description": "The password to provide, possibly empty. Should only be set if response is\nProvideCredentials.", + "optional": true, + "type": "string" + } + ] + }, + { + "id": "InterceptionStage", + "description": "Stages of the interception to begin intercepting. Request will intercept before the request is\nsent. Response will intercept after the response is received.", + "experimental": true, + "type": "string", + "enum": [ + "Request", + "HeadersReceived" + ] + }, + { + "id": "RequestPattern", + "description": "Request pattern for interception.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "urlPattern", + "description": "Wildcards (`'*'` -> zero or more, `'?'` -> exactly one) are allowed. Escape character is\nbackslash. Omitting is equivalent to `\"*\"`.", + "optional": true, + "type": "string" + }, + { + "name": "resourceType", + "description": "If set, only requests for matching resource types will be intercepted.", + "optional": true, + "$ref": "ResourceType" + }, + { + "name": "interceptionStage", + "description": "Stage at which to begin intercepting requests. Default is Request.", + "optional": true, + "$ref": "InterceptionStage" + } + ] + }, + { + "id": "SignedExchangeSignature", + "description": "Information about a signed exchange signature.\nhttps://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "label", + "description": "Signed exchange signature label.", + "type": "string" + }, + { + "name": "signature", + "description": "The hex string of signed exchange signature.", + "type": "string" + }, + { + "name": "integrity", + "description": "Signed exchange signature integrity.", + "type": "string" + }, + { + "name": "certUrl", + "description": "Signed exchange signature cert Url.", + "optional": true, + "type": "string" + }, + { + "name": "certSha256", + "description": "The hex string of signed exchange signature cert sha256.", + "optional": true, + "type": "string" + }, + { + "name": "validityUrl", + "description": "Signed exchange signature validity Url.", + "type": "string" + }, + { + "name": "date", + "description": "Signed exchange signature date.", + "type": "integer" + }, + { + "name": "expires", + "description": "Signed exchange signature expires.", + "type": "integer" + }, + { + "name": "certificates", + "description": "The encoded certificates.", + "optional": true, + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "id": "SignedExchangeHeader", + "description": "Information about a signed exchange header.\nhttps://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "requestUrl", + "description": "Signed exchange request URL.", + "type": "string" + }, + { + "name": "responseCode", + "description": "Signed exchange response code.", + "type": "integer" + }, + { + "name": "responseHeaders", + "description": "Signed exchange response headers.", + "$ref": "Headers" + }, + { + "name": "signatures", + "description": "Signed exchange response signature.", + "type": "array", + "items": { + "$ref": "SignedExchangeSignature" + } + }, + { + "name": "headerIntegrity", + "description": "Signed exchange header integrity hash in the form of \"sha256-\".", + "type": "string" + } + ] + }, + { + "id": "SignedExchangeErrorField", + "description": "Field type for a signed exchange related error.", + "experimental": true, + "type": "string", + "enum": [ + "signatureSig", + "signatureIntegrity", + "signatureCertUrl", + "signatureCertSha256", + "signatureValidityUrl", + "signatureTimestamps" + ] + }, + { + "id": "SignedExchangeError", + "description": "Information about a signed exchange response.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "message", + "description": "Error message.", + "type": "string" + }, + { + "name": "signatureIndex", + "description": "The index of the signature which caused the error.", + "optional": true, + "type": "integer" + }, + { + "name": "errorField", + "description": "The field which caused the error.", + "optional": true, + "$ref": "SignedExchangeErrorField" + } + ] + }, + { + "id": "SignedExchangeInfo", + "description": "Information about a signed exchange response.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "outerResponse", + "description": "The outer response of signed HTTP exchange which was received from network.", + "$ref": "Response" + }, + { + "name": "header", + "description": "Information about the signed exchange header.", + "optional": true, + "$ref": "SignedExchangeHeader" + }, + { + "name": "securityDetails", + "description": "Security details for the signed exchange header.", + "optional": true, + "$ref": "SecurityDetails" + }, + { + "name": "errors", + "description": "Errors occurred while handling the signed exchagne.", + "optional": true, + "type": "array", + "items": { + "$ref": "SignedExchangeError" + } + } + ] + }, + { + "id": "ContentEncoding", + "description": "List of content encodings supported by the backend.", + "experimental": true, + "type": "string", + "enum": [ + "deflate", + "gzip", + "br" + ] + }, + { + "id": "PrivateNetworkRequestPolicy", + "experimental": true, + "type": "string", + "enum": [ + "Allow", + "BlockFromInsecureToMorePrivate", + "WarnFromInsecureToMorePrivate", + "PreflightBlock", + "PreflightWarn" + ] + }, + { + "id": "IPAddressSpace", + "experimental": true, + "type": "string", + "enum": [ + "Local", + "Private", + "Public", + "Unknown" + ] + }, + { + "id": "ConnectTiming", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "requestTime", + "description": "Timing's requestTime is a baseline in seconds, while the other numbers are ticks in\nmilliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for\nthe same request (but not for redirected requests).", + "type": "number" + } + ] + }, + { + "id": "ClientSecurityState", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "initiatorIsSecureContext", + "type": "boolean" + }, + { + "name": "initiatorIPAddressSpace", + "$ref": "IPAddressSpace" + }, + { + "name": "privateNetworkRequestPolicy", + "$ref": "PrivateNetworkRequestPolicy" + } + ] + }, + { + "id": "CrossOriginOpenerPolicyValue", + "experimental": true, + "type": "string", + "enum": [ + "SameOrigin", + "SameOriginAllowPopups", + "UnsafeNone", + "SameOriginPlusCoep" + ] + }, + { + "id": "CrossOriginOpenerPolicyStatus", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "value", + "$ref": "CrossOriginOpenerPolicyValue" + }, + { + "name": "reportOnlyValue", + "$ref": "CrossOriginOpenerPolicyValue" + }, + { + "name": "reportingEndpoint", + "optional": true, + "type": "string" + }, + { + "name": "reportOnlyReportingEndpoint", + "optional": true, + "type": "string" + } + ] + }, + { + "id": "CrossOriginEmbedderPolicyValue", + "experimental": true, + "type": "string", + "enum": [ + "None", + "Credentialless", + "RequireCorp" + ] + }, + { + "id": "CrossOriginEmbedderPolicyStatus", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "value", + "$ref": "CrossOriginEmbedderPolicyValue" + }, + { + "name": "reportOnlyValue", + "$ref": "CrossOriginEmbedderPolicyValue" + }, + { + "name": "reportingEndpoint", + "optional": true, + "type": "string" + }, + { + "name": "reportOnlyReportingEndpoint", + "optional": true, + "type": "string" + } + ] + }, + { + "id": "SecurityIsolationStatus", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "coop", + "optional": true, + "$ref": "CrossOriginOpenerPolicyStatus" + }, + { + "name": "coep", + "optional": true, + "$ref": "CrossOriginEmbedderPolicyStatus" + } + ] + }, + { + "id": "ReportStatus", + "description": "The status of a Reporting API report.", + "experimental": true, + "type": "string", + "enum": [ + "Queued", + "Pending", + "MarkedForRemoval", + "Success" + ] + }, + { + "id": "ReportId", + "experimental": true, + "type": "string" + }, + { + "id": "ReportingApiReport", + "description": "An object representing a report generated by the Reporting API.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "id", + "$ref": "ReportId" + }, + { + "name": "initiatorUrl", + "description": "The URL of the document that triggered the report.", + "type": "string" + }, + { + "name": "destination", + "description": "The name of the endpoint group that should be used to deliver the report.", + "type": "string" + }, + { + "name": "type", + "description": "The type of the report (specifies the set of data that is contained in the report body).", + "type": "string" + }, + { + "name": "timestamp", + "description": "When the report was generated.", + "$ref": "Network.TimeSinceEpoch" + }, + { + "name": "depth", + "description": "How many uploads deep the related request was.", + "type": "integer" + }, + { + "name": "completedAttempts", + "description": "The number of delivery attempts made so far, not including an active attempt.", + "type": "integer" + }, + { + "name": "body", + "type": "object" + }, + { + "name": "status", + "$ref": "ReportStatus" + } + ] + }, + { + "id": "ReportingApiEndpoint", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "url", + "description": "The URL of the endpoint to which reports may be delivered.", + "type": "string" + }, + { + "name": "groupName", + "description": "Name of the endpoint group.", + "type": "string" + } + ] + }, + { + "id": "LoadNetworkResourcePageResult", + "description": "An object providing the result of a network resource load.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "success", + "type": "boolean" + }, + { + "name": "netError", + "description": "Optional values used for error reporting.", + "optional": true, + "type": "number" + }, + { + "name": "netErrorName", + "optional": true, + "type": "string" + }, + { + "name": "httpStatusCode", + "optional": true, + "type": "number" + }, + { + "name": "stream", + "description": "If successful, one of the following two fields holds the result.", + "optional": true, + "$ref": "IO.StreamHandle" + }, + { + "name": "headers", + "description": "Response headers.", + "optional": true, + "$ref": "Network.Headers" + } + ] + }, + { + "id": "LoadNetworkResourceOptions", + "description": "An options object that may be extended later to better support CORS,\nCORB and streaming.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "disableCache", + "type": "boolean" + }, + { + "name": "includeCredentials", + "type": "boolean" + } + ] + } + ], + "commands": [ + { + "name": "setAcceptedEncodings", + "description": "Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.", + "experimental": true, + "parameters": [ + { + "name": "encodings", + "description": "List of accepted content encodings.", + "type": "array", + "items": { + "$ref": "ContentEncoding" + } + } + ] + }, + { + "name": "clearAcceptedEncodingsOverride", + "description": "Clears accepted encodings set by setAcceptedEncodings", + "experimental": true + }, + { + "name": "canClearBrowserCache", + "description": "Tells whether clearing browser cache is supported.", + "deprecated": true, + "returns": [ + { + "name": "result", + "description": "True if browser cache can be cleared.", + "type": "boolean" + } + ] + }, + { + "name": "canClearBrowserCookies", + "description": "Tells whether clearing browser cookies is supported.", + "deprecated": true, + "returns": [ + { + "name": "result", + "description": "True if browser cookies can be cleared.", + "type": "boolean" + } + ] + }, + { + "name": "canEmulateNetworkConditions", + "description": "Tells whether emulation of network conditions is supported.", + "deprecated": true, + "returns": [ + { + "name": "result", + "description": "True if emulation of network conditions is supported.", + "type": "boolean" + } + ] + }, + { + "name": "clearBrowserCache", + "description": "Clears browser cache." + }, + { + "name": "clearBrowserCookies", + "description": "Clears browser cookies." + }, + { + "name": "continueInterceptedRequest", + "description": "Response to Network.requestIntercepted which either modifies the request to continue with any\nmodifications, or blocks it, or completes it with the provided response bytes. If a network\nfetch occurs as a result which encounters a redirect an additional Network.requestIntercepted\nevent will be sent with the same InterceptionId.\nDeprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead.", + "experimental": true, + "deprecated": true, + "parameters": [ + { + "name": "interceptionId", + "$ref": "InterceptionId" + }, + { + "name": "errorReason", + "description": "If set this causes the request to fail with the given reason. Passing `Aborted` for requests\nmarked with `isNavigationRequest` also cancels the navigation. Must not be set in response\nto an authChallenge.", + "optional": true, + "$ref": "ErrorReason" + }, + { + "name": "rawResponse", + "description": "If set the requests completes using with the provided base64 encoded raw response, including\nHTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" + }, + { + "name": "url", + "description": "If set the request url will be modified in a way that's not observable by page. Must not be\nset in response to an authChallenge.", + "optional": true, + "type": "string" + }, + { + "name": "method", + "description": "If set this allows the request method to be overridden. Must not be set in response to an\nauthChallenge.", + "optional": true, + "type": "string" + }, + { + "name": "postData", + "description": "If set this allows postData to be set. Must not be set in response to an authChallenge.", + "optional": true, + "type": "string" + }, + { + "name": "headers", + "description": "If set this allows the request headers to be changed. Must not be set in response to an\nauthChallenge.", + "optional": true, + "$ref": "Headers" + }, + { + "name": "authChallengeResponse", + "description": "Response to a requestIntercepted with an authChallenge. Must not be set otherwise.", + "optional": true, + "$ref": "AuthChallengeResponse" + } + ] + }, + { + "name": "deleteCookies", + "description": "Deletes browser cookies with matching name and url or domain/path pair.", + "parameters": [ + { + "name": "name", + "description": "Name of the cookies to remove.", + "type": "string" + }, + { + "name": "url", + "description": "If specified, deletes all the cookies with the given name where domain and path match\nprovided URL.", + "optional": true, + "type": "string" + }, + { + "name": "domain", + "description": "If specified, deletes only cookies with the exact domain.", + "optional": true, + "type": "string" + }, + { + "name": "path", + "description": "If specified, deletes only cookies with the exact path.", + "optional": true, + "type": "string" + } + ] + }, + { + "name": "disable", + "description": "Disables network tracking, prevents network events from being sent to the client." + }, + { + "name": "emulateNetworkConditions", + "description": "Activates emulation of network conditions.", + "parameters": [ + { + "name": "offline", + "description": "True to emulate internet disconnection.", + "type": "boolean" + }, + { + "name": "latency", + "description": "Minimum latency from request sent to response headers received (ms).", + "type": "number" + }, + { + "name": "downloadThroughput", + "description": "Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.", + "type": "number" + }, + { + "name": "uploadThroughput", + "description": "Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.", + "type": "number" + }, + { + "name": "connectionType", + "description": "Connection type if known.", + "optional": true, + "$ref": "ConnectionType" + } + ] + }, + { + "name": "enable", + "description": "Enables network tracking, network events will now be delivered to the client.", + "parameters": [ + { + "name": "maxTotalBufferSize", + "description": "Buffer size in bytes to use when preserving network payloads (XHRs, etc).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "maxResourceBufferSize", + "description": "Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "maxPostDataSize", + "description": "Longest post body size (in bytes) that would be included in requestWillBeSent notification", + "optional": true, + "type": "integer" + } + ] + }, + { + "name": "getAllCookies", + "description": "Returns all browser cookies. Depending on the backend support, will return detailed cookie\ninformation in the `cookies` field.", + "returns": [ + { + "name": "cookies", + "description": "Array of cookie objects.", + "type": "array", + "items": { + "$ref": "Cookie" + } + } + ] + }, + { + "name": "getCertificate", + "description": "Returns the DER-encoded certificate.", + "experimental": true, + "parameters": [ + { + "name": "origin", + "description": "Origin to get certificate for.", + "type": "string" + } + ], + "returns": [ + { + "name": "tableNames", + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "name": "getCookies", + "description": "Returns all browser cookies for the current URL. Depending on the backend support, will return\ndetailed cookie information in the `cookies` field.", + "parameters": [ + { + "name": "urls", + "description": "The list of URLs for which applicable cookies will be fetched.\nIf not specified, it's assumed to be set to the list containing\nthe URLs of the page and all of its subframes.", + "optional": true, + "type": "array", + "items": { + "type": "string" + } + } + ], + "returns": [ + { + "name": "cookies", + "description": "Array of cookie objects.", + "type": "array", + "items": { + "$ref": "Cookie" + } + } + ] + }, + { + "name": "getResponseBody", + "description": "Returns content served for the given request.", + "parameters": [ + { + "name": "requestId", + "description": "Identifier of the network request to get content for.", + "$ref": "RequestId" + } + ], + "returns": [ + { + "name": "body", + "description": "Response body.", + "type": "string" + }, + { + "name": "base64Encoded", + "description": "True, if content was sent as base64.", + "type": "boolean" + } + ] + }, + { + "name": "getRequestPostData", + "description": "Returns post data sent with the request. Returns an error when no data was sent with the request.", + "parameters": [ + { + "name": "requestId", + "description": "Identifier of the network request to get content for.", + "$ref": "RequestId" + } + ], + "returns": [ + { + "name": "postData", + "description": "Request body string, omitting files from multipart requests", + "type": "string" + } + ] + }, + { + "name": "getResponseBodyForInterception", + "description": "Returns content served for the given currently intercepted request.", + "experimental": true, + "parameters": [ + { + "name": "interceptionId", + "description": "Identifier for the intercepted request to get body for.", + "$ref": "InterceptionId" + } + ], + "returns": [ + { + "name": "body", + "description": "Response body.", + "type": "string" + }, + { + "name": "base64Encoded", + "description": "True, if content was sent as base64.", + "type": "boolean" + } + ] + }, + { + "name": "takeResponseBodyForInterceptionAsStream", + "description": "Returns a handle to the stream representing the response body. Note that after this command,\nthe intercepted request can't be continued as is -- you either need to cancel it or to provide\nthe response body. The stream only supports sequential read, IO.read will fail if the position\nis specified.", + "experimental": true, + "parameters": [ + { + "name": "interceptionId", + "$ref": "InterceptionId" + } + ], + "returns": [ + { + "name": "stream", + "$ref": "IO.StreamHandle" + } + ] + }, + { + "name": "replayXHR", + "description": "This method sends a new XMLHttpRequest which is identical to the original one. The following\nparameters should be identical: method, url, async, request body, extra headers, withCredentials\nattribute, user, password.", + "experimental": true, + "parameters": [ + { + "name": "requestId", + "description": "Identifier of XHR to replay.", + "$ref": "RequestId" + } + ] + }, + { + "name": "searchInResponseBody", + "description": "Searches for given string in response content.", + "experimental": true, + "parameters": [ + { + "name": "requestId", + "description": "Identifier of the network response to search.", + "$ref": "RequestId" + }, + { + "name": "query", + "description": "String to search for.", + "type": "string" + }, + { + "name": "caseSensitive", + "description": "If true, search is case sensitive.", + "optional": true, + "type": "boolean" + }, + { + "name": "isRegex", + "description": "If true, treats string parameter as regex.", + "optional": true, + "type": "boolean" + } + ], + "returns": [ + { + "name": "result", + "description": "List of search matches.", + "type": "array", + "items": { + "$ref": "Debugger.SearchMatch" + } + } + ] + }, + { + "name": "setBlockedURLs", + "description": "Blocks URLs from loading.", + "experimental": true, + "parameters": [ + { + "name": "urls", + "description": "URL patterns to block. Wildcards ('*') are allowed.", + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + { + "name": "setBypassServiceWorker", + "description": "Toggles ignoring of service worker for each request.", + "experimental": true, + "parameters": [ + { + "name": "bypass", + "description": "Bypass service worker and load from network.", + "type": "boolean" + } + ] + }, + { + "name": "setCacheDisabled", + "description": "Toggles ignoring cache for each request. If `true`, cache will not be used.", + "parameters": [ + { + "name": "cacheDisabled", + "description": "Cache disabled state.", + "type": "boolean" + } + ] + }, + { + "name": "setCookie", + "description": "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.", + "parameters": [ + { + "name": "name", + "description": "Cookie name.", + "type": "string" + }, + { + "name": "value", + "description": "Cookie value.", + "type": "string" + }, + { + "name": "url", + "description": "The request-URI to associate with the setting of the cookie. This value can affect the\ndefault domain, path, source port, and source scheme values of the created cookie.", + "optional": true, + "type": "string" + }, + { + "name": "domain", + "description": "Cookie domain.", + "optional": true, + "type": "string" + }, + { + "name": "path", + "description": "Cookie path.", + "optional": true, + "type": "string" + }, + { + "name": "secure", + "description": "True if cookie is secure.", + "optional": true, + "type": "boolean" + }, + { + "name": "httpOnly", + "description": "True if cookie is http-only.", + "optional": true, + "type": "boolean" + }, + { + "name": "sameSite", + "description": "Cookie SameSite type.", + "optional": true, + "$ref": "CookieSameSite" + }, + { + "name": "expires", + "description": "Cookie expiration date, session cookie if not set", + "optional": true, + "$ref": "TimeSinceEpoch" + }, + { + "name": "priority", + "description": "Cookie Priority type.", + "experimental": true, + "optional": true, + "$ref": "CookiePriority" + }, + { + "name": "sameParty", + "description": "True if cookie is SameParty.", + "experimental": true, + "optional": true, + "type": "boolean" + }, + { + "name": "sourceScheme", + "description": "Cookie source scheme type.", + "experimental": true, + "optional": true, + "$ref": "CookieSourceScheme" + }, + { + "name": "sourcePort", + "description": "Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port.\nAn unspecified port value allows protocol clients to emulate legacy cookie scope for the port.\nThis is a temporary ability and it will be removed in the future.", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "partitionKey", + "description": "Cookie partition key. The site of the top-level URL the browser was visiting at the start\nof the request to the endpoint that set the cookie.\nIf not set, the cookie will be set as not partitioned.", + "experimental": true, + "optional": true, + "type": "string" + } + ], + "returns": [ + { + "name": "success", + "description": "Always set to true. If an error occurs, the response indicates protocol error.", + "deprecated": true, + "type": "boolean" + } + ] + }, + { + "name": "setCookies", + "description": "Sets given cookies.", + "parameters": [ + { + "name": "cookies", + "description": "Cookies to be set.", + "type": "array", + "items": { + "$ref": "CookieParam" + } + } + ] + }, + { + "name": "setExtraHTTPHeaders", + "description": "Specifies whether to always send extra HTTP headers with the requests from this page.", + "parameters": [ + { + "name": "headers", + "description": "Map with extra HTTP headers.", + "$ref": "Headers" + } + ] + }, + { + "name": "setAttachDebugStack", + "description": "Specifies whether to attach a page script stack id in requests", + "experimental": true, + "parameters": [ + { + "name": "enabled", + "description": "Whether to attach a page script stack for debugging purpose.", + "type": "boolean" + } + ] + }, + { + "name": "setRequestInterception", + "description": "Sets the requests to intercept that match the provided patterns and optionally resource types.\nDeprecated, please use Fetch.enable instead.", + "experimental": true, + "deprecated": true, + "parameters": [ + { + "name": "patterns", + "description": "Requests matching any of these patterns will be forwarded and wait for the corresponding\ncontinueInterceptedRequest call.", + "type": "array", + "items": { + "$ref": "RequestPattern" + } + } + ] + }, + { + "name": "setUserAgentOverride", + "description": "Allows overriding user agent with the given string.", + "redirect": "Emulation", + "parameters": [ + { + "name": "userAgent", + "description": "User agent to use.", + "type": "string" + }, + { + "name": "acceptLanguage", + "description": "Browser langugage to emulate.", + "optional": true, + "type": "string" + }, + { + "name": "platform", + "description": "The platform navigator.platform should return.", + "optional": true, + "type": "string" + }, + { + "name": "userAgentMetadata", + "description": "To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData", + "experimental": true, + "optional": true, + "$ref": "Emulation.UserAgentMetadata" + } + ] + }, + { + "name": "getSecurityIsolationStatus", + "description": "Returns information about the COEP/COOP isolation status.", + "experimental": true, + "parameters": [ + { + "name": "frameId", + "description": "If no frameId is provided, the status of the target is provided.", + "optional": true, + "$ref": "Page.FrameId" + } + ], + "returns": [ + { + "name": "status", + "$ref": "SecurityIsolationStatus" + } + ] + }, + { + "name": "enableReportingApi", + "description": "Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client.\nEnabling triggers 'reportingApiReportAdded' for all existing reports.", + "experimental": true, + "parameters": [ + { + "name": "enable", + "description": "Whether to enable or disable events for the Reporting API", + "type": "boolean" + } + ] + }, + { + "name": "loadNetworkResource", + "description": "Fetches the resource and returns the content.", + "experimental": true, + "parameters": [ + { + "name": "frameId", + "description": "Frame id to get the resource for. Mandatory for frame targets, and\nshould be omitted for worker targets.", + "optional": true, + "$ref": "Page.FrameId" + }, + { + "name": "url", + "description": "URL of the resource to get content for.", + "type": "string" + }, + { + "name": "options", + "description": "Options for the request.", + "$ref": "LoadNetworkResourceOptions" + } + ], + "returns": [ + { + "name": "resource", + "$ref": "LoadNetworkResourcePageResult" + } + ] + } + ], + "events": [ + { + "name": "dataReceived", + "description": "Fired when data chunk was received over the network.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + }, + { + "name": "dataLength", + "description": "Data chunk length.", + "type": "integer" + }, + { + "name": "encodedDataLength", + "description": "Actual bytes received (might be less than dataLength for compressed encodings).", + "type": "integer" + } + ] + }, + { + "name": "eventSourceMessageReceived", + "description": "Fired when EventSource message is received.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + }, + { + "name": "eventName", + "description": "Message type.", + "type": "string" + }, + { + "name": "eventId", + "description": "Message identifier.", + "type": "string" + }, + { + "name": "data", + "description": "Message content.", + "type": "string" + } + ] + }, + { + "name": "loadingFailed", + "description": "Fired when HTTP request has failed to load.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + }, + { + "name": "type", + "description": "Resource type.", + "$ref": "ResourceType" + }, + { + "name": "errorText", + "description": "User friendly error message.", + "type": "string" + }, + { + "name": "canceled", + "description": "True if loading was canceled.", + "optional": true, + "type": "boolean" + }, + { + "name": "blockedReason", + "description": "The reason why loading was blocked, if any.", + "optional": true, + "$ref": "BlockedReason" + }, + { + "name": "corsErrorStatus", + "description": "The reason why loading was blocked by CORS, if any.", + "optional": true, + "$ref": "CorsErrorStatus" + } + ] + }, + { + "name": "loadingFinished", + "description": "Fired when HTTP request has finished loading.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + }, + { + "name": "encodedDataLength", + "description": "Total number of bytes received for this request.", + "type": "number" + }, + { + "name": "shouldReportCorbBlocking", + "description": "Set when 1) response was blocked by Cross-Origin Read Blocking and also\n2) this needs to be reported to the DevTools console.", + "optional": true, + "type": "boolean" + } + ] + }, + { + "name": "requestIntercepted", + "description": "Details of an intercepted HTTP request, which must be either allowed, blocked, modified or\nmocked.\nDeprecated, use Fetch.requestPaused instead.", + "experimental": true, + "deprecated": true, + "parameters": [ + { + "name": "interceptionId", + "description": "Each request the page makes will have a unique id, however if any redirects are encountered\nwhile processing that fetch, they will be reported with the same id as the original fetch.\nLikewise if HTTP authentication is needed then the same fetch id will be used.", + "$ref": "InterceptionId" + }, + { + "name": "request", + "$ref": "Request" + }, + { + "name": "frameId", + "description": "The id of the frame that initiated the request.", + "$ref": "Page.FrameId" + }, + { + "name": "resourceType", + "description": "How the requested resource will be used.", + "$ref": "ResourceType" + }, + { + "name": "isNavigationRequest", + "description": "Whether this is a navigation request, which can abort the navigation completely.", + "type": "boolean" + }, + { + "name": "isDownload", + "description": "Set if the request is a navigation that will result in a download.\nOnly present after response is received from the server (i.e. HeadersReceived stage).", + "optional": true, + "type": "boolean" + }, + { + "name": "redirectUrl", + "description": "Redirect location, only sent if a redirect was intercepted.", + "optional": true, + "type": "string" + }, + { + "name": "authChallenge", + "description": "Details of the Authorization Challenge encountered. If this is set then\ncontinueInterceptedRequest must contain an authChallengeResponse.", + "optional": true, + "$ref": "AuthChallenge" + }, + { + "name": "responseErrorReason", + "description": "Response error if intercepted at response stage or if redirect occurred while intercepting\nrequest.", + "optional": true, + "$ref": "ErrorReason" + }, + { + "name": "responseStatusCode", + "description": "Response code if intercepted at response stage or if redirect occurred while intercepting\nrequest or auth retry occurred.", + "optional": true, + "type": "integer" + }, + { + "name": "responseHeaders", + "description": "Response headers if intercepted at the response stage or if redirect occurred while\nintercepting request or auth retry occurred.", + "optional": true, + "$ref": "Headers" + }, + { + "name": "requestId", + "description": "If the intercepted request had a corresponding requestWillBeSent event fired for it, then\nthis requestId will be the same as the requestId present in the requestWillBeSent event.", + "optional": true, + "$ref": "RequestId" + } + ] + }, + { + "name": "requestServedFromCache", + "description": "Fired if request ended up loading from cache.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + } + ] + }, + { + "name": "requestWillBeSent", + "description": "Fired when page is about to send HTTP request.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "loaderId", + "description": "Loader identifier. Empty string if the request is fetched from worker.", + "$ref": "LoaderId" + }, + { + "name": "documentURL", + "description": "URL of the document this request is loaded for.", + "type": "string" + }, + { + "name": "request", + "description": "Request data.", + "$ref": "Request" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + }, + { + "name": "wallTime", + "description": "Timestamp.", + "$ref": "TimeSinceEpoch" + }, + { + "name": "initiator", + "description": "Request initiator.", + "$ref": "Initiator" + }, + { + "name": "redirectHasExtraInfo", + "description": "In the case that redirectResponse is populated, this flag indicates whether\nrequestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted\nfor the request which was just redirected.", + "experimental": true, + "type": "boolean" + }, + { + "name": "redirectResponse", + "description": "Redirect response data.", + "optional": true, + "$ref": "Response" + }, + { + "name": "type", + "description": "Type of this resource.", + "optional": true, + "$ref": "ResourceType" + }, + { + "name": "frameId", + "description": "Frame identifier.", + "optional": true, + "$ref": "Page.FrameId" + }, + { + "name": "hasUserGesture", + "description": "Whether the request is initiated by a user gesture. Defaults to false.", + "optional": true, + "type": "boolean" + } + ] + }, + { + "name": "resourceChangedPriority", + "description": "Fired when resource loading priority is changed", + "experimental": true, + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "newPriority", + "description": "New priority", + "$ref": "ResourcePriority" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + } + ] + }, + { + "name": "signedExchangeReceived", + "description": "Fired when a signed exchange was received over the network", + "experimental": true, + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "info", + "description": "Information about the signed exchange response.", + "$ref": "SignedExchangeInfo" + } + ] + }, + { + "name": "responseReceived", + "description": "Fired when HTTP response is available.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "loaderId", + "description": "Loader identifier. Empty string if the request is fetched from worker.", + "$ref": "LoaderId" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + }, + { + "name": "type", + "description": "Resource type.", + "$ref": "ResourceType" + }, + { + "name": "response", + "description": "Response data.", + "$ref": "Response" + }, + { + "name": "hasExtraInfo", + "description": "Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be\nor were emitted for this request.", + "experimental": true, + "type": "boolean" + }, + { + "name": "frameId", + "description": "Frame identifier.", + "optional": true, + "$ref": "Page.FrameId" + } + ] + }, + { + "name": "webSocketClosed", + "description": "Fired when WebSocket is closed.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + } + ] + }, + { + "name": "webSocketCreated", + "description": "Fired upon WebSocket creation.", + "parameters": [ + { + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" + }, + { + "name": "url", + "description": "WebSocket request URL.", + "type": "string" + }, + { + "name": "initiator", + "description": "Request initiator.", + "optional": true, + "$ref": "Initiator" + } ] }, { - "id": "ResourceTiming", - "description": "Timing information for the request.", - "type": "object", - "properties": [ + "name": "webSocketFrameError", + "description": "Fired when WebSocket message error occurs.", + "parameters": [ { - "name": "requestTime", - "description": "Timing's requestTime is a baseline in seconds, while the other numbers are ticks in\nmilliseconds relatively to this requestTime.", - "type": "number" + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" }, { - "name": "proxyStart", - "description": "Started resolving proxy.", - "type": "number" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" }, { - "name": "proxyEnd", - "description": "Finished resolving proxy.", - "type": "number" - }, + "name": "errorMessage", + "description": "WebSocket error message.", + "type": "string" + } + ] + }, + { + "name": "webSocketFrameReceived", + "description": "Fired when WebSocket message is received.", + "parameters": [ { - "name": "dnsStart", - "description": "Started DNS address resolve.", - "type": "number" + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" }, { - "name": "dnsEnd", - "description": "Finished DNS address resolve.", - "type": "number" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" }, { - "name": "connectStart", - "description": "Started connecting to the remote host.", - "type": "number" - }, + "name": "response", + "description": "WebSocket response data.", + "$ref": "WebSocketFrame" + } + ] + }, + { + "name": "webSocketFrameSent", + "description": "Fired when WebSocket message is sent.", + "parameters": [ { - "name": "connectEnd", - "description": "Connected to the remote host.", - "type": "number" + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" }, { - "name": "sslStart", - "description": "Started SSL handshake.", - "type": "number" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" }, { - "name": "sslEnd", - "description": "Finished SSL handshake.", - "type": "number" - }, + "name": "response", + "description": "WebSocket response data.", + "$ref": "WebSocketFrame" + } + ] + }, + { + "name": "webSocketHandshakeResponseReceived", + "description": "Fired when WebSocket handshake response becomes available.", + "parameters": [ { - "name": "workerStart", - "description": "Started running ServiceWorker.", - "experimental": true, - "type": "number" + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" }, { - "name": "workerReady", - "description": "Finished Starting ServiceWorker.", - "experimental": true, - "type": "number" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" }, { - "name": "sendStart", - "description": "Started sending request.", - "type": "number" - }, + "name": "response", + "description": "WebSocket response data.", + "$ref": "WebSocketResponse" + } + ] + }, + { + "name": "webSocketWillSendHandshakeRequest", + "description": "Fired when WebSocket is about to initiate handshake.", + "parameters": [ { - "name": "sendEnd", - "description": "Finished sending request.", - "type": "number" + "name": "requestId", + "description": "Request identifier.", + "$ref": "RequestId" }, { - "name": "pushStart", - "description": "Time the server started pushing request.", - "experimental": true, - "type": "number" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" }, { - "name": "pushEnd", - "description": "Time the server finished pushing request.", - "experimental": true, - "type": "number" + "name": "wallTime", + "description": "UTC Timestamp.", + "$ref": "TimeSinceEpoch" }, { - "name": "receiveHeadersEnd", - "description": "Finished receiving response headers.", - "type": "number" + "name": "request", + "description": "WebSocket request data.", + "$ref": "WebSocketRequest" } ] }, { - "id": "ResourcePriority", - "description": "Loading priority of a resource request.", - "type": "string", - "enum": [ - "VeryLow", - "Low", - "Medium", - "High", - "VeryHigh" - ] - }, - { - "id": "Request", - "description": "HTTP request data.", - "type": "object", - "properties": [ - { - "name": "url", - "description": "Request URL (without fragment).", - "type": "string" - }, + "name": "webTransportCreated", + "description": "Fired upon WebTransport creation.", + "parameters": [ { - "name": "urlFragment", - "description": "Fragment of the requested URL starting with hash, if present.", - "optional": true, - "type": "string" + "name": "transportId", + "description": "WebTransport identifier.", + "$ref": "RequestId" }, { - "name": "method", - "description": "HTTP request method.", + "name": "url", + "description": "WebTransport request URL.", "type": "string" }, { - "name": "headers", - "description": "HTTP request headers.", - "$ref": "Headers" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" }, { - "name": "postData", - "description": "HTTP POST request data.", + "name": "initiator", + "description": "Request initiator.", "optional": true, - "type": "string" - }, + "$ref": "Initiator" + } + ] + }, + { + "name": "webTransportConnectionEstablished", + "description": "Fired when WebTransport handshake is finished.", + "parameters": [ { - "name": "hasPostData", - "description": "True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long.", - "optional": true, - "type": "boolean" + "name": "transportId", + "description": "WebTransport identifier.", + "$ref": "RequestId" }, { - "name": "mixedContentType", - "description": "The mixed content type of the request.", - "optional": true, - "$ref": "Security.MixedContentType" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + } + ] + }, + { + "name": "webTransportClosed", + "description": "Fired when WebTransport is disposed.", + "parameters": [ + { + "name": "transportId", + "description": "WebTransport identifier.", + "$ref": "RequestId" }, { - "name": "initialPriority", - "description": "Priority of the resource request at the time request is sent.", - "$ref": "ResourcePriority" + "name": "timestamp", + "description": "Timestamp.", + "$ref": "MonotonicTime" + } + ] + }, + { + "name": "requestWillBeSentExtraInfo", + "description": "Fired when additional information about a requestWillBeSent event is available from the\nnetwork stack. Not every requestWillBeSent event will have an additional\nrequestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent\nor requestWillBeSentExtraInfo will be fired first for the same request.", + "experimental": true, + "parameters": [ + { + "name": "requestId", + "description": "Request identifier. Used to match this information to an existing requestWillBeSent event.", + "$ref": "RequestId" }, { - "name": "referrerPolicy", - "description": "The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/", - "type": "string", - "enum": [ - "unsafe-url", - "no-referrer-when-downgrade", - "no-referrer", - "origin", - "origin-when-cross-origin", - "same-origin", - "strict-origin", - "strict-origin-when-cross-origin" - ] + "name": "associatedCookies", + "description": "A list of cookies potentially associated to the requested URL. This includes both cookies sent with\nthe request and the ones not sent; the latter are distinguished by having blockedReason field set.", + "type": "array", + "items": { + "$ref": "BlockedCookieWithReason" + } }, { - "name": "isLinkPreload", - "description": "Whether is loaded via link preload.", + "name": "headers", + "description": "Raw request headers as they will be sent over the wire.", + "$ref": "Headers" + }, + { + "name": "connectTiming", + "description": "Connection timing information for the request.", + "experimental": true, + "$ref": "ConnectTiming" + }, + { + "name": "clientSecurityState", + "description": "The client security state set for the request.", "optional": true, - "type": "boolean" + "$ref": "ClientSecurityState" } ] }, { - "id": "SignedCertificateTimestamp", - "description": "Details of a signed certificate timestamp (SCT).", - "type": "object", - "properties": [ - { - "name": "status", - "description": "Validation status.", - "type": "string" - }, - { - "name": "origin", - "description": "Origin.", - "type": "string" - }, + "name": "responseReceivedExtraInfo", + "description": "Fired when additional information about a responseReceived event is available from the network\nstack. Not every responseReceived event will have an additional responseReceivedExtraInfo for\nit, and responseReceivedExtraInfo may be fired before or after responseReceived.", + "experimental": true, + "parameters": [ { - "name": "logDescription", - "description": "Log name / description.", - "type": "string" + "name": "requestId", + "description": "Request identifier. Used to match this information to another responseReceived event.", + "$ref": "RequestId" }, { - "name": "logId", - "description": "Log ID.", - "type": "string" + "name": "blockedCookies", + "description": "A list of cookies which were not stored from the response along with the corresponding\nreasons for blocking. The cookies here may not be valid due to syntax errors, which\nare represented by the invalid cookie line string instead of a proper cookie.", + "type": "array", + "items": { + "$ref": "BlockedSetCookieWithReason" + } }, { - "name": "timestamp", - "description": "Issuance date.", - "$ref": "TimeSinceEpoch" + "name": "headers", + "description": "Raw response headers as they were received over the wire.", + "$ref": "Headers" }, { - "name": "hashAlgorithm", - "description": "Hash algorithm.", - "type": "string" + "name": "resourceIPAddressSpace", + "description": "The IP address space of the resource. The address space can only be determined once the transport\nestablished the connection, so we can't send it in `requestWillBeSentExtraInfo`.", + "$ref": "IPAddressSpace" }, { - "name": "signatureAlgorithm", - "description": "Signature algorithm.", - "type": "string" + "name": "statusCode", + "description": "The status code of the response. This is useful in cases the request failed and no responseReceived\nevent is triggered, which is the case for, e.g., CORS errors. This is also the correct status code\nfor cached requests, where the status in responseReceived is a 200 and this will be 304.", + "type": "integer" }, { - "name": "signatureData", - "description": "Signature data.", + "name": "headersText", + "description": "Raw response header text as it was received over the wire. The raw text may not always be\navailable, such as in the case of HTTP/2 or QUIC.", + "optional": true, "type": "string" } ] }, { - "id": "SecurityDetails", - "description": "Security details about a request.", - "type": "object", - "properties": [ + "name": "trustTokenOperationDone", + "description": "Fired exactly once for each Trust Token operation. Depending on\nthe type of the operation and whether the operation succeeded or\nfailed, the event is fired before the corresponding request was sent\nor after the response was received.", + "experimental": true, + "parameters": [ { - "name": "protocol", - "description": "Protocol name (e.g. \"TLS 1.2\" or \"QUIC\").", - "type": "string" + "name": "status", + "description": "Detailed success or error status of the operation.\n'AlreadyExists' also signifies a successful operation, as the result\nof the operation already exists und thus, the operation was abort\npreemptively (e.g. a cache hit).", + "type": "string", + "enum": [ + "Ok", + "InvalidArgument", + "FailedPrecondition", + "ResourceExhausted", + "AlreadyExists", + "Unavailable", + "BadResponse", + "InternalError", + "UnknownError", + "FulfilledLocally" + ] }, { - "name": "keyExchange", - "description": "Key Exchange used by the connection, or the empty string if not applicable.", - "type": "string" + "name": "type", + "$ref": "TrustTokenOperationType" }, { - "name": "keyExchangeGroup", - "description": "(EC)DH group used by the connection, if applicable.", - "optional": true, - "type": "string" + "name": "requestId", + "$ref": "RequestId" }, { - "name": "cipher", - "description": "Cipher name.", + "name": "topLevelOrigin", + "description": "Top level origin. The context in which the operation was attempted.", + "optional": true, "type": "string" }, { - "name": "mac", - "description": "TLS MAC. Note that AEAD ciphers do not have separate MACs.", + "name": "issuerOrigin", + "description": "Origin of the issuer in case of a \"Issuance\" or \"Redemption\" operation.", "optional": true, "type": "string" }, { - "name": "certificateId", - "description": "Certificate ID value.", - "$ref": "Security.CertificateId" - }, + "name": "issuedTokenCount", + "description": "The number of obtained Trust Tokens on a successful \"Issuance\" operation.", + "optional": true, + "type": "integer" + } + ] + }, + { + "name": "subresourceWebBundleMetadataReceived", + "description": "Fired once when parsing the .wbn file has succeeded.\nThe event contains the information about the web bundle contents.", + "experimental": true, + "parameters": [ { - "name": "subjectName", - "description": "Certificate subject name.", - "type": "string" + "name": "requestId", + "description": "Request identifier. Used to match this information to another event.", + "$ref": "RequestId" }, { - "name": "sanList", - "description": "Subject Alternative Name (SAN) DNS names and IP addresses.", + "name": "urls", + "description": "A list of URLs of resources in the subresource Web Bundle.", "type": "array", "items": { "type": "string" } + } + ] + }, + { + "name": "subresourceWebBundleMetadataError", + "description": "Fired once when parsing the .wbn file has failed.", + "experimental": true, + "parameters": [ + { + "name": "requestId", + "description": "Request identifier. Used to match this information to another event.", + "$ref": "RequestId" }, { - "name": "issuer", - "description": "Name of the issuing CA.", + "name": "errorMessage", + "description": "Error message", + "type": "string" + } + ] + }, + { + "name": "subresourceWebBundleInnerResponseParsed", + "description": "Fired when handling requests for resources within a .wbn file.\nNote: this will only be fired for resources that are requested by the webpage.", + "experimental": true, + "parameters": [ + { + "name": "innerRequestId", + "description": "Request identifier of the subresource request", + "$ref": "RequestId" + }, + { + "name": "innerRequestURL", + "description": "URL of the subresource resource.", "type": "string" }, { - "name": "validFrom", - "description": "Certificate valid from date.", - "$ref": "TimeSinceEpoch" + "name": "bundleRequestId", + "description": "Bundle request identifier. Used to match this information to another event.\nThis made be absent in case when the instrumentation was enabled only\nafter webbundle was parsed.", + "optional": true, + "$ref": "RequestId" + } + ] + }, + { + "name": "subresourceWebBundleInnerResponseError", + "description": "Fired when request for resources within a .wbn file failed.", + "experimental": true, + "parameters": [ + { + "name": "innerRequestId", + "description": "Request identifier of the subresource request", + "$ref": "RequestId" }, { - "name": "validTo", - "description": "Certificate valid to (expiration) date", - "$ref": "TimeSinceEpoch" + "name": "innerRequestURL", + "description": "URL of the subresource resource.", + "type": "string" }, { - "name": "signedCertificateTimestampList", - "description": "List of signed certificate timestamps (SCTs).", - "type": "array", - "items": { - "$ref": "SignedCertificateTimestamp" - } + "name": "errorMessage", + "description": "Error message", + "type": "string" }, { - "name": "certificateTransparencyCompliance", - "description": "Whether the request complied with Certificate Transparency policy", - "$ref": "CertificateTransparencyCompliance" + "name": "bundleRequestId", + "description": "Bundle request identifier. Used to match this information to another event.\nThis made be absent in case when the instrumentation was enabled only\nafter webbundle was parsed.", + "optional": true, + "$ref": "RequestId" } ] }, { - "id": "CertificateTransparencyCompliance", - "description": "Whether the request complied with Certificate Transparency policy.", - "type": "string", - "enum": [ - "unknown", - "not-compliant", - "compliant" + "name": "reportingApiReportAdded", + "description": "Is sent whenever a new report is added.\nAnd after 'enableReportingApi' for all existing reports.", + "experimental": true, + "parameters": [ + { + "name": "report", + "$ref": "ReportingApiReport" + } ] }, { - "id": "BlockedReason", - "description": "The reason why request was blocked.", - "type": "string", - "enum": [ - "other", - "csp", - "mixed-content", - "origin", - "inspector", - "subresource-filter", - "content-type", - "collapsed-by-client" + "name": "reportingApiReportUpdated", + "experimental": true, + "parameters": [ + { + "name": "report", + "$ref": "ReportingApiReport" + } ] }, { - "id": "Response", - "description": "HTTP response data.", - "type": "object", - "properties": [ - { - "name": "url", - "description": "Response URL. This URL can be different from CachedResource.url in case of redirect.", - "type": "string" - }, - { - "name": "status", - "description": "HTTP response status code.", - "type": "integer" - }, + "name": "reportingApiEndpointsChangedForOrigin", + "experimental": true, + "parameters": [ { - "name": "statusText", - "description": "HTTP response status text.", + "name": "origin", + "description": "Origin of the document(s) which configured the endpoints.", "type": "string" }, { - "name": "headers", - "description": "HTTP response headers.", - "$ref": "Headers" - }, - { - "name": "headersText", - "description": "HTTP response headers text.", - "optional": true, - "type": "string" - }, + "name": "endpoints", + "type": "array", + "items": { + "$ref": "ReportingApiEndpoint" + } + } + ] + } + ] + }, + { + "domain": "Overlay", + "description": "This domain provides various functionality related to drawing atop the inspected page.", + "experimental": true, + "dependencies": [ + "DOM", + "Page", + "Runtime" + ], + "types": [ + { + "id": "SourceOrderConfig", + "description": "Configuration data for drawing the source order of an elements children.", + "type": "object", + "properties": [ { - "name": "mimeType", - "description": "Resource mimeType as determined by the browser.", - "type": "string" + "name": "parentOutlineColor", + "description": "the color to outline the givent element in.", + "$ref": "DOM.RGBA" }, { - "name": "requestHeaders", - "description": "Refined HTTP request headers that were actually transmitted over the network.", - "optional": true, - "$ref": "Headers" - }, + "name": "childOutlineColor", + "description": "the color to outline the child elements in.", + "$ref": "DOM.RGBA" + } + ] + }, + { + "id": "GridHighlightConfig", + "description": "Configuration data for the highlighting of Grid elements.", + "type": "object", + "properties": [ { - "name": "requestHeadersText", - "description": "HTTP request headers text.", + "name": "showGridExtensionLines", + "description": "Whether the extension lines from grid cells to the rulers should be shown (default: false).", "optional": true, - "type": "string" - }, - { - "name": "connectionReused", - "description": "Specifies whether physical connection was actually reused for this request.", "type": "boolean" }, { - "name": "connectionId", - "description": "Physical connection id that was actually used for this request.", - "type": "number" - }, - { - "name": "remoteIPAddress", - "description": "Remote IP address.", + "name": "showPositiveLineNumbers", + "description": "Show Positive line number labels (default: false).", "optional": true, - "type": "string" + "type": "boolean" }, { - "name": "remotePort", - "description": "Remote port.", + "name": "showNegativeLineNumbers", + "description": "Show Negative line number labels (default: false).", "optional": true, - "type": "integer" + "type": "boolean" }, { - "name": "fromDiskCache", - "description": "Specifies that the request was served from the disk cache.", + "name": "showAreaNames", + "description": "Show area name labels (default: false).", "optional": true, "type": "boolean" }, { - "name": "fromServiceWorker", - "description": "Specifies that the request was served from the ServiceWorker.", + "name": "showLineNames", + "description": "Show line name labels (default: false).", "optional": true, "type": "boolean" }, { - "name": "fromPrefetchCache", - "description": "Specifies that the request was served from the prefetch cache.", + "name": "showTrackSizes", + "description": "Show track size labels (default: false).", "optional": true, "type": "boolean" }, { - "name": "encodedDataLength", - "description": "Total number of bytes received for this request so far.", - "type": "number" + "name": "gridBorderColor", + "description": "The grid container border highlight color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "timing", - "description": "Timing information for the given request.", + "name": "cellBorderColor", + "description": "The cell border color (default: transparent). Deprecated, please use rowLineColor and columnLineColor instead.", + "deprecated": true, "optional": true, - "$ref": "ResourceTiming" + "$ref": "DOM.RGBA" }, { - "name": "protocol", - "description": "Protocol used to fetch this request.", + "name": "rowLineColor", + "description": "The row line color (default: transparent).", "optional": true, - "type": "string" + "$ref": "DOM.RGBA" }, { - "name": "securityState", - "description": "Security state of the request resource.", - "$ref": "Security.SecurityState" + "name": "columnLineColor", + "description": "The column line color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "securityDetails", - "description": "Security details for the request.", + "name": "gridBorderDash", + "description": "Whether the grid border is dashed (default: false).", "optional": true, - "$ref": "SecurityDetails" - } - ] - }, - { - "id": "WebSocketRequest", - "description": "WebSocket request data.", - "type": "object", - "properties": [ - { - "name": "headers", - "description": "HTTP request headers.", - "$ref": "Headers" - } - ] - }, - { - "id": "WebSocketResponse", - "description": "WebSocket response data.", - "type": "object", - "properties": [ + "type": "boolean" + }, { - "name": "status", - "description": "HTTP response status code.", - "type": "integer" + "name": "cellBorderDash", + "description": "Whether the cell border is dashed (default: false). Deprecated, please us rowLineDash and columnLineDash instead.", + "deprecated": true, + "optional": true, + "type": "boolean" }, { - "name": "statusText", - "description": "HTTP response status text.", - "type": "string" + "name": "rowLineDash", + "description": "Whether row lines are dashed (default: false).", + "optional": true, + "type": "boolean" }, { - "name": "headers", - "description": "HTTP response headers.", - "$ref": "Headers" + "name": "columnLineDash", + "description": "Whether column lines are dashed (default: false).", + "optional": true, + "type": "boolean" }, { - "name": "headersText", - "description": "HTTP response headers text.", + "name": "rowGapColor", + "description": "The row gap highlight fill color (default: transparent).", "optional": true, - "type": "string" + "$ref": "DOM.RGBA" }, { - "name": "requestHeaders", - "description": "HTTP request headers.", + "name": "rowHatchColor", + "description": "The row gap hatching fill color (default: transparent).", "optional": true, - "$ref": "Headers" + "$ref": "DOM.RGBA" }, { - "name": "requestHeadersText", - "description": "HTTP request headers text.", + "name": "columnGapColor", + "description": "The column gap highlight fill color (default: transparent).", "optional": true, - "type": "string" - } - ] - }, - { - "id": "WebSocketFrame", - "description": "WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests.", - "type": "object", - "properties": [ + "$ref": "DOM.RGBA" + }, { - "name": "opcode", - "description": "WebSocket message opcode.", - "type": "number" + "name": "columnHatchColor", + "description": "The column gap hatching fill color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "mask", - "description": "WebSocket message mask.", - "type": "boolean" + "name": "areaBorderColor", + "description": "The named grid areas border color (Default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "payloadData", - "description": "WebSocket message payload data.\nIf the opcode is 1, this is a text message and payloadData is a UTF-8 string.\nIf the opcode isn't 1, then payloadData is a base64 encoded string representing binary data.", - "type": "string" + "name": "gridBackgroundColor", + "description": "The grid container background color (Default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" } ] }, { - "id": "CachedResource", - "description": "Information about the cached resource.", + "id": "FlexContainerHighlightConfig", + "description": "Configuration data for the highlighting of Flex container elements.", "type": "object", "properties": [ { - "name": "url", - "description": "Resource URL. This is the url of the original network request.", - "type": "string" + "name": "containerBorder", + "description": "The style of the container border", + "optional": true, + "$ref": "LineStyle" }, { - "name": "type", - "description": "Type of this resource.", - "$ref": "ResourceType" + "name": "lineSeparator", + "description": "The style of the separator between lines", + "optional": true, + "$ref": "LineStyle" }, { - "name": "response", - "description": "Cached response data.", + "name": "itemSeparator", + "description": "The style of the separator between items", "optional": true, - "$ref": "Response" + "$ref": "LineStyle" }, { - "name": "bodySize", - "description": "Cached response body size.", - "type": "number" - } - ] - }, - { - "id": "Initiator", - "description": "Information about the request initiator.", - "type": "object", - "properties": [ + "name": "mainDistributedSpace", + "description": "Style of content-distribution space on the main axis (justify-content).", + "optional": true, + "$ref": "BoxStyle" + }, { - "name": "type", - "description": "Type of this initiator.", - "type": "string", - "enum": [ - "parser", - "script", - "preload", - "SignedExchange", - "other" - ] + "name": "crossDistributedSpace", + "description": "Style of content-distribution space on the cross axis (align-content).", + "optional": true, + "$ref": "BoxStyle" }, { - "name": "stack", - "description": "Initiator JavaScript stack trace, set for Script only.", + "name": "rowGapSpace", + "description": "Style of empty space caused by row gaps (gap/row-gap).", "optional": true, - "$ref": "Runtime.StackTrace" + "$ref": "BoxStyle" }, { - "name": "url", - "description": "Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type.", + "name": "columnGapSpace", + "description": "Style of empty space caused by columns gaps (gap/column-gap).", "optional": true, - "type": "string" + "$ref": "BoxStyle" }, { - "name": "lineNumber", - "description": "Initiator line number, set for Parser type or for Script type (when script is importing\nmodule) (0-based).", + "name": "crossAlignment", + "description": "Style of the self-alignment line (align-items).", "optional": true, - "type": "number" + "$ref": "LineStyle" } ] }, { - "id": "Cookie", - "description": "Cookie object", + "id": "FlexItemHighlightConfig", + "description": "Configuration data for the highlighting of Flex item elements.", "type": "object", "properties": [ { - "name": "name", - "description": "Cookie name.", - "type": "string" - }, - { - "name": "value", - "description": "Cookie value.", - "type": "string" - }, - { - "name": "domain", - "description": "Cookie domain.", - "type": "string" - }, - { - "name": "path", - "description": "Cookie path.", - "type": "string" - }, - { - "name": "expires", - "description": "Cookie expiration date as the number of seconds since the UNIX epoch.", - "type": "number" - }, - { - "name": "size", - "description": "Cookie size.", - "type": "integer" - }, - { - "name": "httpOnly", - "description": "True if cookie is http-only.", - "type": "boolean" - }, - { - "name": "secure", - "description": "True if cookie is secure.", - "type": "boolean" + "name": "baseSizeBox", + "description": "Style of the box representing the item's base size", + "optional": true, + "$ref": "BoxStyle" }, { - "name": "session", - "description": "True in case of session cookie.", - "type": "boolean" + "name": "baseSizeBorder", + "description": "Style of the border around the box representing the item's base size", + "optional": true, + "$ref": "LineStyle" }, { - "name": "sameSite", - "description": "Cookie SameSite type.", + "name": "flexibilityArrow", + "description": "Style of the arrow representing if the item grew or shrank", "optional": true, - "$ref": "CookieSameSite" + "$ref": "LineStyle" } ] - }, - { - "id": "SetCookieBlockedReason", - "description": "Types of reasons why a cookie may not be stored from a response.", - "experimental": true, - "type": "string", - "enum": [ - "SecureOnly", - "SameSiteStrict", - "SameSiteLax", - "SameSiteExtended", - "SameSiteUnspecifiedTreatedAsLax", - "SameSiteNoneInsecure", - "UserPreferences", - "SyntaxError", - "SchemeNotSupported", - "OverwriteSecure", - "InvalidDomain", - "InvalidPrefix", - "UnknownError" - ] - }, - { - "id": "CookieBlockedReason", - "description": "Types of reasons why a cookie may not be sent with a request.", - "experimental": true, - "type": "string", - "enum": [ - "SecureOnly", - "NotOnPath", - "DomainMismatch", - "SameSiteStrict", - "SameSiteLax", - "SameSiteExtended", - "SameSiteUnspecifiedTreatedAsLax", - "SameSiteNoneInsecure", - "UserPreferences", - "UnknownError" - ] - }, - { - "id": "BlockedSetCookieWithReason", - "description": "A cookie which was not stored from a response with the corresponding reason.", - "experimental": true, + }, + { + "id": "LineStyle", + "description": "Style information for drawing a line.", "type": "object", "properties": [ { - "name": "blockedReason", - "description": "The reason this cookie was blocked.", - "$ref": "SetCookieBlockedReason" - }, - { - "name": "cookieLine", - "description": "The string representing this individual cookie as it would appear in the header.\nThis is not the entire \"cookie\" or \"set-cookie\" header which could have multiple cookies.", - "type": "string" + "name": "color", + "description": "The color of the line (default: transparent)", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "cookie", - "description": "The cookie object which represents the cookie which was not stored. It is optional because\nsometimes complete cookie information is not available, such as in the case of parsing\nerrors.", + "name": "pattern", + "description": "The line pattern (default: solid)", "optional": true, - "$ref": "Cookie" + "type": "string", + "enum": [ + "dashed", + "dotted" + ] } ] }, { - "id": "BlockedCookieWithReason", - "description": "A cookie with was not sent with a request with the corresponding reason.", - "experimental": true, + "id": "BoxStyle", + "description": "Style information for drawing a box.", "type": "object", "properties": [ { - "name": "blockedReason", - "description": "The reason the cookie was blocked.", - "$ref": "CookieBlockedReason" + "name": "fillColor", + "description": "The background color for the box (default: transparent)", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "cookie", - "description": "The cookie object representing the cookie which was not sent.", - "$ref": "Cookie" + "name": "hatchColor", + "description": "The hatching color for the box (default: transparent)", + "optional": true, + "$ref": "DOM.RGBA" } ] }, { - "id": "CookieParam", - "description": "Cookie parameter object", + "id": "ContrastAlgorithm", + "type": "string", + "enum": [ + "aa", + "aaa", + "apca" + ] + }, + { + "id": "HighlightConfig", + "description": "Configuration data for the highlighting of page elements.", "type": "object", "properties": [ { - "name": "name", - "description": "Cookie name.", - "type": "string" + "name": "showInfo", + "description": "Whether the node info tooltip should be shown (default: false).", + "optional": true, + "type": "boolean" }, { - "name": "value", - "description": "Cookie value.", - "type": "string" + "name": "showStyles", + "description": "Whether the node styles in the tooltip (default: false).", + "optional": true, + "type": "boolean" }, { - "name": "url", - "description": "The request-URI to associate with the setting of the cookie. This value can affect the\ndefault domain and path values of the created cookie.", + "name": "showRulers", + "description": "Whether the rulers should be shown (default: false).", "optional": true, - "type": "string" + "type": "boolean" }, { - "name": "domain", - "description": "Cookie domain.", + "name": "showAccessibilityInfo", + "description": "Whether the a11y info should be shown (default: true).", "optional": true, - "type": "string" + "type": "boolean" }, { - "name": "path", - "description": "Cookie path.", + "name": "showExtensionLines", + "description": "Whether the extension lines from node to the rulers should be shown (default: false).", "optional": true, - "type": "string" + "type": "boolean" }, { - "name": "secure", - "description": "True if cookie is secure.", + "name": "contentColor", + "description": "The content box highlight fill color (default: transparent).", "optional": true, - "type": "boolean" + "$ref": "DOM.RGBA" }, { - "name": "httpOnly", - "description": "True if cookie is http-only.", + "name": "paddingColor", + "description": "The padding highlight fill color (default: transparent).", "optional": true, - "type": "boolean" + "$ref": "DOM.RGBA" }, { - "name": "sameSite", - "description": "Cookie SameSite type.", + "name": "borderColor", + "description": "The border highlight fill color (default: transparent).", "optional": true, - "$ref": "CookieSameSite" + "$ref": "DOM.RGBA" }, { - "name": "expires", - "description": "Cookie expiration date, session cookie if not set", + "name": "marginColor", + "description": "The margin highlight fill color (default: transparent).", "optional": true, - "$ref": "TimeSinceEpoch" - } - ] - }, - { - "id": "AuthChallenge", - "description": "Authorization challenge for HTTP status code 401 or 407.", - "experimental": true, - "type": "object", - "properties": [ + "$ref": "DOM.RGBA" + }, { - "name": "source", - "description": "Source of the authentication challenge.", + "name": "eventTargetColor", + "description": "The event target element highlight fill color (default: transparent).", "optional": true, - "type": "string", - "enum": [ - "Server", - "Proxy" - ] + "$ref": "DOM.RGBA" }, { - "name": "origin", - "description": "Origin of the challenger.", - "type": "string" + "name": "shapeColor", + "description": "The shape outside fill color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "scheme", - "description": "The authentication scheme used, such as basic or digest", - "type": "string" + "name": "shapeMarginColor", + "description": "The shape margin fill color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "realm", - "description": "The realm of the challenge. May be empty.", - "type": "string" - } - ] - }, - { - "id": "AuthChallengeResponse", - "description": "Response to an AuthChallenge.", - "experimental": true, - "type": "object", - "properties": [ + "name": "cssGridColor", + "description": "The grid layout color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" + }, { - "name": "response", - "description": "The decision on what to do in response to the authorization challenge. Default means\ndeferring to the default behavior of the net stack, which will likely either the Cancel\nauthentication or display a popup dialog box.", - "type": "string", - "enum": [ - "Default", - "CancelAuth", - "ProvideCredentials" - ] + "name": "colorFormat", + "description": "The color format used to format color styles (default: hex).", + "optional": true, + "$ref": "ColorFormat" }, { - "name": "username", - "description": "The username to provide, possibly empty. Should only be set if response is\nProvideCredentials.", + "name": "gridHighlightConfig", + "description": "The grid layout highlight configuration (default: all transparent).", "optional": true, - "type": "string" + "$ref": "GridHighlightConfig" }, { - "name": "password", - "description": "The password to provide, possibly empty. Should only be set if response is\nProvideCredentials.", + "name": "flexContainerHighlightConfig", + "description": "The flex container highlight configuration (default: all transparent).", "optional": true, - "type": "string" + "$ref": "FlexContainerHighlightConfig" + }, + { + "name": "flexItemHighlightConfig", + "description": "The flex item highlight configuration (default: all transparent).", + "optional": true, + "$ref": "FlexItemHighlightConfig" + }, + { + "name": "contrastAlgorithm", + "description": "The contrast algorithm to use for the contrast ratio (default: aa).", + "optional": true, + "$ref": "ContrastAlgorithm" + }, + { + "name": "containerQueryContainerHighlightConfig", + "description": "The container query container highlight configuration (default: all transparent).", + "optional": true, + "$ref": "ContainerQueryContainerHighlightConfig" } ] }, { - "id": "InterceptionStage", - "description": "Stages of the interception to begin intercepting. Request will intercept before the request is\nsent. Response will intercept after the response is received.", - "experimental": true, + "id": "ColorFormat", "type": "string", "enum": [ - "Request", - "HeadersReceived" + "rgb", + "hsl", + "hex" ] }, { - "id": "RequestPattern", - "description": "Request pattern for interception.", - "experimental": true, + "id": "GridNodeHighlightConfig", + "description": "Configurations for Persistent Grid Highlight", "type": "object", "properties": [ { - "name": "urlPattern", - "description": "Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is\nbackslash. Omitting is equivalent to \"*\".", - "optional": true, - "type": "string" - }, - { - "name": "resourceType", - "description": "If set, only requests for matching resource types will be intercepted.", - "optional": true, - "$ref": "ResourceType" + "name": "gridHighlightConfig", + "description": "A descriptor for the highlight appearance.", + "$ref": "GridHighlightConfig" }, { - "name": "interceptionStage", - "description": "Stage at wich to begin intercepting requests. Default is Request.", - "optional": true, - "$ref": "InterceptionStage" + "name": "nodeId", + "description": "Identifier of the node to highlight.", + "$ref": "DOM.NodeId" } ] }, { - "id": "SignedExchangeSignature", - "description": "Information about a signed exchange signature.\nhttps://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1", - "experimental": true, + "id": "FlexNodeHighlightConfig", "type": "object", "properties": [ { - "name": "label", - "description": "Signed exchange signature label.", - "type": "string" + "name": "flexContainerHighlightConfig", + "description": "A descriptor for the highlight appearance of flex containers.", + "$ref": "FlexContainerHighlightConfig" }, { - "name": "signature", - "description": "The hex string of signed exchange signature.", - "type": "string" - }, + "name": "nodeId", + "description": "Identifier of the node to highlight.", + "$ref": "DOM.NodeId" + } + ] + }, + { + "id": "ScrollSnapContainerHighlightConfig", + "type": "object", + "properties": [ { - "name": "integrity", - "description": "Signed exchange signature integrity.", - "type": "string" + "name": "snapportBorder", + "description": "The style of the snapport border (default: transparent)", + "optional": true, + "$ref": "LineStyle" }, { - "name": "certUrl", - "description": "Signed exchange signature cert Url.", + "name": "snapAreaBorder", + "description": "The style of the snap area border (default: transparent)", "optional": true, - "type": "string" + "$ref": "LineStyle" }, { - "name": "certSha256", - "description": "The hex string of signed exchange signature cert sha256.", + "name": "scrollMarginColor", + "description": "The margin highlight fill color (default: transparent).", "optional": true, - "type": "string" + "$ref": "DOM.RGBA" }, { - "name": "validityUrl", - "description": "Signed exchange signature validity Url.", - "type": "string" + "name": "scrollPaddingColor", + "description": "The padding highlight fill color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" + } + ] + }, + { + "id": "ScrollSnapHighlightConfig", + "type": "object", + "properties": [ + { + "name": "scrollSnapContainerHighlightConfig", + "description": "A descriptor for the highlight appearance of scroll snap containers.", + "$ref": "ScrollSnapContainerHighlightConfig" }, { - "name": "date", - "description": "Signed exchange signature date.", - "type": "integer" + "name": "nodeId", + "description": "Identifier of the node to highlight.", + "$ref": "DOM.NodeId" + } + ] + }, + { + "id": "HingeConfig", + "description": "Configuration for dual screen hinge", + "type": "object", + "properties": [ + { + "name": "rect", + "description": "A rectangle represent hinge", + "$ref": "DOM.Rect" }, { - "name": "expires", - "description": "Signed exchange signature expires.", - "type": "integer" + "name": "contentColor", + "description": "The content box highlight fill color (default: a dark color).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "certificates", - "description": "The encoded certificates.", + "name": "outlineColor", + "description": "The content box highlight outline color (default: transparent).", "optional": true, - "type": "array", - "items": { - "type": "string" - } + "$ref": "DOM.RGBA" } ] }, { - "id": "SignedExchangeHeader", - "description": "Information about a signed exchange header.\nhttps://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation", - "experimental": true, + "id": "ContainerQueryHighlightConfig", "type": "object", "properties": [ { - "name": "requestUrl", - "description": "Signed exchange request URL.", - "type": "string" - }, - { - "name": "responseCode", - "description": "Signed exchange response code.", - "type": "integer" + "name": "containerQueryContainerHighlightConfig", + "description": "A descriptor for the highlight appearance of container query containers.", + "$ref": "ContainerQueryContainerHighlightConfig" }, { - "name": "responseHeaders", - "description": "Signed exchange response headers.", - "$ref": "Headers" - }, + "name": "nodeId", + "description": "Identifier of the container node to highlight.", + "$ref": "DOM.NodeId" + } + ] + }, + { + "id": "ContainerQueryContainerHighlightConfig", + "type": "object", + "properties": [ { - "name": "signatures", - "description": "Signed exchange response signature.", - "type": "array", - "items": { - "$ref": "SignedExchangeSignature" - } + "name": "containerBorder", + "description": "The style of the container border.", + "optional": true, + "$ref": "LineStyle" }, { - "name": "headerIntegrity", - "description": "Signed exchange header integrity hash in the form of \"sha256-\".", - "type": "string" + "name": "descendantBorder", + "description": "The style of the descendants' borders.", + "optional": true, + "$ref": "LineStyle" } ] }, { - "id": "SignedExchangeErrorField", - "description": "Field type for a signed exchange related error.", - "experimental": true, - "type": "string", - "enum": [ - "signatureSig", - "signatureIntegrity", - "signatureCertUrl", - "signatureCertSha256", - "signatureValidityUrl", - "signatureTimestamps" + "id": "IsolatedElementHighlightConfig", + "type": "object", + "properties": [ + { + "name": "isolationModeHighlightConfig", + "description": "A descriptor for the highlight appearance of an element in isolation mode.", + "$ref": "IsolationModeHighlightConfig" + }, + { + "name": "nodeId", + "description": "Identifier of the isolated element to highlight.", + "$ref": "DOM.NodeId" + } ] }, { - "id": "SignedExchangeError", - "description": "Information about a signed exchange response.", - "experimental": true, + "id": "IsolationModeHighlightConfig", "type": "object", "properties": [ { - "name": "message", - "description": "Error message.", - "type": "string" + "name": "resizerColor", + "description": "The fill color of the resizers (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "signatureIndex", - "description": "The index of the signature which caused the error.", + "name": "resizerHandleColor", + "description": "The fill color for resizer handles (default: transparent).", "optional": true, - "type": "integer" + "$ref": "DOM.RGBA" }, { - "name": "errorField", - "description": "The field which caused the error.", + "name": "maskColor", + "description": "The fill color for the mask covering non-isolated elements (default: transparent).", "optional": true, - "$ref": "SignedExchangeErrorField" + "$ref": "DOM.RGBA" } ] }, { - "id": "SignedExchangeInfo", - "description": "Information about a signed exchange response.", - "experimental": true, - "type": "object", - "properties": [ + "id": "InspectMode", + "type": "string", + "enum": [ + "searchForNode", + "searchForUAShadowDOM", + "captureAreaScreenshot", + "showDistances", + "none" + ] + } + ], + "commands": [ + { + "name": "disable", + "description": "Disables domain notifications." + }, + { + "name": "enable", + "description": "Enables domain notifications." + }, + { + "name": "getHighlightObjectForTest", + "description": "For testing.", + "parameters": [ { - "name": "outerResponse", - "description": "The outer response of signed HTTP exchange which was received from network.", - "$ref": "Response" + "name": "nodeId", + "description": "Id of the node to get highlight object for.", + "$ref": "DOM.NodeId" }, { - "name": "header", - "description": "Information about the signed exchange header.", + "name": "includeDistance", + "description": "Whether to include distance info.", "optional": true, - "$ref": "SignedExchangeHeader" + "type": "boolean" }, { - "name": "securityDetails", - "description": "Security details for the signed exchange header.", + "name": "includeStyle", + "description": "Whether to include style info.", "optional": true, - "$ref": "SecurityDetails" + "type": "boolean" }, { - "name": "errors", - "description": "Errors occurred while handling the signed exchagne.", + "name": "colorFormat", + "description": "The color format to get config with (default: hex).", "optional": true, - "type": "array", - "items": { - "$ref": "SignedExchangeError" - } + "$ref": "ColorFormat" + }, + { + "name": "showAccessibilityInfo", + "description": "Whether to show accessibility info (default: true).", + "optional": true, + "type": "boolean" } - ] - } - ], - "commands": [ - { - "name": "canClearBrowserCache", - "description": "Tells whether clearing browser cache is supported.", - "deprecated": true, + ], "returns": [ { - "name": "result", - "description": "True if browser cache can be cleared.", - "type": "boolean" + "name": "highlight", + "description": "Highlight data for the node.", + "type": "object" } ] }, { - "name": "canClearBrowserCookies", - "description": "Tells whether clearing browser cookies is supported.", - "deprecated": true, + "name": "getGridHighlightObjectsForTest", + "description": "For Persistent Grid testing.", + "parameters": [ + { + "name": "nodeIds", + "description": "Ids of the node to get highlight object for.", + "type": "array", + "items": { + "$ref": "DOM.NodeId" + } + } + ], "returns": [ { - "name": "result", - "description": "True if browser cookies can be cleared.", - "type": "boolean" + "name": "highlights", + "description": "Grid Highlight data for the node ids provided.", + "type": "object" } ] }, { - "name": "canEmulateNetworkConditions", - "description": "Tells whether emulation of network conditions is supported.", - "deprecated": true, + "name": "getSourceOrderHighlightObjectForTest", + "description": "For Source Order Viewer testing.", + "parameters": [ + { + "name": "nodeId", + "description": "Id of the node to highlight.", + "$ref": "DOM.NodeId" + } + ], "returns": [ { - "name": "result", - "description": "True if emulation of network conditions is supported.", - "type": "boolean" + "name": "highlight", + "description": "Source order highlight data for the node id provided.", + "type": "object" } ] }, { - "name": "clearBrowserCache", - "description": "Clears browser cache." - }, - { - "name": "clearBrowserCookies", - "description": "Clears browser cookies." + "name": "hideHighlight", + "description": "Hides any highlight." }, { - "name": "continueInterceptedRequest", - "description": "Response to Network.requestIntercepted which either modifies the request to continue with any\nmodifications, or blocks it, or completes it with the provided response bytes. If a network\nfetch occurs as a result which encounters a redirect an additional Network.requestIntercepted\nevent will be sent with the same InterceptionId.\nDeprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead.", - "experimental": true, + "name": "highlightFrame", + "description": "Highlights owner element of the frame with given id.\nDeprecated: Doesn't work reliablity and cannot be fixed due to process\nseparatation (the owner node might be in a different process). Determine\nthe owner node in the client and use highlightNode.", "deprecated": true, "parameters": [ { - "name": "interceptionId", - "$ref": "InterceptionId" - }, - { - "name": "errorReason", - "description": "If set this causes the request to fail with the given reason. Passing `Aborted` for requests\nmarked with `isNavigationRequest` also cancels the navigation. Must not be set in response\nto an authChallenge.", - "optional": true, - "$ref": "ErrorReason" - }, - { - "name": "rawResponse", - "description": "If set the requests completes using with the provided base64 encoded raw response, including\nHTTP status line and headers etc... Must not be set in response to an authChallenge.", - "optional": true, - "type": "string" - }, - { - "name": "url", - "description": "If set the request url will be modified in a way that's not observable by page. Must not be\nset in response to an authChallenge.", - "optional": true, - "type": "string" - }, - { - "name": "method", - "description": "If set this allows the request method to be overridden. Must not be set in response to an\nauthChallenge.", - "optional": true, - "type": "string" - }, - { - "name": "postData", - "description": "If set this allows postData to be set. Must not be set in response to an authChallenge.", - "optional": true, - "type": "string" + "name": "frameId", + "description": "Identifier of the frame to highlight.", + "$ref": "Page.FrameId" }, { - "name": "headers", - "description": "If set this allows the request headers to be changed. Must not be set in response to an\nauthChallenge.", + "name": "contentColor", + "description": "The content box highlight fill color (default: transparent).", "optional": true, - "$ref": "Headers" + "$ref": "DOM.RGBA" }, { - "name": "authChallengeResponse", - "description": "Response to a requestIntercepted with an authChallenge. Must not be set otherwise.", + "name": "contentOutlineColor", + "description": "The content box highlight outline color (default: transparent).", "optional": true, - "$ref": "AuthChallengeResponse" + "$ref": "DOM.RGBA" } ] }, { - "name": "deleteCookies", - "description": "Deletes browser cookies with matching name and url or domain/path pair.", + "name": "highlightNode", + "description": "Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or\nobjectId must be specified.", "parameters": [ { - "name": "name", - "description": "Name of the cookies to remove.", - "type": "string" + "name": "highlightConfig", + "description": "A descriptor for the highlight appearance.", + "$ref": "HighlightConfig" }, { - "name": "url", - "description": "If specified, deletes all the cookies with the given name where domain and path match\nprovided URL.", + "name": "nodeId", + "description": "Identifier of the node to highlight.", "optional": true, - "type": "string" + "$ref": "DOM.NodeId" + }, + { + "name": "backendNodeId", + "description": "Identifier of the backend node to highlight.", + "optional": true, + "$ref": "DOM.BackendNodeId" }, { - "name": "domain", - "description": "If specified, deletes only cookies with the exact domain.", + "name": "objectId", + "description": "JavaScript object id of the node to be highlighted.", "optional": true, - "type": "string" + "$ref": "Runtime.RemoteObjectId" }, { - "name": "path", - "description": "If specified, deletes only cookies with the exact path.", + "name": "selector", + "description": "Selectors to highlight relevant nodes.", "optional": true, "type": "string" } ] }, { - "name": "disable", - "description": "Disables network tracking, prevents network events from being sent to the client." - }, - { - "name": "emulateNetworkConditions", - "description": "Activates emulation of network conditions.", + "name": "highlightQuad", + "description": "Highlights given quad. Coordinates are absolute with respect to the main frame viewport.", "parameters": [ { - "name": "offline", - "description": "True to emulate internet disconnection.", - "type": "boolean" - }, - { - "name": "latency", - "description": "Minimum latency from request sent to response headers received (ms).", - "type": "number" - }, - { - "name": "downloadThroughput", - "description": "Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.", - "type": "number" + "name": "quad", + "description": "Quad to highlight", + "$ref": "DOM.Quad" }, { - "name": "uploadThroughput", - "description": "Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.", - "type": "number" + "name": "color", + "description": "The highlight fill color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" }, { - "name": "connectionType", - "description": "Connection type if known.", + "name": "outlineColor", + "description": "The highlight outline color (default: transparent).", "optional": true, - "$ref": "ConnectionType" + "$ref": "DOM.RGBA" } ] }, { - "name": "enable", - "description": "Enables network tracking, network events will now be delivered to the client.", + "name": "highlightRect", + "description": "Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.", "parameters": [ { - "name": "maxTotalBufferSize", - "description": "Buffer size in bytes to use when preserving network payloads (XHRs, etc).", - "experimental": true, - "optional": true, + "name": "x", + "description": "X coordinate", "type": "integer" }, { - "name": "maxResourceBufferSize", - "description": "Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).", - "experimental": true, - "optional": true, + "name": "y", + "description": "Y coordinate", "type": "integer" }, { - "name": "maxPostDataSize", - "description": "Longest post body size (in bytes) that would be included in requestWillBeSent notification", - "optional": true, + "name": "width", + "description": "Rectangle width", "type": "integer" - } - ] - }, - { - "name": "getAllCookies", - "description": "Returns all browser cookies. Depending on the backend support, will return detailed cookie\ninformation in the `cookies` field.", - "returns": [ + }, { - "name": "cookies", - "description": "Array of cookie objects.", - "type": "array", - "items": { - "$ref": "Cookie" - } - } - ] - }, - { - "name": "getCertificate", - "description": "Returns the DER-encoded certificate.", - "experimental": true, - "parameters": [ + "name": "height", + "description": "Rectangle height", + "type": "integer" + }, { - "name": "origin", - "description": "Origin to get certificate for.", - "type": "string" - } - ], - "returns": [ + "name": "color", + "description": "The highlight fill color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" + }, { - "name": "tableNames", - "type": "array", - "items": { - "type": "string" - } + "name": "outlineColor", + "description": "The highlight outline color (default: transparent).", + "optional": true, + "$ref": "DOM.RGBA" } ] }, { - "name": "getCookies", - "description": "Returns all browser cookies for the current URL. Depending on the backend support, will return\ndetailed cookie information in the `cookies` field.", + "name": "highlightSourceOrder", + "description": "Highlights the source order of the children of the DOM node with given id or with the given\nJavaScript object wrapper. Either nodeId or objectId must be specified.", "parameters": [ { - "name": "urls", - "description": "The list of URLs for which applicable cookies will be fetched", + "name": "sourceOrderConfig", + "description": "A descriptor for the appearance of the overlay drawing.", + "$ref": "SourceOrderConfig" + }, + { + "name": "nodeId", + "description": "Identifier of the node to highlight.", "optional": true, - "type": "array", - "items": { - "type": "string" - } - } - ], - "returns": [ + "$ref": "DOM.NodeId" + }, { - "name": "cookies", - "description": "Array of cookie objects.", - "type": "array", - "items": { - "$ref": "Cookie" - } + "name": "backendNodeId", + "description": "Identifier of the backend node to highlight.", + "optional": true, + "$ref": "DOM.BackendNodeId" + }, + { + "name": "objectId", + "description": "JavaScript object id of the node to be highlighted.", + "optional": true, + "$ref": "Runtime.RemoteObjectId" } ] }, { - "name": "getResponseBody", - "description": "Returns content served for the given request.", + "name": "setInspectMode", + "description": "Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.\nBackend then generates 'inspectNodeRequested' event upon element selection.", "parameters": [ { - "name": "requestId", - "description": "Identifier of the network request to get content for.", - "$ref": "RequestId" - } - ], - "returns": [ - { - "name": "body", - "description": "Response body.", - "type": "string" + "name": "mode", + "description": "Set an inspection mode.", + "$ref": "InspectMode" }, { - "name": "base64Encoded", - "description": "True, if content was sent as base64.", - "type": "boolean" + "name": "highlightConfig", + "description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if `enabled\n== false`.", + "optional": true, + "$ref": "HighlightConfig" } ] }, { - "name": "getRequestPostData", - "description": "Returns post data sent with the request. Returns an error when no data was sent with the request.", + "name": "setShowAdHighlights", + "description": "Highlights owner element of all frames detected to be ads.", "parameters": [ { - "name": "requestId", - "description": "Identifier of the network request to get content for.", - "$ref": "RequestId" - } - ], - "returns": [ - { - "name": "postData", - "description": "Request body string, omitting files from multipart requests", - "type": "string" + "name": "show", + "description": "True for showing ad highlights", + "type": "boolean" } ] }, { - "name": "getResponseBodyForInterception", - "description": "Returns content served for the given currently intercepted request.", - "experimental": true, + "name": "setPausedInDebuggerMessage", "parameters": [ { - "name": "interceptionId", - "description": "Identifier for the intercepted request to get body for.", - "$ref": "InterceptionId" - } - ], - "returns": [ - { - "name": "body", - "description": "Response body.", + "name": "message", + "description": "The message to display, also triggers resume and step over controls.", + "optional": true, "type": "string" - }, - { - "name": "base64Encoded", - "description": "True, if content was sent as base64.", - "type": "boolean" } ] }, { - "name": "takeResponseBodyForInterceptionAsStream", - "description": "Returns a handle to the stream representing the response body. Note that after this command,\nthe intercepted request can't be continued as is -- you either need to cancel it or to provide\nthe response body. The stream only supports sequential read, IO.read will fail if the position\nis specified.", - "experimental": true, + "name": "setShowDebugBorders", + "description": "Requests that backend shows debug borders on layers", "parameters": [ { - "name": "interceptionId", - "$ref": "InterceptionId" - } - ], - "returns": [ - { - "name": "stream", - "$ref": "IO.StreamHandle" + "name": "show", + "description": "True for showing debug borders", + "type": "boolean" } ] }, { - "name": "replayXHR", - "description": "This method sends a new XMLHttpRequest which is identical to the original one. The following\nparameters should be identical: method, url, async, request body, extra headers, withCredentials\nattribute, user, password.", - "experimental": true, + "name": "setShowFPSCounter", + "description": "Requests that backend shows the FPS counter", "parameters": [ { - "name": "requestId", - "description": "Identifier of XHR to replay.", - "$ref": "RequestId" + "name": "show", + "description": "True for showing the FPS counter", + "type": "boolean" } ] }, { - "name": "searchInResponseBody", - "description": "Searches for given string in response content.", - "experimental": true, + "name": "setShowGridOverlays", + "description": "Highlight multiple elements with the CSS Grid overlay.", "parameters": [ { - "name": "requestId", - "description": "Identifier of the network response to search.", - "$ref": "RequestId" - }, - { - "name": "query", - "description": "String to search for.", - "type": "string" - }, - { - "name": "caseSensitive", - "description": "If true, search is case sensitive.", - "optional": true, - "type": "boolean" - }, + "name": "gridNodeHighlightConfigs", + "description": "An array of node identifiers and descriptors for the highlight appearance.", + "type": "array", + "items": { + "$ref": "GridNodeHighlightConfig" + } + } + ] + }, + { + "name": "setShowFlexOverlays", + "parameters": [ { - "name": "isRegex", - "description": "If true, treats string parameter as regex.", - "optional": true, - "type": "boolean" + "name": "flexNodeHighlightConfigs", + "description": "An array of node identifiers and descriptors for the highlight appearance.", + "type": "array", + "items": { + "$ref": "FlexNodeHighlightConfig" + } } - ], - "returns": [ + ] + }, + { + "name": "setShowScrollSnapOverlays", + "parameters": [ { - "name": "result", - "description": "List of search matches.", + "name": "scrollSnapHighlightConfigs", + "description": "An array of node identifiers and descriptors for the highlight appearance.", "type": "array", "items": { - "$ref": "Debugger.SearchMatch" + "$ref": "ScrollSnapHighlightConfig" } } ] }, { - "name": "setBlockedURLs", - "description": "Blocks URLs from loading.", - "experimental": true, + "name": "setShowContainerQueryOverlays", "parameters": [ { - "name": "urls", - "description": "URL patterns to block. Wildcards ('*') are allowed.", + "name": "containerQueryHighlightConfigs", + "description": "An array of node identifiers and descriptors for the highlight appearance.", "type": "array", "items": { - "type": "string" + "$ref": "ContainerQueryHighlightConfig" } } ] }, { - "name": "setBypassServiceWorker", - "description": "Toggles ignoring of service worker for each request.", - "experimental": true, + "name": "setShowPaintRects", + "description": "Requests that backend shows paint rectangles", "parameters": [ { - "name": "bypass", - "description": "Bypass service worker and load from network.", + "name": "result", + "description": "True for showing paint rectangles", "type": "boolean" } ] }, { - "name": "setCacheDisabled", - "description": "Toggles ignoring cache for each request. If `true`, cache will not be used.", + "name": "setShowLayoutShiftRegions", + "description": "Requests that backend shows layout shift regions", "parameters": [ { - "name": "cacheDisabled", - "description": "Cache disabled state.", + "name": "result", + "description": "True for showing layout shift regions", "type": "boolean" } ] }, { - "name": "setCookie", - "description": "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.", + "name": "setShowScrollBottleneckRects", + "description": "Requests that backend shows scroll bottleneck rects", "parameters": [ { - "name": "name", - "description": "Cookie name.", - "type": "string" - }, - { - "name": "value", - "description": "Cookie value.", - "type": "string" - }, - { - "name": "url", - "description": "The request-URI to associate with the setting of the cookie. This value can affect the\ndefault domain and path values of the created cookie.", - "optional": true, - "type": "string" - }, - { - "name": "domain", - "description": "Cookie domain.", - "optional": true, - "type": "string" - }, - { - "name": "path", - "description": "Cookie path.", - "optional": true, - "type": "string" - }, - { - "name": "secure", - "description": "True if cookie is secure.", - "optional": true, + "name": "show", + "description": "True for showing scroll bottleneck rects", "type": "boolean" - }, + } + ] + }, + { + "name": "setShowHitTestBorders", + "description": "Requests that backend shows hit-test borders on layers", + "parameters": [ { - "name": "httpOnly", - "description": "True if cookie is http-only.", - "optional": true, + "name": "show", + "description": "True for showing hit-test borders", "type": "boolean" - }, - { - "name": "sameSite", - "description": "Cookie SameSite type.", - "optional": true, - "$ref": "CookieSameSite" - }, + } + ] + }, + { + "name": "setShowWebVitals", + "description": "Request that backend shows an overlay with web vital metrics.", + "parameters": [ { - "name": "expires", - "description": "Cookie expiration date, session cookie if not set", - "optional": true, - "$ref": "TimeSinceEpoch" + "name": "show", + "type": "boolean" } - ], - "returns": [ + ] + }, + { + "name": "setShowViewportSizeOnResize", + "description": "Paints viewport size upon main frame resize.", + "parameters": [ { - "name": "success", - "description": "True if successfully set cookie.", + "name": "show", + "description": "Whether to paint size or not.", "type": "boolean" } ] }, { - "name": "setCookies", - "description": "Sets given cookies.", + "name": "setShowHinge", + "description": "Add a dual screen device hinge", "parameters": [ { - "name": "cookies", - "description": "Cookies to be set.", + "name": "hingeConfig", + "description": "hinge data, null means hideHinge", + "optional": true, + "$ref": "HingeConfig" + } + ] + }, + { + "name": "setShowIsolatedElements", + "description": "Show elements in isolation mode with overlays.", + "parameters": [ + { + "name": "isolatedElementHighlightConfigs", + "description": "An array of node identifiers and descriptors for the highlight appearance.", "type": "array", "items": { - "$ref": "CookieParam" + "$ref": "IsolatedElementHighlightConfig" } } ] - }, + } + ], + "events": [ { - "name": "setDataSizeLimitsForTest", - "description": "For testing.", - "experimental": true, + "name": "inspectNodeRequested", + "description": "Fired when the node should be inspected. This happens after call to `setInspectMode` or when\nuser manually inspects an element.", "parameters": [ { - "name": "maxTotalSize", - "description": "Maximum total buffer size.", - "type": "integer" - }, + "name": "backendNodeId", + "description": "Id of the node to inspect.", + "$ref": "DOM.BackendNodeId" + } + ] + }, + { + "name": "nodeHighlightRequested", + "description": "Fired when the node should be highlighted. This happens after call to `setInspectMode`.", + "parameters": [ { - "name": "maxResourceSize", - "description": "Maximum per-resource size.", - "type": "integer" + "name": "nodeId", + "$ref": "DOM.NodeId" } ] }, { - "name": "setExtraHTTPHeaders", - "description": "Specifies whether to always send extra HTTP headers with the requests from this page.", + "name": "screenshotRequested", + "description": "Fired when user asks to capture screenshot of some area on the page.", "parameters": [ { - "name": "headers", - "description": "Map with extra HTTP headers.", - "$ref": "Headers" + "name": "viewport", + "description": "Viewport to capture, in device independent pixels (dip).", + "$ref": "Page.Viewport" } ] }, { - "name": "setRequestInterception", - "description": "Sets the requests to intercept that match the provided patterns and optionally resource types.\nDeprecated, please use Fetch.enable instead.", + "name": "inspectModeCanceled", + "description": "Fired when user cancels the inspect mode." + } + ] + }, + { + "domain": "Page", + "description": "Actions and events related to the inspected page belong to the page domain.", + "dependencies": [ + "Debugger", + "DOM", + "IO", + "Network", + "Runtime" + ], + "types": [ + { + "id": "FrameId", + "description": "Unique frame identifier.", + "type": "string" + }, + { + "id": "AdFrameType", + "description": "Indicates whether a frame has been identified as an ad.", "experimental": true, - "deprecated": true, - "parameters": [ + "type": "string", + "enum": [ + "none", + "child", + "root" + ] + }, + { + "id": "AdFrameExplanation", + "experimental": true, + "type": "string", + "enum": [ + "ParentIsAd", + "CreatedByAdScript", + "MatchedBlockingRule" + ] + }, + { + "id": "AdFrameStatus", + "description": "Indicates whether a frame has been identified as an ad and why.", + "experimental": true, + "type": "object", + "properties": [ { - "name": "patterns", - "description": "Requests matching any of these patterns will be forwarded and wait for the corresponding\ncontinueInterceptedRequest call.", + "name": "adFrameType", + "$ref": "AdFrameType" + }, + { + "name": "explanations", + "optional": true, "type": "array", "items": { - "$ref": "RequestPattern" + "$ref": "AdFrameExplanation" } } ] }, { - "name": "setUserAgentOverride", - "description": "Allows overriding user agent with the given string.", - "redirect": "Emulation", - "parameters": [ - { - "name": "userAgent", - "description": "User agent to use.", - "type": "string" - }, + "id": "SecureContextType", + "description": "Indicates whether the frame is a secure context and why it is the case.", + "experimental": true, + "type": "string", + "enum": [ + "Secure", + "SecureLocalhost", + "InsecureScheme", + "InsecureAncestor" + ] + }, + { + "id": "CrossOriginIsolatedContextType", + "description": "Indicates whether the frame is cross-origin isolated and why it is the case.", + "experimental": true, + "type": "string", + "enum": [ + "Isolated", + "NotIsolated", + "NotIsolatedFeatureDisabled" + ] + }, + { + "id": "GatedAPIFeatures", + "experimental": true, + "type": "string", + "enum": [ + "SharedArrayBuffers", + "SharedArrayBuffersTransferAllowed", + "PerformanceMeasureMemory", + "PerformanceProfile" + ] + }, + { + "id": "PermissionsPolicyFeature", + "description": "All Permissions Policy features. This enum should match the one defined\nin third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5.", + "experimental": true, + "type": "string", + "enum": [ + "accelerometer", + "ambient-light-sensor", + "attribution-reporting", + "autoplay", + "camera", + "ch-dpr", + "ch-device-memory", + "ch-downlink", + "ch-ect", + "ch-prefers-color-scheme", + "ch-rtt", + "ch-ua", + "ch-ua-arch", + "ch-ua-bitness", + "ch-ua-platform", + "ch-ua-model", + "ch-ua-mobile", + "ch-ua-full-version", + "ch-ua-full-version-list", + "ch-ua-platform-version", + "ch-ua-reduced", + "ch-viewport-height", + "ch-viewport-width", + "ch-width", + "clipboard-read", + "clipboard-write", + "cross-origin-isolated", + "direct-sockets", + "display-capture", + "document-domain", + "encrypted-media", + "execution-while-out-of-viewport", + "execution-while-not-rendered", + "focus-without-user-activation", + "fullscreen", + "frobulate", + "gamepad", + "geolocation", + "gyroscope", + "hid", + "idle-detection", + "interest-cohort", + "join-ad-interest-group", + "keyboard-map", + "magnetometer", + "microphone", + "midi", + "otp-credentials", + "payment", + "picture-in-picture", + "publickey-credentials-get", + "run-ad-auction", + "screen-wake-lock", + "serial", + "shared-autofill", + "storage-access-api", + "sync-xhr", + "trust-token-redemption", + "usb", + "vertical-scroll", + "web-share", + "window-placement", + "xr-spatial-tracking" + ] + }, + { + "id": "PermissionsPolicyBlockReason", + "description": "Reason for a permissions policy feature to be disabled.", + "experimental": true, + "type": "string", + "enum": [ + "Header", + "IframeAttribute" + ] + }, + { + "id": "PermissionsPolicyBlockLocator", + "experimental": true, + "type": "object", + "properties": [ { - "name": "acceptLanguage", - "description": "Browser langugage to emulate.", - "optional": true, - "type": "string" + "name": "frameId", + "$ref": "FrameId" }, { - "name": "platform", - "description": "The platform navigator.platform should return.", - "optional": true, - "type": "string" + "name": "blockReason", + "$ref": "PermissionsPolicyBlockReason" } ] - } - ], - "events": [ + }, { - "name": "dataReceived", - "description": "Fired when data chunk was received over the network.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" - }, + "id": "PermissionsPolicyFeatureState", + "experimental": true, + "type": "object", + "properties": [ { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "feature", + "$ref": "PermissionsPolicyFeature" }, { - "name": "dataLength", - "description": "Data chunk length.", - "type": "integer" + "name": "allowed", + "type": "boolean" }, { - "name": "encodedDataLength", - "description": "Actual bytes received (might be less than dataLength for compressed encodings).", - "type": "integer" + "name": "locator", + "optional": true, + "$ref": "PermissionsPolicyBlockLocator" } ] }, { - "name": "eventSourceMessageReceived", - "description": "Fired when EventSource message is received.", - "parameters": [ + "id": "OriginTrialTokenStatus", + "description": "Origin Trial(https://www.chromium.org/blink/origin-trials) support.\nStatus for an Origin Trial token.", + "experimental": true, + "type": "string", + "enum": [ + "Success", + "NotSupported", + "Insecure", + "Expired", + "WrongOrigin", + "InvalidSignature", + "Malformed", + "WrongVersion", + "FeatureDisabled", + "TokenDisabled", + "FeatureDisabledForUser", + "UnknownTrial" + ] + }, + { + "id": "OriginTrialStatus", + "description": "Status for an Origin Trial.", + "experimental": true, + "type": "string", + "enum": [ + "Enabled", + "ValidTokenNotProvided", + "OSNotSupported", + "TrialNotAllowed" + ] + }, + { + "id": "OriginTrialUsageRestriction", + "experimental": true, + "type": "string", + "enum": [ + "None", + "Subset" + ] + }, + { + "id": "OriginTrialToken", + "experimental": true, + "type": "object", + "properties": [ { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "origin", + "type": "string" }, { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "matchSubDomains", + "type": "boolean" }, { - "name": "eventName", - "description": "Message type.", + "name": "trialName", "type": "string" }, { - "name": "eventId", - "description": "Message identifier.", - "type": "string" + "name": "expiryTime", + "$ref": "Network.TimeSinceEpoch" }, { - "name": "data", - "description": "Message content.", - "type": "string" + "name": "isThirdParty", + "type": "boolean" + }, + { + "name": "usageRestriction", + "$ref": "OriginTrialUsageRestriction" } ] }, { - "name": "loadingFailed", - "description": "Fired when HTTP request has failed to load.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" - }, - { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" - }, - { - "name": "type", - "description": "Resource type.", - "$ref": "ResourceType" - }, + "id": "OriginTrialTokenWithStatus", + "experimental": true, + "type": "object", + "properties": [ { - "name": "errorText", - "description": "User friendly error message.", + "name": "rawTokenText", "type": "string" }, { - "name": "canceled", - "description": "True if loading was canceled.", + "name": "parsedToken", + "description": "`parsedToken` is present only when the token is extractable and\nparsable.", "optional": true, - "type": "boolean" + "$ref": "OriginTrialToken" }, { - "name": "blockedReason", - "description": "The reason why loading was blocked, if any.", - "optional": true, - "$ref": "BlockedReason" + "name": "status", + "$ref": "OriginTrialTokenStatus" } ] }, { - "name": "loadingFinished", - "description": "Fired when HTTP request has finished loading.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" - }, + "id": "OriginTrial", + "experimental": true, + "type": "object", + "properties": [ { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "trialName", + "type": "string" }, { - "name": "encodedDataLength", - "description": "Total number of bytes received for this request.", - "type": "number" + "name": "status", + "$ref": "OriginTrialStatus" }, { - "name": "shouldReportCorbBlocking", - "description": "Set when 1) response was blocked by Cross-Origin Read Blocking and also\n2) this needs to be reported to the DevTools console.", - "optional": true, - "type": "boolean" + "name": "tokensWithStatus", + "type": "array", + "items": { + "$ref": "OriginTrialTokenWithStatus" + } } ] }, { - "name": "requestIntercepted", - "description": "Details of an intercepted HTTP request, which must be either allowed, blocked, modified or\nmocked.\nDeprecated, use Fetch.requestPaused instead.", - "experimental": true, - "deprecated": true, - "parameters": [ + "id": "Frame", + "description": "Information about the Frame on the page.", + "type": "object", + "properties": [ { - "name": "interceptionId", - "description": "Each request the page makes will have a unique id, however if any redirects are encountered\nwhile processing that fetch, they will be reported with the same id as the original fetch.\nLikewise if HTTP authentication is needed then the same fetch id will be used.", - "$ref": "InterceptionId" + "name": "id", + "description": "Frame unique identifier.", + "$ref": "FrameId" }, { - "name": "request", - "$ref": "Request" + "name": "parentId", + "description": "Parent frame identifier.", + "optional": true, + "$ref": "FrameId" }, { - "name": "frameId", - "description": "The id of the frame that initiated the request.", - "$ref": "Page.FrameId" + "name": "loaderId", + "description": "Identifier of the loader associated with this frame.", + "$ref": "Network.LoaderId" }, { - "name": "resourceType", - "description": "How the requested resource will be used.", - "$ref": "ResourceType" + "name": "name", + "description": "Frame's name as specified in the tag.", + "optional": true, + "type": "string" }, { - "name": "isNavigationRequest", - "description": "Whether this is a navigation request, which can abort the navigation completely.", - "type": "boolean" + "name": "url", + "description": "Frame document's URL without fragment.", + "type": "string" }, { - "name": "isDownload", - "description": "Set if the request is a navigation that will result in a download.\nOnly present after response is received from the server (i.e. HeadersReceived stage).", + "name": "urlFragment", + "description": "Frame document's URL fragment including the '#'.", + "experimental": true, "optional": true, - "type": "boolean" + "type": "string" }, { - "name": "redirectUrl", - "description": "Redirect location, only sent if a redirect was intercepted.", - "optional": true, + "name": "domainAndRegistry", + "description": "Frame document's registered domain, taking the public suffixes list into account.\nExtracted from the Frame's url.\nExample URLs: http://www.google.com/file.html -> \"google.com\"\n http://a.b.co.uk/file.html -> \"b.co.uk\"", + "experimental": true, "type": "string" }, { - "name": "authChallenge", - "description": "Details of the Authorization Challenge encountered. If this is set then\ncontinueInterceptedRequest must contain an authChallengeResponse.", - "optional": true, - "$ref": "AuthChallenge" + "name": "securityOrigin", + "description": "Frame document's security origin.", + "type": "string" }, { - "name": "responseErrorReason", - "description": "Response error if intercepted at response stage or if redirect occurred while intercepting\nrequest.", - "optional": true, - "$ref": "ErrorReason" + "name": "mimeType", + "description": "Frame document's mimeType as determined by the browser.", + "type": "string" }, { - "name": "responseStatusCode", - "description": "Response code if intercepted at response stage or if redirect occurred while intercepting\nrequest or auth retry occurred.", + "name": "unreachableUrl", + "description": "If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment.", + "experimental": true, "optional": true, - "type": "integer" + "type": "string" }, { - "name": "responseHeaders", - "description": "Response headers if intercepted at the response stage or if redirect occurred while\nintercepting request or auth retry occurred.", + "name": "adFrameStatus", + "description": "Indicates whether this frame was tagged as an ad and why.", + "experimental": true, "optional": true, - "$ref": "Headers" + "$ref": "AdFrameStatus" }, { - "name": "requestId", - "description": "If the intercepted request had a corresponding requestWillBeSent event fired for it, then\nthis requestId will be the same as the requestId present in the requestWillBeSent event.", - "optional": true, - "$ref": "RequestId" - } - ] - }, - { - "name": "requestServedFromCache", - "description": "Fired if request ended up loading from cache.", - "parameters": [ + "name": "secureContextType", + "description": "Indicates whether the main document is a secure context and explains why that is the case.", + "experimental": true, + "$ref": "SecureContextType" + }, { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "crossOriginIsolatedContextType", + "description": "Indicates whether this is a cross origin isolated context.", + "experimental": true, + "$ref": "CrossOriginIsolatedContextType" + }, + { + "name": "gatedAPIFeatures", + "description": "Indicated which gated APIs / features are available.", + "experimental": true, + "type": "array", + "items": { + "$ref": "GatedAPIFeatures" + } } ] }, { - "name": "requestWillBeSent", - "description": "Fired when page is about to send HTTP request.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" - }, - { - "name": "loaderId", - "description": "Loader identifier. Empty string if the request is fetched from worker.", - "$ref": "LoaderId" - }, + "id": "FrameResource", + "description": "Information about the Resource on the page.", + "experimental": true, + "type": "object", + "properties": [ { - "name": "documentURL", - "description": "URL of the document this request is loaded for.", + "name": "url", + "description": "Resource URL.", "type": "string" }, { - "name": "request", - "description": "Request data.", - "$ref": "Request" - }, - { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" - }, - { - "name": "wallTime", - "description": "Timestamp.", - "$ref": "TimeSinceEpoch" + "name": "type", + "description": "Type of this resource.", + "$ref": "Network.ResourceType" }, { - "name": "initiator", - "description": "Request initiator.", - "$ref": "Initiator" + "name": "mimeType", + "description": "Resource mimeType as determined by the browser.", + "type": "string" }, { - "name": "redirectResponse", - "description": "Redirect response data.", + "name": "lastModified", + "description": "last-modified timestamp as reported by server.", "optional": true, - "$ref": "Response" + "$ref": "Network.TimeSinceEpoch" }, { - "name": "type", - "description": "Type of this resource.", + "name": "contentSize", + "description": "Resource content size.", "optional": true, - "$ref": "ResourceType" + "type": "number" }, { - "name": "frameId", - "description": "Frame identifier.", + "name": "failed", + "description": "True if the resource failed to load.", "optional": true, - "$ref": "Page.FrameId" + "type": "boolean" }, { - "name": "hasUserGesture", - "description": "Whether the request is initiated by a user gesture. Defaults to false.", + "name": "canceled", + "description": "True if the resource was canceled during loading.", "optional": true, "type": "boolean" } ] }, { - "name": "resourceChangedPriority", - "description": "Fired when resource loading priority is changed", + "id": "FrameResourceTree", + "description": "Information about the Frame hierarchy along with their cached resources.", "experimental": true, - "parameters": [ + "type": "object", + "properties": [ { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "frame", + "description": "Frame information for this tree item.", + "$ref": "Frame" }, { - "name": "newPriority", - "description": "New priority", - "$ref": "ResourcePriority" + "name": "childFrames", + "description": "Child frames.", + "optional": true, + "type": "array", + "items": { + "$ref": "FrameResourceTree" + } }, { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "resources", + "description": "Information about frame resources.", + "type": "array", + "items": { + "$ref": "FrameResource" + } } ] }, { - "name": "signedExchangeReceived", - "description": "Fired when a signed exchange was received over the network", - "experimental": true, - "parameters": [ + "id": "FrameTree", + "description": "Information about the Frame hierarchy.", + "type": "object", + "properties": [ { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "frame", + "description": "Frame information for this tree item.", + "$ref": "Frame" }, { - "name": "info", - "description": "Information about the signed exchange response.", - "$ref": "SignedExchangeInfo" + "name": "childFrames", + "description": "Child frames.", + "optional": true, + "type": "array", + "items": { + "$ref": "FrameTree" + } } ] }, { - "name": "responseReceived", - "description": "Fired when HTTP response is available.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" - }, + "id": "ScriptIdentifier", + "description": "Unique script identifier.", + "type": "string" + }, + { + "id": "TransitionType", + "description": "Transition type.", + "type": "string", + "enum": [ + "link", + "typed", + "address_bar", + "auto_bookmark", + "auto_subframe", + "manual_subframe", + "generated", + "auto_toplevel", + "form_submit", + "reload", + "keyword", + "keyword_generated", + "other" + ] + }, + { + "id": "NavigationEntry", + "description": "Navigation history entry.", + "type": "object", + "properties": [ { - "name": "loaderId", - "description": "Loader identifier. Empty string if the request is fetched from worker.", - "$ref": "LoaderId" + "name": "id", + "description": "Unique id of the navigation history entry.", + "type": "integer" }, { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "url", + "description": "URL of the navigation history entry.", + "type": "string" }, { - "name": "type", - "description": "Resource type.", - "$ref": "ResourceType" + "name": "userTypedURL", + "description": "URL that the user typed in the url bar.", + "type": "string" }, { - "name": "response", - "description": "Response data.", - "$ref": "Response" + "name": "title", + "description": "Title of the navigation history entry.", + "type": "string" }, { - "name": "frameId", - "description": "Frame identifier.", - "optional": true, - "$ref": "Page.FrameId" + "name": "transitionType", + "description": "Transition type.", + "$ref": "TransitionType" } ] }, { - "name": "webSocketClosed", - "description": "Fired when WebSocket is closed.", - "parameters": [ + "id": "ScreencastFrameMetadata", + "description": "Screencast frame metadata.", + "experimental": true, + "type": "object", + "properties": [ { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "offsetTop", + "description": "Top offset in DIP.", + "type": "number" }, { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" - } - ] - }, - { - "name": "webSocketCreated", - "description": "Fired upon WebSocket creation.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "pageScaleFactor", + "description": "Page scale factor.", + "type": "number" }, { - "name": "url", - "description": "WebSocket request URL.", - "type": "string" + "name": "deviceWidth", + "description": "Device screen width in DIP.", + "type": "number" }, { - "name": "initiator", - "description": "Request initiator.", - "optional": true, - "$ref": "Initiator" - } - ] - }, - { - "name": "webSocketFrameError", - "description": "Fired when WebSocket message error occurs.", - "parameters": [ + "name": "deviceHeight", + "description": "Device screen height in DIP.", + "type": "number" + }, { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "scrollOffsetX", + "description": "Position of horizontal scroll in CSS pixels.", + "type": "number" }, { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "scrollOffsetY", + "description": "Position of vertical scroll in CSS pixels.", + "type": "number" }, { - "name": "errorMessage", - "description": "WebSocket error message.", - "type": "string" + "name": "timestamp", + "description": "Frame swap timestamp.", + "optional": true, + "$ref": "Network.TimeSinceEpoch" } ] }, { - "name": "webSocketFrameReceived", - "description": "Fired when WebSocket message is received.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" - }, + "id": "DialogType", + "description": "Javascript dialog type.", + "type": "string", + "enum": [ + "alert", + "confirm", + "prompt", + "beforeunload" + ] + }, + { + "id": "AppManifestError", + "description": "Error while paring app manifest.", + "type": "object", + "properties": [ { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "message", + "description": "Error message.", + "type": "string" }, { - "name": "response", - "description": "WebSocket response data.", - "$ref": "WebSocketFrame" - } - ] - }, - { - "name": "webSocketFrameSent", - "description": "Fired when WebSocket message is sent.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "critical", + "description": "If criticial, this is a non-recoverable parse error.", + "type": "integer" }, { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "line", + "description": "Error line.", + "type": "integer" }, { - "name": "response", - "description": "WebSocket response data.", - "$ref": "WebSocketFrame" + "name": "column", + "description": "Error column.", + "type": "integer" } ] }, { - "name": "webSocketHandshakeResponseReceived", - "description": "Fired when WebSocket handshake response becomes available.", - "parameters": [ - { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" - }, - { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" - }, + "id": "AppManifestParsedProperties", + "description": "Parsed app manifest properties.", + "experimental": true, + "type": "object", + "properties": [ { - "name": "response", - "description": "WebSocket response data.", - "$ref": "WebSocketResponse" + "name": "scope", + "description": "Computed scope value", + "type": "string" } ] }, { - "name": "webSocketWillSendHandshakeRequest", - "description": "Fired when WebSocket is about to initiate handshake.", - "parameters": [ + "id": "LayoutViewport", + "description": "Layout viewport position and dimensions.", + "type": "object", + "properties": [ { - "name": "requestId", - "description": "Request identifier.", - "$ref": "RequestId" + "name": "pageX", + "description": "Horizontal offset relative to the document (CSS pixels).", + "type": "integer" }, { - "name": "timestamp", - "description": "Timestamp.", - "$ref": "MonotonicTime" + "name": "pageY", + "description": "Vertical offset relative to the document (CSS pixels).", + "type": "integer" }, { - "name": "wallTime", - "description": "UTC Timestamp.", - "$ref": "TimeSinceEpoch" + "name": "clientWidth", + "description": "Width (CSS pixels), excludes scrollbar if present.", + "type": "integer" }, { - "name": "request", - "description": "WebSocket request data.", - "$ref": "WebSocketRequest" + "name": "clientHeight", + "description": "Height (CSS pixels), excludes scrollbar if present.", + "type": "integer" } ] }, { - "name": "requestWillBeSentExtraInfo", - "description": "Fired when additional information about a requestWillBeSent event is available from the\nnetwork stack. Not every requestWillBeSent event will have an additional\nrequestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent\nor requestWillBeSentExtraInfo will be fired first for the same request.", - "experimental": true, - "parameters": [ + "id": "VisualViewport", + "description": "Visual viewport position, dimensions, and scale.", + "type": "object", + "properties": [ { - "name": "requestId", - "description": "Request identifier. Used to match this information to an existing requestWillBeSent event.", - "$ref": "RequestId" + "name": "offsetX", + "description": "Horizontal offset relative to the layout viewport (CSS pixels).", + "type": "number" }, { - "name": "blockedCookies", - "description": "A list of cookies which will not be sent with this request along with corresponding reasons\nfor blocking.", - "type": "array", - "items": { - "$ref": "BlockedCookieWithReason" - } + "name": "offsetY", + "description": "Vertical offset relative to the layout viewport (CSS pixels).", + "type": "number" }, { - "name": "headers", - "description": "Raw request headers as they will be sent over the wire.", - "$ref": "Headers" - } - ] - }, - { - "name": "responseReceivedExtraInfo", - "description": "Fired when additional information about a responseReceived event is available from the network\nstack. Not every responseReceived event will have an additional responseReceivedExtraInfo for\nit, and responseReceivedExtraInfo may be fired before or after responseReceived.", - "experimental": true, - "parameters": [ + "name": "pageX", + "description": "Horizontal offset relative to the document (CSS pixels).", + "type": "number" + }, { - "name": "requestId", - "description": "Request identifier. Used to match this information to another responseReceived event.", - "$ref": "RequestId" + "name": "pageY", + "description": "Vertical offset relative to the document (CSS pixels).", + "type": "number" }, { - "name": "blockedCookies", - "description": "A list of cookies which were not stored from the response along with the corresponding\nreasons for blocking. The cookies here may not be valid due to syntax errors, which\nare represented by the invalid cookie line string instead of a proper cookie.", - "type": "array", - "items": { - "$ref": "BlockedSetCookieWithReason" - } + "name": "clientWidth", + "description": "Width (CSS pixels), excludes scrollbar if present.", + "type": "number" }, { - "name": "headers", - "description": "Raw response headers as they were received over the wire.", - "$ref": "Headers" + "name": "clientHeight", + "description": "Height (CSS pixels), excludes scrollbar if present.", + "type": "number" }, { - "name": "headersText", - "description": "Raw response header text as it was received over the wire. The raw text may not always be\navailable, such as in the case of HTTP/2 or QUIC.", + "name": "scale", + "description": "Scale relative to the ideal viewport (size at width=device-width).", + "type": "number" + }, + { + "name": "zoom", + "description": "Page zoom factor (CSS to device independent pixels ratio).", "optional": true, - "type": "string" + "type": "number" } ] - } - ] - }, - { - "domain": "Overlay", - "description": "This domain provides various functionality related to drawing atop the inspected page.", - "experimental": true, - "dependencies": [ - "DOM", - "Page", - "Runtime" - ], - "types": [ + }, { - "id": "HighlightConfig", - "description": "Configuration data for the highlighting of page elements.", + "id": "Viewport", + "description": "Viewport for capturing screenshot.", "type": "object", "properties": [ { - "name": "showInfo", - "description": "Whether the node info tooltip should be shown (default: false).", - "optional": true, - "type": "boolean" + "name": "x", + "description": "X offset in device independent pixels (dip).", + "type": "number" }, { - "name": "showStyles", - "description": "Whether the node styles in the tooltip (default: false).", - "optional": true, - "type": "boolean" + "name": "y", + "description": "Y offset in device independent pixels (dip).", + "type": "number" }, { - "name": "showRulers", - "description": "Whether the rulers should be shown (default: false).", - "optional": true, - "type": "boolean" + "name": "width", + "description": "Rectangle width in device independent pixels (dip).", + "type": "number" }, { - "name": "showExtensionLines", - "description": "Whether the extension lines from node to the rulers should be shown (default: false).", - "optional": true, - "type": "boolean" + "name": "height", + "description": "Rectangle height in device independent pixels (dip).", + "type": "number" }, { - "name": "contentColor", - "description": "The content box highlight fill color (default: transparent).", + "name": "scale", + "description": "Page scale factor.", + "type": "number" + } + ] + }, + { + "id": "FontFamilies", + "description": "Generic font families collection.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "standard", + "description": "The standard font-family.", "optional": true, - "$ref": "DOM.RGBA" + "type": "string" }, { - "name": "paddingColor", - "description": "The padding highlight fill color (default: transparent).", + "name": "fixed", + "description": "The fixed font-family.", "optional": true, - "$ref": "DOM.RGBA" + "type": "string" }, { - "name": "borderColor", - "description": "The border highlight fill color (default: transparent).", + "name": "serif", + "description": "The serif font-family.", "optional": true, - "$ref": "DOM.RGBA" + "type": "string" }, { - "name": "marginColor", - "description": "The margin highlight fill color (default: transparent).", + "name": "sansSerif", + "description": "The sansSerif font-family.", "optional": true, - "$ref": "DOM.RGBA" + "type": "string" }, { - "name": "eventTargetColor", - "description": "The event target element highlight fill color (default: transparent).", + "name": "cursive", + "description": "The cursive font-family.", "optional": true, - "$ref": "DOM.RGBA" + "type": "string" }, { - "name": "shapeColor", - "description": "The shape outside fill color (default: transparent).", + "name": "fantasy", + "description": "The fantasy font-family.", "optional": true, - "$ref": "DOM.RGBA" + "type": "string" }, { - "name": "shapeMarginColor", - "description": "The shape margin fill color (default: transparent).", + "name": "pictograph", + "description": "The pictograph font-family.", "optional": true, - "$ref": "DOM.RGBA" + "type": "string" + } + ] + }, + { + "id": "FontSizes", + "description": "Default font sizes.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "standard", + "description": "Default standard font size.", + "optional": true, + "type": "integer" }, { - "name": "cssGridColor", - "description": "The grid layout color (default: transparent).", + "name": "fixed", + "description": "Default fixed font size.", "optional": true, - "$ref": "DOM.RGBA" + "type": "integer" } ] }, { - "id": "InspectMode", + "id": "ClientNavigationReason", + "experimental": true, "type": "string", "enum": [ - "searchForNode", - "searchForUAShadowDOM", - "captureAreaScreenshot", - "showDistances", - "none" + "formSubmissionGet", + "formSubmissionPost", + "httpHeaderRefresh", + "scriptInitiated", + "metaTagRefresh", + "pageBlockInterstitial", + "reload", + "anchorClick" ] - } - ], - "commands": [ - { - "name": "disable", - "description": "Disables domain notifications." }, { - "name": "enable", - "description": "Enables domain notifications." + "id": "ClientNavigationDisposition", + "experimental": true, + "type": "string", + "enum": [ + "currentTab", + "newTab", + "newWindow", + "download" + ] }, { - "name": "getHighlightObjectForTest", - "description": "For testing.", - "parameters": [ - { - "name": "nodeId", - "description": "Id of the node to get highlight object for.", - "$ref": "DOM.NodeId" - }, + "id": "InstallabilityErrorArgument", + "experimental": true, + "type": "object", + "properties": [ { - "name": "includeDistance", - "description": "Whether to include distance info.", - "optional": true, - "type": "boolean" + "name": "name", + "description": "Argument name (e.g. name:'minimum-icon-size-in-pixels').", + "type": "string" }, { - "name": "includeStyle", - "description": "Whether to include style info.", - "optional": true, - "type": "boolean" + "name": "value", + "description": "Argument value (e.g. value:'64').", + "type": "string" } - ], - "returns": [ + ] + }, + { + "id": "InstallabilityError", + "description": "The installability error", + "experimental": true, + "type": "object", + "properties": [ { - "name": "highlight", - "description": "Highlight data for the node.", - "type": "object" + "name": "errorId", + "description": "The error id (e.g. 'manifest-missing-suitable-icon').", + "type": "string" + }, + { + "name": "errorArguments", + "description": "The list of error arguments (e.g. {name:'minimum-icon-size-in-pixels', value:'64'}).", + "type": "array", + "items": { + "$ref": "InstallabilityErrorArgument" + } } ] }, { - "name": "hideHighlight", - "description": "Hides any highlight." + "id": "ReferrerPolicy", + "description": "The referring-policy used for the navigation.", + "experimental": true, + "type": "string", + "enum": [ + "noReferrer", + "noReferrerWhenDowngrade", + "origin", + "originWhenCrossOrigin", + "sameOrigin", + "strictOrigin", + "strictOriginWhenCrossOrigin", + "unsafeUrl" + ] }, { - "name": "highlightFrame", - "description": "Highlights owner element of the frame with given id.", - "parameters": [ - { - "name": "frameId", - "description": "Identifier of the frame to highlight.", - "$ref": "Page.FrameId" - }, + "id": "CompilationCacheParams", + "description": "Per-script compilation cache parameters for `Page.produceCompilationCache`", + "experimental": true, + "type": "object", + "properties": [ { - "name": "contentColor", - "description": "The content box highlight fill color (default: transparent).", - "optional": true, - "$ref": "DOM.RGBA" + "name": "url", + "description": "The URL of the script to produce a compilation cache entry for.", + "type": "string" }, { - "name": "contentOutlineColor", - "description": "The content box highlight outline color (default: transparent).", + "name": "eager", + "description": "A hint to the backend whether eager compilation is recommended.\n(the actual compilation mode used is upon backend discretion).", "optional": true, - "$ref": "DOM.RGBA" + "type": "boolean" } ] }, { - "name": "highlightNode", - "description": "Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or\nobjectId must be specified.", - "parameters": [ + "id": "NavigationType", + "description": "The type of a frameNavigated event.", + "experimental": true, + "type": "string", + "enum": [ + "Navigation", + "BackForwardCacheRestore" + ] + }, + { + "id": "BackForwardCacheNotRestoredReason", + "description": "List of not restored reasons for back-forward cache.", + "experimental": true, + "type": "string", + "enum": [ + "NotMainFrame", + "BackForwardCacheDisabled", + "RelatedActiveContentsExist", + "HTTPStatusNotOK", + "SchemeNotHTTPOrHTTPS", + "Loading", + "WasGrantedMediaAccess", + "DisableForRenderFrameHostCalled", + "DomainNotAllowed", + "HTTPMethodNotGET", + "SubframeIsNavigating", + "Timeout", + "CacheLimit", + "JavaScriptExecution", + "RendererProcessKilled", + "RendererProcessCrashed", + "GrantedMediaStreamAccess", + "SchedulerTrackedFeatureUsed", + "ConflictingBrowsingInstance", + "CacheFlushed", + "ServiceWorkerVersionActivation", + "SessionRestored", + "ServiceWorkerPostMessage", + "EnteredBackForwardCacheBeforeServiceWorkerHostAdded", + "RenderFrameHostReused_SameSite", + "RenderFrameHostReused_CrossSite", + "ServiceWorkerClaim", + "IgnoreEventAndEvict", + "HaveInnerContents", + "TimeoutPuttingInCache", + "BackForwardCacheDisabledByLowMemory", + "BackForwardCacheDisabledByCommandLine", + "NetworkRequestDatapipeDrainedAsBytesConsumer", + "NetworkRequestRedirected", + "NetworkRequestTimeout", + "NetworkExceedsBufferLimit", + "NavigationCancelledWhileRestoring", + "NotMostRecentNavigationEntry", + "BackForwardCacheDisabledForPrerender", + "UserAgentOverrideDiffers", + "ForegroundCacheLimit", + "BrowsingInstanceNotSwapped", + "BackForwardCacheDisabledForDelegate", + "OptInUnloadHeaderNotPresent", + "UnloadHandlerExistsInMainFrame", + "UnloadHandlerExistsInSubFrame", + "ServiceWorkerUnregistration", + "CacheControlNoStore", + "CacheControlNoStoreCookieModified", + "CacheControlNoStoreHTTPOnlyCookieModified", + "NoResponseHead", + "Unknown", + "ActivationNavigationsDisallowedForBug1234857", + "WebSocket", + "WebTransport", + "WebRTC", + "MainResourceHasCacheControlNoStore", + "MainResourceHasCacheControlNoCache", + "SubresourceHasCacheControlNoStore", + "SubresourceHasCacheControlNoCache", + "ContainsPlugins", + "DocumentLoaded", + "DedicatedWorkerOrWorklet", + "OutstandingNetworkRequestOthers", + "OutstandingIndexedDBTransaction", + "RequestedNotificationsPermission", + "RequestedMIDIPermission", + "RequestedAudioCapturePermission", + "RequestedVideoCapturePermission", + "RequestedBackForwardCacheBlockedSensors", + "RequestedBackgroundWorkPermission", + "BroadcastChannel", + "IndexedDBConnection", + "WebXR", + "SharedWorker", + "WebLocks", + "WebHID", + "WebShare", + "RequestedStorageAccessGrant", + "WebNfc", + "OutstandingNetworkRequestFetch", + "OutstandingNetworkRequestXHR", + "AppBanner", + "Printing", + "WebDatabase", + "PictureInPicture", + "Portal", + "SpeechRecognizer", + "IdleManager", + "PaymentManager", + "SpeechSynthesis", + "KeyboardLock", + "WebOTPService", + "OutstandingNetworkRequestDirectSocket", + "InjectedJavascript", + "InjectedStyleSheet", + "Dummy", + "ContentSecurityHandler", + "ContentWebAuthenticationAPI", + "ContentFileChooser", + "ContentSerial", + "ContentFileSystemAccess", + "ContentMediaDevicesDispatcherHost", + "ContentWebBluetooth", + "ContentWebUSB", + "ContentMediaSession", + "ContentMediaSessionService", + "ContentScreenReader", + "EmbedderPopupBlockerTabHelper", + "EmbedderSafeBrowsingTriggeredPopupBlocker", + "EmbedderSafeBrowsingThreatDetails", + "EmbedderAppBannerManager", + "EmbedderDomDistillerViewerSource", + "EmbedderDomDistillerSelfDeletingRequestDelegate", + "EmbedderOomInterventionTabHelper", + "EmbedderOfflinePage", + "EmbedderChromePasswordManagerClientBindCredentialManager", + "EmbedderPermissionRequestManager", + "EmbedderModalDialog", + "EmbedderExtensions", + "EmbedderExtensionMessaging", + "EmbedderExtensionMessagingForOpenPort", + "EmbedderExtensionSentMessageToCachedFrame" + ] + }, + { + "id": "BackForwardCacheNotRestoredReasonType", + "description": "Types of not restored reasons for back-forward cache.", + "experimental": true, + "type": "string", + "enum": [ + "SupportPending", + "PageSupportNeeded", + "Circumstantial" + ] + }, + { + "id": "BackForwardCacheNotRestoredExplanation", + "experimental": true, + "type": "object", + "properties": [ { - "name": "highlightConfig", - "description": "A descriptor for the highlight appearance.", - "$ref": "HighlightConfig" + "name": "type", + "description": "Type of the reason", + "$ref": "BackForwardCacheNotRestoredReasonType" }, { - "name": "nodeId", - "description": "Identifier of the node to highlight.", - "optional": true, - "$ref": "DOM.NodeId" - }, + "name": "reason", + "description": "Not restored reason", + "$ref": "BackForwardCacheNotRestoredReason" + } + ] + }, + { + "id": "BackForwardCacheNotRestoredExplanationTree", + "experimental": true, + "type": "object", + "properties": [ { - "name": "backendNodeId", - "description": "Identifier of the backend node to highlight.", - "optional": true, - "$ref": "DOM.BackendNodeId" + "name": "url", + "description": "URL of each frame", + "type": "string" }, { - "name": "objectId", - "description": "JavaScript object id of the node to be highlighted.", - "optional": true, - "$ref": "Runtime.RemoteObjectId" + "name": "explanations", + "description": "Not restored reasons of each frame", + "type": "array", + "items": { + "$ref": "BackForwardCacheNotRestoredExplanation" + } }, { - "name": "selector", - "description": "Selectors to highlight relevant nodes.", - "optional": true, + "name": "children", + "description": "Array of children frame", + "type": "array", + "items": { + "$ref": "BackForwardCacheNotRestoredExplanationTree" + } + } + ] + } + ], + "commands": [ + { + "name": "addScriptToEvaluateOnLoad", + "description": "Deprecated, please use addScriptToEvaluateOnNewDocument instead.", + "experimental": true, + "deprecated": true, + "parameters": [ + { + "name": "scriptSource", "type": "string" } + ], + "returns": [ + { + "name": "identifier", + "description": "Identifier of the added script.", + "$ref": "ScriptIdentifier" + } ] }, { - "name": "highlightQuad", - "description": "Highlights given quad. Coordinates are absolute with respect to the main frame viewport.", + "name": "addScriptToEvaluateOnNewDocument", + "description": "Evaluates given script in every frame upon creation (before loading frame's scripts).", "parameters": [ { - "name": "quad", - "description": "Quad to highlight", - "$ref": "DOM.Quad" + "name": "source", + "type": "string" }, { - "name": "color", - "description": "The highlight fill color (default: transparent).", + "name": "worldName", + "description": "If specified, creates an isolated world with the given name and evaluates given script in it.\nThis world name will be used as the ExecutionContextDescription::name when the corresponding\nevent is emitted.", + "experimental": true, "optional": true, - "$ref": "DOM.RGBA" + "type": "string" }, { - "name": "outlineColor", - "description": "The highlight outline color (default: transparent).", + "name": "includeCommandLineAPI", + "description": "Specifies whether command line API should be available to the script, defaults\nto false.", + "experimental": true, "optional": true, - "$ref": "DOM.RGBA" + "type": "boolean" + } + ], + "returns": [ + { + "name": "identifier", + "description": "Identifier of the added script.", + "$ref": "ScriptIdentifier" } ] }, { - "name": "highlightRect", - "description": "Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.", + "name": "bringToFront", + "description": "Brings page to front (activates tab)." + }, + { + "name": "captureScreenshot", + "description": "Capture page screenshot.", "parameters": [ { - "name": "x", - "description": "X coordinate", - "type": "integer" - }, - { - "name": "y", - "description": "Y coordinate", - "type": "integer" - }, - { - "name": "width", - "description": "Rectangle width", - "type": "integer" + "name": "format", + "description": "Image compression format (defaults to png).", + "optional": true, + "type": "string", + "enum": [ + "jpeg", + "png", + "webp" + ] }, { - "name": "height", - "description": "Rectangle height", + "name": "quality", + "description": "Compression quality from range [0..100] (jpeg only).", + "optional": true, "type": "integer" }, { - "name": "color", - "description": "The highlight fill color (default: transparent).", + "name": "clip", + "description": "Capture the screenshot of a given region only.", "optional": true, - "$ref": "DOM.RGBA" + "$ref": "Viewport" }, { - "name": "outlineColor", - "description": "The highlight outline color (default: transparent).", + "name": "fromSurface", + "description": "Capture the screenshot from the surface, rather than the view. Defaults to true.", + "experimental": true, "optional": true, - "$ref": "DOM.RGBA" - } - ] - }, - { - "name": "setInspectMode", - "description": "Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted.\nBackend then generates 'inspectNodeRequested' event upon element selection.", - "parameters": [ - { - "name": "mode", - "description": "Set an inspection mode.", - "$ref": "InspectMode" + "type": "boolean" }, { - "name": "highlightConfig", - "description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if `enabled\n== false`.", + "name": "captureBeyondViewport", + "description": "Capture the screenshot beyond the viewport. Defaults to false.", + "experimental": true, "optional": true, - "$ref": "HighlightConfig" - } - ] - }, - { - "name": "setShowAdHighlights", - "description": "Highlights owner element of all frames detected to be ads.", - "parameters": [ - { - "name": "show", - "description": "True for showing ad highlights", "type": "boolean" } - ] - }, - { - "name": "setPausedInDebuggerMessage", - "parameters": [ + ], + "returns": [ { - "name": "message", - "description": "The message to display, also triggers resume and step over controls.", - "optional": true, + "name": "data", + "description": "Base64-encoded image data. (Encoded as a base64 string when passed over JSON)", "type": "string" } ] }, { - "name": "setShowDebugBorders", - "description": "Requests that backend shows debug borders on layers", + "name": "captureSnapshot", + "description": "Returns a snapshot of the page as a string. For MHTML format, the serialization includes\niframes, shadow DOM, external resources, and element-inline styles.", + "experimental": true, "parameters": [ { - "name": "show", - "description": "True for showing debug borders", - "type": "boolean" + "name": "format", + "description": "Format (defaults to mhtml).", + "optional": true, + "type": "string", + "enum": [ + "mhtml" + ] } - ] - }, - { - "name": "setShowFPSCounter", - "description": "Requests that backend shows the FPS counter", - "parameters": [ + ], + "returns": [ { - "name": "show", - "description": "True for showing the FPS counter", - "type": "boolean" + "name": "data", + "description": "Serialized page data.", + "type": "string" } ] }, { - "name": "setShowPaintRects", - "description": "Requests that backend shows paint rectangles", - "parameters": [ - { - "name": "result", - "description": "True for showing paint rectangles", - "type": "boolean" - } - ] + "name": "clearDeviceMetricsOverride", + "description": "Clears the overridden device metrics.", + "experimental": true, + "deprecated": true, + "redirect": "Emulation" }, { - "name": "setShowLayoutShiftRegions", - "description": "Requests that backend shows layout shift regions", - "parameters": [ - { - "name": "result", - "description": "True for showing layout shift regions", - "type": "boolean" - } - ] + "name": "clearDeviceOrientationOverride", + "description": "Clears the overridden Device Orientation.", + "experimental": true, + "deprecated": true, + "redirect": "DeviceOrientation" }, { - "name": "setShowScrollBottleneckRects", - "description": "Requests that backend shows scroll bottleneck rects", - "parameters": [ - { - "name": "show", - "description": "True for showing scroll bottleneck rects", - "type": "boolean" - } - ] + "name": "clearGeolocationOverride", + "description": "Clears the overridden Geolocation Position and Error.", + "deprecated": true, + "redirect": "Emulation" }, { - "name": "setShowHitTestBorders", - "description": "Requests that backend shows hit-test borders on layers", + "name": "createIsolatedWorld", + "description": "Creates an isolated world for the given frame.", "parameters": [ { - "name": "show", - "description": "True for showing hit-test borders", - "type": "boolean" - } - ] - }, - { - "name": "setShowViewportSizeOnResize", - "description": "Paints viewport size upon main frame resize.", - "parameters": [ + "name": "frameId", + "description": "Id of the frame in which the isolated world should be created.", + "$ref": "FrameId" + }, { - "name": "show", - "description": "Whether to paint size or not.", + "name": "worldName", + "description": "An optional name which is reported in the Execution Context.", + "optional": true, + "type": "string" + }, + { + "name": "grantUniveralAccess", + "description": "Whether or not universal access should be granted to the isolated world. This is a powerful\noption, use with caution.", + "optional": true, "type": "boolean" } - ] - } - ], - "events": [ - { - "name": "inspectNodeRequested", - "description": "Fired when the node should be inspected. This happens after call to `setInspectMode` or when\nuser manually inspects an element.", - "parameters": [ + ], + "returns": [ { - "name": "backendNodeId", - "description": "Id of the node to inspect.", - "$ref": "DOM.BackendNodeId" + "name": "executionContextId", + "description": "Execution context of the isolated world.", + "$ref": "Runtime.ExecutionContextId" } ] }, { - "name": "nodeHighlightRequested", - "description": "Fired when the node should be highlighted. This happens after call to `setInspectMode`.", + "name": "deleteCookie", + "description": "Deletes browser cookie with given name, domain and path.", + "experimental": true, + "deprecated": true, + "redirect": "Network", "parameters": [ { - "name": "nodeId", - "$ref": "DOM.NodeId" - } - ] - }, - { - "name": "screenshotRequested", - "description": "Fired when user asks to capture screenshot of some area on the page.", - "parameters": [ + "name": "cookieName", + "description": "Name of the cookie to remove.", + "type": "string" + }, { - "name": "viewport", - "description": "Viewport to capture, in device independent pixels (dip).", - "$ref": "Page.Viewport" + "name": "url", + "description": "URL to match cooke domain and path.", + "type": "string" } ] }, { - "name": "inspectModeCanceled", - "description": "Fired when user cancels the inspect mode." - } - ] - }, - { - "domain": "Page", - "description": "Actions and events related to the inspected page belong to the page domain.", - "dependencies": [ - "Debugger", - "DOM", - "IO", - "Network", - "Runtime" - ], - "types": [ + "name": "disable", + "description": "Disables page domain notifications." + }, { - "id": "FrameId", - "description": "Unique frame identifier.", - "type": "string" + "name": "enable", + "description": "Enables page domain notifications." }, { - "id": "Frame", - "description": "Information about the Frame on the page.", - "type": "object", - "properties": [ - { - "name": "id", - "description": "Frame unique identifier.", - "type": "string" - }, + "name": "getAppManifest", + "returns": [ { - "name": "parentId", - "description": "Parent frame identifier.", - "optional": true, + "name": "url", + "description": "Manifest location.", "type": "string" }, { - "name": "loaderId", - "description": "Identifier of the loader associated with this frame.", - "$ref": "Network.LoaderId" + "name": "errors", + "type": "array", + "items": { + "$ref": "AppManifestError" + } }, { - "name": "name", - "description": "Frame's name as specified in the tag.", + "name": "data", + "description": "Manifest content.", "optional": true, "type": "string" }, { - "name": "url", - "description": "Frame document's URL without fragment.", - "type": "string" - }, - { - "name": "urlFragment", - "description": "Frame document's URL fragment including the '#'.", + "name": "parsed", + "description": "Parsed manifest properties", "experimental": true, "optional": true, - "type": "string" - }, + "$ref": "AppManifestParsedProperties" + } + ] + }, + { + "name": "getInstallabilityErrors", + "experimental": true, + "returns": [ { - "name": "securityOrigin", - "description": "Frame document's security origin.", + "name": "installabilityErrors", + "type": "array", + "items": { + "$ref": "InstallabilityError" + } + } + ] + }, + { + "name": "getManifestIcons", + "experimental": true, + "returns": [ + { + "name": "primaryIcon", + "optional": true, "type": "string" - }, + } + ] + }, + { + "name": "getAppId", + "description": "Returns the unique (PWA) app id.\nOnly returns values if the feature flag 'WebAppEnableManifestId' is enabled", + "experimental": true, + "returns": [ { - "name": "mimeType", - "description": "Frame document's mimeType as determined by the browser.", + "name": "appId", + "description": "App id, either from manifest's id attribute or computed from start_url", + "optional": true, "type": "string" }, { - "name": "unreachableUrl", - "description": "If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment.", - "experimental": true, + "name": "recommendedId", + "description": "Recommendation for manifest's id attribute to match current id computed from start_url", "optional": true, "type": "string" } ] }, { - "id": "FrameResource", - "description": "Information about the Resource on the page.", + "name": "getCookies", + "description": "Returns all browser cookies. Depending on the backend support, will return detailed cookie\ninformation in the `cookies` field.", "experimental": true, - "type": "object", - "properties": [ + "deprecated": true, + "redirect": "Network", + "returns": [ { - "name": "url", - "description": "Resource URL.", - "type": "string" - }, + "name": "cookies", + "description": "Array of cookie objects.", + "type": "array", + "items": { + "$ref": "Network.Cookie" + } + } + ] + }, + { + "name": "getFrameTree", + "description": "Returns present frame tree structure.", + "returns": [ { - "name": "type", - "description": "Type of this resource.", - "$ref": "Network.ResourceType" - }, + "name": "frameTree", + "description": "Present frame tree structure.", + "$ref": "FrameTree" + } + ] + }, + { + "name": "getLayoutMetrics", + "description": "Returns metrics relating to the layouting of the page, such as viewport bounds/scale.", + "returns": [ { - "name": "mimeType", - "description": "Resource mimeType as determined by the browser.", - "type": "string" + "name": "layoutViewport", + "description": "Deprecated metrics relating to the layout viewport. Can be in DP or in CSS pixels depending on the `enable-use-zoom-for-dsf` flag. Use `cssLayoutViewport` instead.", + "deprecated": true, + "$ref": "LayoutViewport" }, { - "name": "lastModified", - "description": "last-modified timestamp as reported by server.", - "optional": true, - "$ref": "Network.TimeSinceEpoch" + "name": "visualViewport", + "description": "Deprecated metrics relating to the visual viewport. Can be in DP or in CSS pixels depending on the `enable-use-zoom-for-dsf` flag. Use `cssVisualViewport` instead.", + "deprecated": true, + "$ref": "VisualViewport" }, { "name": "contentSize", - "description": "Resource content size.", - "optional": true, - "type": "number" - }, - { - "name": "failed", - "description": "True if the resource failed to load.", - "optional": true, - "type": "boolean" + "description": "Deprecated size of scrollable area. Can be in DP or in CSS pixels depending on the `enable-use-zoom-for-dsf` flag. Use `cssContentSize` instead.", + "deprecated": true, + "$ref": "DOM.Rect" }, { - "name": "canceled", - "description": "True if the resource was canceled during loading.", - "optional": true, - "type": "boolean" - } - ] - }, - { - "id": "FrameResourceTree", - "description": "Information about the Frame hierarchy along with their cached resources.", - "experimental": true, - "type": "object", - "properties": [ - { - "name": "frame", - "description": "Frame information for this tree item.", - "$ref": "Frame" + "name": "cssLayoutViewport", + "description": "Metrics relating to the layout viewport in CSS pixels.", + "$ref": "LayoutViewport" }, { - "name": "childFrames", - "description": "Child frames.", - "optional": true, - "type": "array", - "items": { - "$ref": "FrameResourceTree" - } + "name": "cssVisualViewport", + "description": "Metrics relating to the visual viewport in CSS pixels.", + "$ref": "VisualViewport" }, { - "name": "resources", - "description": "Information about frame resources.", - "type": "array", - "items": { - "$ref": "FrameResource" - } + "name": "cssContentSize", + "description": "Size of scrollable area in CSS pixels.", + "$ref": "DOM.Rect" } ] }, { - "id": "FrameTree", - "description": "Information about the Frame hierarchy.", - "type": "object", - "properties": [ + "name": "getNavigationHistory", + "description": "Returns navigation history for the current page.", + "returns": [ { - "name": "frame", - "description": "Frame information for this tree item.", - "$ref": "Frame" + "name": "currentIndex", + "description": "Index of the current navigation history entry.", + "type": "integer" }, { - "name": "childFrames", - "description": "Child frames.", - "optional": true, + "name": "entries", + "description": "Array of navigation history entries.", "type": "array", "items": { - "$ref": "FrameTree" + "$ref": "NavigationEntry" } } ] }, { - "id": "ScriptIdentifier", - "description": "Unique script identifier.", - "type": "string" - }, - { - "id": "TransitionType", - "description": "Transition type.", - "type": "string", - "enum": [ - "link", - "typed", - "address_bar", - "auto_bookmark", - "auto_subframe", - "manual_subframe", - "generated", - "auto_toplevel", - "form_submit", - "reload", - "keyword", - "keyword_generated", - "other" - ] + "name": "resetNavigationHistory", + "description": "Resets navigation history for the current page." }, { - "id": "NavigationEntry", - "description": "Navigation history entry.", - "type": "object", - "properties": [ + "name": "getResourceContent", + "description": "Returns content of the given resource.", + "experimental": true, + "parameters": [ { - "name": "id", - "description": "Unique id of the navigation history entry.", - "type": "integer" + "name": "frameId", + "description": "Frame id to get resource for.", + "$ref": "FrameId" }, { "name": "url", - "description": "URL of the navigation history entry.", + "description": "URL of the resource to get content for.", "type": "string" - }, + } + ], + "returns": [ { - "name": "userTypedURL", - "description": "URL that the user typed in the url bar.", + "name": "content", + "description": "Resource content.", "type": "string" }, { - "name": "title", - "description": "Title of the navigation history entry.", - "type": "string" + "name": "base64Encoded", + "description": "True, if content was served as base64.", + "type": "boolean" + } + ] + }, + { + "name": "getResourceTree", + "description": "Returns present frame / resource tree structure.", + "experimental": true, + "returns": [ + { + "name": "frameTree", + "description": "Present frame / resource tree structure.", + "$ref": "FrameResourceTree" + } + ] + }, + { + "name": "handleJavaScriptDialog", + "description": "Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).", + "parameters": [ + { + "name": "accept", + "description": "Whether to accept or dismiss the dialog.", + "type": "boolean" }, { - "name": "transitionType", - "description": "Transition type.", - "$ref": "TransitionType" + "name": "promptText", + "description": "The text to enter into the dialog prompt before accepting. Used only if this is a prompt\ndialog.", + "optional": true, + "type": "string" } ] }, { - "id": "ScreencastFrameMetadata", - "description": "Screencast frame metadata.", - "experimental": true, - "type": "object", - "properties": [ + "name": "navigate", + "description": "Navigates current page to the given URL.", + "parameters": [ { - "name": "offsetTop", - "description": "Top offset in DIP.", - "type": "number" + "name": "url", + "description": "URL to navigate the page to.", + "type": "string" + }, + { + "name": "referrer", + "description": "Referrer URL.", + "optional": true, + "type": "string" }, { - "name": "pageScaleFactor", - "description": "Page scale factor.", - "type": "number" + "name": "transitionType", + "description": "Intended transition type.", + "optional": true, + "$ref": "TransitionType" }, { - "name": "deviceWidth", - "description": "Device screen width in DIP.", - "type": "number" + "name": "frameId", + "description": "Frame id to navigate, if not specified navigates the top frame.", + "optional": true, + "$ref": "FrameId" }, { - "name": "deviceHeight", - "description": "Device screen height in DIP.", - "type": "number" - }, + "name": "referrerPolicy", + "description": "Referrer-policy used for the navigation.", + "experimental": true, + "optional": true, + "$ref": "ReferrerPolicy" + } + ], + "returns": [ { - "name": "scrollOffsetX", - "description": "Position of horizontal scroll in CSS pixels.", - "type": "number" + "name": "frameId", + "description": "Frame id that has navigated (or failed to navigate)", + "$ref": "FrameId" }, { - "name": "scrollOffsetY", - "description": "Position of vertical scroll in CSS pixels.", - "type": "number" + "name": "loaderId", + "description": "Loader identifier.", + "optional": true, + "$ref": "Network.LoaderId" }, { - "name": "timestamp", - "description": "Frame swap timestamp.", + "name": "errorText", + "description": "User friendly error message, present if and only if navigation has failed.", "optional": true, - "$ref": "Network.TimeSinceEpoch" + "type": "string" } ] }, { - "id": "DialogType", - "description": "Javascript dialog type.", - "type": "string", - "enum": [ - "alert", - "confirm", - "prompt", - "beforeunload" - ] - }, - { - "id": "AppManifestError", - "description": "Error while paring app manifest.", - "type": "object", - "properties": [ - { - "name": "message", - "description": "Error message.", - "type": "string" - }, - { - "name": "critical", - "description": "If criticial, this is a non-recoverable parse error.", - "type": "integer" - }, - { - "name": "line", - "description": "Error line.", - "type": "integer" - }, + "name": "navigateToHistoryEntry", + "description": "Navigates current page to the given history entry.", + "parameters": [ { - "name": "column", - "description": "Error column.", + "name": "entryId", + "description": "Unique id of the entry to navigate to.", "type": "integer" } ] }, { - "id": "LayoutViewport", - "description": "Layout viewport position and dimensions.", - "type": "object", - "properties": [ + "name": "printToPDF", + "description": "Print page as PDF.", + "parameters": [ { - "name": "pageX", - "description": "Horizontal offset relative to the document (CSS pixels).", - "type": "integer" + "name": "landscape", + "description": "Paper orientation. Defaults to false.", + "optional": true, + "type": "boolean" }, { - "name": "pageY", - "description": "Vertical offset relative to the document (CSS pixels).", - "type": "integer" + "name": "displayHeaderFooter", + "description": "Display header and footer. Defaults to false.", + "optional": true, + "type": "boolean" }, { - "name": "clientWidth", - "description": "Width (CSS pixels), excludes scrollbar if present.", - "type": "integer" + "name": "printBackground", + "description": "Print background graphics. Defaults to false.", + "optional": true, + "type": "boolean" }, { - "name": "clientHeight", - "description": "Height (CSS pixels), excludes scrollbar if present.", - "type": "integer" - } - ] - }, - { - "id": "VisualViewport", - "description": "Visual viewport position, dimensions, and scale.", - "type": "object", - "properties": [ - { - "name": "offsetX", - "description": "Horizontal offset relative to the layout viewport (CSS pixels).", + "name": "scale", + "description": "Scale of the webpage rendering. Defaults to 1.", + "optional": true, "type": "number" }, { - "name": "offsetY", - "description": "Vertical offset relative to the layout viewport (CSS pixels).", + "name": "paperWidth", + "description": "Paper width in inches. Defaults to 8.5 inches.", + "optional": true, "type": "number" }, { - "name": "pageX", - "description": "Horizontal offset relative to the document (CSS pixels).", + "name": "paperHeight", + "description": "Paper height in inches. Defaults to 11 inches.", + "optional": true, "type": "number" }, { - "name": "pageY", - "description": "Vertical offset relative to the document (CSS pixels).", + "name": "marginTop", + "description": "Top margin in inches. Defaults to 1cm (~0.4 inches).", + "optional": true, "type": "number" }, { - "name": "clientWidth", - "description": "Width (CSS pixels), excludes scrollbar if present.", + "name": "marginBottom", + "description": "Bottom margin in inches. Defaults to 1cm (~0.4 inches).", + "optional": true, "type": "number" }, { - "name": "clientHeight", - "description": "Height (CSS pixels), excludes scrollbar if present.", + "name": "marginLeft", + "description": "Left margin in inches. Defaults to 1cm (~0.4 inches).", + "optional": true, "type": "number" }, { - "name": "scale", - "description": "Scale relative to the ideal viewport (size at width=device-width).", + "name": "marginRight", + "description": "Right margin in inches. Defaults to 1cm (~0.4 inches).", + "optional": true, "type": "number" }, { - "name": "zoom", - "description": "Page zoom factor (CSS to device independent pixels ratio).", + "name": "pageRanges", + "description": "Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means\nprint all pages.", "optional": true, - "type": "number" - } - ] - }, - { - "id": "Viewport", - "description": "Viewport for capturing screenshot.", - "type": "object", - "properties": [ + "type": "string" + }, { - "name": "x", - "description": "X offset in device independent pixels (dip).", - "type": "number" + "name": "ignoreInvalidPageRanges", + "description": "Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'.\nDefaults to false.", + "optional": true, + "type": "boolean" }, { - "name": "y", - "description": "Y offset in device independent pixels (dip).", - "type": "number" + "name": "headerTemplate", + "description": "HTML template for the print header. Should be valid HTML markup with following\nclasses used to inject printing values into them:\n- `date`: formatted print date\n- `title`: document title\n- `url`: document location\n- `pageNumber`: current page number\n- `totalPages`: total pages in the document\n\nFor example, `` would generate span containing the title.", + "optional": true, + "type": "string" }, { - "name": "width", - "description": "Rectangle width in device independent pixels (dip).", - "type": "number" + "name": "footerTemplate", + "description": "HTML template for the print footer. Should use the same format as the `headerTemplate`.", + "optional": true, + "type": "string" }, { - "name": "height", - "description": "Rectangle height in device independent pixels (dip).", - "type": "number" + "name": "preferCSSPageSize", + "description": "Whether or not to prefer page size as defined by css. Defaults to false,\nin which case the content will be scaled to fit the paper size.", + "optional": true, + "type": "boolean" + }, + { + "name": "transferMode", + "description": "return as stream", + "experimental": true, + "optional": true, + "type": "string", + "enum": [ + "ReturnAsBase64", + "ReturnAsStream" + ] + } + ], + "returns": [ + { + "name": "data", + "description": "Base64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON)", + "type": "string" + }, + { + "name": "stream", + "description": "A handle of the stream that holds resulting PDF data.", + "experimental": true, + "optional": true, + "$ref": "IO.StreamHandle" + } + ] + }, + { + "name": "reload", + "description": "Reloads given page optionally ignoring the cache.", + "parameters": [ + { + "name": "ignoreCache", + "description": "If true, browser cache is ignored (as if the user pressed Shift+refresh).", + "optional": true, + "type": "boolean" }, { - "name": "scale", - "description": "Page scale factor.", - "type": "number" + "name": "scriptToEvaluateOnLoad", + "description": "If set, the script will be injected into all frames of the inspected page after reload.\nArgument will be ignored if reloading dataURL origin.", + "optional": true, + "type": "string" + } + ] + }, + { + "name": "removeScriptToEvaluateOnLoad", + "description": "Deprecated, please use removeScriptToEvaluateOnNewDocument instead.", + "experimental": true, + "deprecated": true, + "parameters": [ + { + "name": "identifier", + "$ref": "ScriptIdentifier" + } + ] + }, + { + "name": "removeScriptToEvaluateOnNewDocument", + "description": "Removes given script from the list.", + "parameters": [ + { + "name": "identifier", + "$ref": "ScriptIdentifier" } ] }, { - "id": "FontFamilies", - "description": "Generic font families collection.", + "name": "screencastFrameAck", + "description": "Acknowledges that a screencast frame has been received by the frontend.", "experimental": true, - "type": "object", - "properties": [ + "parameters": [ { - "name": "standard", - "description": "The standard font-family.", - "optional": true, - "type": "string" - }, + "name": "sessionId", + "description": "Frame number.", + "type": "integer" + } + ] + }, + { + "name": "searchInResource", + "description": "Searches for given string in resource content.", + "experimental": true, + "parameters": [ { - "name": "fixed", - "description": "The fixed font-family.", - "optional": true, - "type": "string" + "name": "frameId", + "description": "Frame id for resource to search in.", + "$ref": "FrameId" }, { - "name": "serif", - "description": "The serif font-family.", - "optional": true, + "name": "url", + "description": "URL of the resource to search in.", "type": "string" }, { - "name": "sansSerif", - "description": "The sansSerif font-family.", - "optional": true, + "name": "query", + "description": "String to search for.", "type": "string" }, { - "name": "cursive", - "description": "The cursive font-family.", + "name": "caseSensitive", + "description": "If true, search is case sensitive.", "optional": true, - "type": "string" + "type": "boolean" }, { - "name": "fantasy", - "description": "The fantasy font-family.", + "name": "isRegex", + "description": "If true, treats string parameter as regex.", "optional": true, - "type": "string" - }, + "type": "boolean" + } + ], + "returns": [ { - "name": "pictograph", - "description": "The pictograph font-family.", - "optional": true, - "type": "string" + "name": "result", + "description": "List of search matches.", + "type": "array", + "items": { + "$ref": "Debugger.SearchMatch" + } } ] }, { - "id": "FontSizes", - "description": "Default font sizes.", + "name": "setAdBlockingEnabled", + "description": "Enable Chrome's experimental ad filter on all sites.", "experimental": true, - "type": "object", - "properties": [ - { - "name": "standard", - "description": "Default standard font size.", - "optional": true, - "type": "integer" - }, + "parameters": [ { - "name": "fixed", - "description": "Default fixed font size.", - "optional": true, - "type": "integer" + "name": "enabled", + "description": "Whether to block ads.", + "type": "boolean" } ] }, { - "id": "ClientNavigationReason", + "name": "setBypassCSP", + "description": "Enable page Content Security Policy by-passing.", "experimental": true, - "type": "string", - "enum": [ - "formSubmissionGet", - "formSubmissionPost", - "httpHeaderRefresh", - "scriptInitiated", - "metaTagRefresh", - "pageBlockInterstitial", - "reload" + "parameters": [ + { + "name": "enabled", + "description": "Whether to bypass page CSP.", + "type": "boolean" + } ] - } - ], - "commands": [ + }, { - "name": "addScriptToEvaluateOnLoad", - "description": "Deprecated, please use addScriptToEvaluateOnNewDocument instead.", + "name": "getPermissionsPolicyState", + "description": "Get Permissions Policy state on given frame.", "experimental": true, - "deprecated": true, "parameters": [ { - "name": "scriptSource", - "type": "string" + "name": "frameId", + "$ref": "FrameId" } ], "returns": [ { - "name": "identifier", - "description": "Identifier of the added script.", - "$ref": "ScriptIdentifier" + "name": "states", + "type": "array", + "items": { + "$ref": "PermissionsPolicyFeatureState" + } } ] }, { - "name": "addScriptToEvaluateOnNewDocument", - "description": "Evaluates given script in every frame upon creation (before loading frame's scripts).", + "name": "getOriginTrials", + "description": "Get Origin Trials on given frame.", + "experimental": true, "parameters": [ { - "name": "source", - "type": "string" - }, - { - "name": "worldName", - "description": "If specified, creates an isolated world with the given name and evaluates given script in it.\nThis world name will be used as the ExecutionContextDescription::name when the corresponding\nevent is emitted.", - "experimental": true, - "optional": true, - "type": "string" + "name": "frameId", + "$ref": "FrameId" } ], "returns": [ { - "name": "identifier", - "description": "Identifier of the added script.", - "$ref": "ScriptIdentifier" + "name": "originTrials", + "type": "array", + "items": { + "$ref": "OriginTrial" + } } ] }, { - "name": "bringToFront", - "description": "Brings page to front (activates tab)." - }, - { - "name": "captureScreenshot", - "description": "Capture page screenshot.", + "name": "setDeviceMetricsOverride", + "description": "Overrides the values of device screen dimensions (window.screen.width, window.screen.height,\nwindow.innerWidth, window.innerHeight, and \"device-width\"/\"device-height\"-related CSS media\nquery results).", + "experimental": true, + "deprecated": true, + "redirect": "Emulation", "parameters": [ { - "name": "format", - "description": "Image compression format (defaults to png).", + "name": "width", + "description": "Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.", + "type": "integer" + }, + { + "name": "height", + "description": "Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.", + "type": "integer" + }, + { + "name": "deviceScaleFactor", + "description": "Overriding device scale factor value. 0 disables the override.", + "type": "number" + }, + { + "name": "mobile", + "description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text\nautosizing and more.", + "type": "boolean" + }, + { + "name": "scale", + "description": "Scale to apply to resulting view image.", "optional": true, - "type": "string", - "enum": [ - "jpeg", - "png" - ] + "type": "number" }, { - "name": "quality", - "description": "Compression quality from range [0..100] (jpeg only).", + "name": "screenWidth", + "description": "Overriding screen width value in pixels (minimum 0, maximum 10000000).", "optional": true, "type": "integer" }, { - "name": "clip", - "description": "Capture the screenshot of a given region only.", + "name": "screenHeight", + "description": "Overriding screen height value in pixels (minimum 0, maximum 10000000).", "optional": true, - "$ref": "Viewport" + "type": "integer" }, { - "name": "fromSurface", - "description": "Capture the screenshot from the surface, rather than the view. Defaults to true.", - "experimental": true, + "name": "positionX", + "description": "Overriding view X position on screen in pixels (minimum 0, maximum 10000000).", + "optional": true, + "type": "integer" + }, + { + "name": "positionY", + "description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).", + "optional": true, + "type": "integer" + }, + { + "name": "dontSetVisibleSize", + "description": "Do not set visible view size, rely upon explicit setVisibleSize call.", "optional": true, "type": "boolean" - } - ], - "returns": [ + }, { - "name": "data", - "description": "Base64-encoded image data.", - "type": "string" + "name": "screenOrientation", + "description": "Screen orientation override.", + "optional": true, + "$ref": "Emulation.ScreenOrientation" + }, + { + "name": "viewport", + "description": "The viewport dimensions and scale. If not set, the override is cleared.", + "optional": true, + "$ref": "Viewport" } ] }, { - "name": "captureSnapshot", - "description": "Returns a snapshot of the page as a string. For MHTML format, the serialization includes\niframes, shadow DOM, external resources, and element-inline styles.", + "name": "setDeviceOrientationOverride", + "description": "Overrides the Device Orientation.", "experimental": true, + "deprecated": true, + "redirect": "DeviceOrientation", "parameters": [ { - "name": "format", - "description": "Format (defaults to mhtml).", - "optional": true, - "type": "string", - "enum": [ - "mhtml" - ] - } - ], - "returns": [ + "name": "alpha", + "description": "Mock alpha", + "type": "number" + }, + { + "name": "beta", + "description": "Mock beta", + "type": "number" + }, { - "name": "data", - "description": "Serialized page data.", - "type": "string" + "name": "gamma", + "description": "Mock gamma", + "type": "number" } ] }, { - "name": "clearDeviceMetricsOverride", - "description": "Clears the overriden device metrics.", + "name": "setFontFamilies", + "description": "Set generic font families.", "experimental": true, - "deprecated": true, - "redirect": "Emulation" + "parameters": [ + { + "name": "fontFamilies", + "description": "Specifies font families to set. If a font family is not specified, it won't be changed.", + "$ref": "FontFamilies" + } + ] }, { - "name": "clearDeviceOrientationOverride", - "description": "Clears the overridden Device Orientation.", + "name": "setFontSizes", + "description": "Set default font sizes.", "experimental": true, - "deprecated": true, - "redirect": "DeviceOrientation" - }, - { - "name": "clearGeolocationOverride", - "description": "Clears the overriden Geolocation Position and Error.", - "deprecated": true, - "redirect": "Emulation" + "parameters": [ + { + "name": "fontSizes", + "description": "Specifies font sizes to set. If a font size is not specified, it won't be changed.", + "$ref": "FontSizes" + } + ] }, { - "name": "createIsolatedWorld", - "description": "Creates an isolated world for the given frame.", + "name": "setDocumentContent", + "description": "Sets given markup as the document's HTML.", "parameters": [ { "name": "frameId", - "description": "Id of the frame in which the isolated world should be created.", + "description": "Frame id to set HTML for.", "$ref": "FrameId" }, { - "name": "worldName", - "description": "An optional name which is reported in the Execution Context.", - "optional": true, + "name": "html", + "description": "HTML content to set.", "type": "string" - }, - { - "name": "grantUniveralAccess", - "description": "Whether or not universal access should be granted to the isolated world. This is a powerful\noption, use with caution.", - "optional": true, - "type": "boolean" - } - ], - "returns": [ - { - "name": "executionContextId", - "description": "Execution context of the isolated world.", - "$ref": "Runtime.ExecutionContextId" } ] }, { - "name": "deleteCookie", - "description": "Deletes browser cookie with given name, domain and path.", + "name": "setDownloadBehavior", + "description": "Set the behavior when downloading a file.", "experimental": true, "deprecated": true, - "redirect": "Network", "parameters": [ { - "name": "cookieName", - "description": "Name of the cookie to remove.", - "type": "string" + "name": "behavior", + "description": "Whether to allow all or deny all download requests, or use default Chrome behavior if\navailable (otherwise deny).", + "type": "string", + "enum": [ + "deny", + "allow", + "default" + ] }, { - "name": "url", - "description": "URL to match cooke domain and path.", + "name": "downloadPath", + "description": "The default path to save downloaded files to. This is required if behavior is set to 'allow'", + "optional": true, "type": "string" } ] }, { - "name": "disable", - "description": "Disables page domain notifications." - }, - { - "name": "enable", - "description": "Enables page domain notifications." - }, - { - "name": "getAppManifest", - "returns": [ + "name": "setGeolocationOverride", + "description": "Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position\nunavailable.", + "deprecated": true, + "redirect": "Emulation", + "parameters": [ { - "name": "url", - "description": "Manifest location.", - "type": "string" + "name": "latitude", + "description": "Mock latitude", + "optional": true, + "type": "number" }, { - "name": "errors", - "type": "array", - "items": { - "$ref": "AppManifestError" - } + "name": "longitude", + "description": "Mock longitude", + "optional": true, + "type": "number" }, { - "name": "data", - "description": "Manifest content.", + "name": "accuracy", + "description": "Mock accuracy", "optional": true, - "type": "string" + "type": "number" } ] }, { - "name": "getInstallabilityErrors", + "name": "setLifecycleEventsEnabled", + "description": "Controls whether page will emit lifecycle events.", "experimental": true, - "returns": [ + "parameters": [ { - "name": "errors", - "type": "array", - "items": { - "type": "string" - } + "name": "enabled", + "description": "If true, starts emitting lifecycle events.", + "type": "boolean" } ] }, { - "name": "getCookies", - "description": "Returns all browser cookies. Depending on the backend support, will return detailed cookie\ninformation in the `cookies` field.", + "name": "setTouchEmulationEnabled", + "description": "Toggles mouse event-based touch event emulation.", "experimental": true, "deprecated": true, - "redirect": "Network", - "returns": [ + "redirect": "Emulation", + "parameters": [ { - "name": "cookies", - "description": "Array of cookie objects.", - "type": "array", - "items": { - "$ref": "Network.Cookie" - } - } - ] - }, - { - "name": "getFrameTree", - "description": "Returns present frame tree structure.", - "returns": [ + "name": "enabled", + "description": "Whether the touch event emulation should be enabled.", + "type": "boolean" + }, { - "name": "frameTree", - "description": "Present frame tree structure.", - "$ref": "FrameTree" + "name": "configuration", + "description": "Touch/gesture events configuration. Default: current platform.", + "optional": true, + "type": "string", + "enum": [ + "mobile", + "desktop" + ] } ] }, { - "name": "getLayoutMetrics", - "description": "Returns metrics relating to the layouting of the page, such as viewport bounds/scale.", - "returns": [ + "name": "startScreencast", + "description": "Starts sending each frame using the `screencastFrame` event.", + "experimental": true, + "parameters": [ { - "name": "layoutViewport", - "description": "Metrics relating to the layout viewport.", - "$ref": "LayoutViewport" + "name": "format", + "description": "Image compression format.", + "optional": true, + "type": "string", + "enum": [ + "jpeg", + "png" + ] }, { - "name": "visualViewport", - "description": "Metrics relating to the visual viewport.", - "$ref": "VisualViewport" + "name": "quality", + "description": "Compression quality from range [0..100].", + "optional": true, + "type": "integer" }, { - "name": "contentSize", - "description": "Size of scrollable area.", - "$ref": "DOM.Rect" + "name": "maxWidth", + "description": "Maximum screenshot width.", + "optional": true, + "type": "integer" + }, + { + "name": "maxHeight", + "description": "Maximum screenshot height.", + "optional": true, + "type": "integer" + }, + { + "name": "everyNthFrame", + "description": "Send every n-th frame.", + "optional": true, + "type": "integer" } ] }, { - "name": "getNavigationHistory", - "description": "Returns navigation history for the current page.", - "returns": [ - { - "name": "currentIndex", - "description": "Index of the current navigation history entry.", - "type": "integer" - }, + "name": "stopLoading", + "description": "Force the page stop all navigations and pending resource fetches." + }, + { + "name": "crash", + "description": "Crashes renderer on the IO thread, generates minidumps.", + "experimental": true + }, + { + "name": "close", + "description": "Tries to close page, running its beforeunload hooks, if any.", + "experimental": true + }, + { + "name": "setWebLifecycleState", + "description": "Tries to update the web lifecycle state of the page.\nIt will transition the page to the given state according to:\nhttps://github.com/WICG/web-lifecycle/", + "experimental": true, + "parameters": [ { - "name": "entries", - "description": "Array of navigation history entries.", + "name": "state", + "description": "Target lifecycle state", + "type": "string", + "enum": [ + "frozen", + "active" + ] + } + ] + }, + { + "name": "stopScreencast", + "description": "Stops sending each frame in the `screencastFrame`.", + "experimental": true + }, + { + "name": "produceCompilationCache", + "description": "Requests backend to produce compilation cache for the specified scripts.\n`scripts` are appeneded to the list of scripts for which the cache\nwould be produced. The list may be reset during page navigation.\nWhen script with a matching URL is encountered, the cache is optionally\nproduced upon backend discretion, based on internal heuristics.\nSee also: `Page.compilationCacheProduced`.", + "experimental": true, + "parameters": [ + { + "name": "scripts", "type": "array", "items": { - "$ref": "NavigationEntry" + "$ref": "CompilationCacheParams" } } ] }, { - "name": "resetNavigationHistory", - "description": "Resets navigation history for the current page." - }, - { - "name": "getResourceContent", - "description": "Returns content of the given resource.", + "name": "addCompilationCache", + "description": "Seeds compilation cache for given url. Compilation cache does not survive\ncross-process navigation.", "experimental": true, "parameters": [ - { - "name": "frameId", - "description": "Frame id to get resource for.", - "$ref": "FrameId" - }, { "name": "url", - "description": "URL of the resource to get content for.", - "type": "string" - } - ], - "returns": [ - { - "name": "content", - "description": "Resource content.", "type": "string" }, { - "name": "base64Encoded", - "description": "True, if content was served as base64.", - "type": "boolean" + "name": "data", + "description": "Base64-encoded data (Encoded as a base64 string when passed over JSON)", + "type": "string" } ] }, { - "name": "getResourceTree", - "description": "Returns present frame / resource tree structure.", + "name": "clearCompilationCache", + "description": "Clears seeded compilation cache.", + "experimental": true + }, + { + "name": "setSPCTransactionMode", + "description": "Sets the Secure Payment Confirmation transaction mode.\nhttps://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode", "experimental": true, - "returns": [ + "parameters": [ { - "name": "frameTree", - "description": "Present frame / resource tree structure.", - "$ref": "FrameResourceTree" + "name": "mode", + "type": "string", + "enum": [ + "none", + "autoaccept", + "autoreject" + ] } ] }, { - "name": "handleJavaScriptDialog", - "description": "Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).", + "name": "generateTestReport", + "description": "Generates a report for testing.", + "experimental": true, "parameters": [ { - "name": "accept", - "description": "Whether to accept or dismiss the dialog.", - "type": "boolean" + "name": "message", + "description": "Message to be displayed in the report.", + "type": "string" }, { - "name": "promptText", - "description": "The text to enter into the dialog prompt before accepting. Used only if this is a prompt\ndialog.", + "name": "group", + "description": "Specifies the endpoint group to deliver the report to.", "optional": true, "type": "string" } ] }, { - "name": "navigate", - "description": "Navigates current page to the given URL.", + "name": "waitForDebugger", + "description": "Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.", + "experimental": true + }, + { + "name": "setInterceptFileChooserDialog", + "description": "Intercept file chooser requests and transfer control to protocol clients.\nWhen file chooser interception is enabled, native file chooser dialog is not shown.\nInstead, a protocol event `Page.fileChooserOpened` is emitted.", + "experimental": true, "parameters": [ { - "name": "url", - "description": "URL to navigate the page to.", - "type": "string" - }, - { - "name": "referrer", - "description": "Referrer URL.", - "optional": true, - "type": "string" - }, - { - "name": "transitionType", - "description": "Intended transition type.", - "optional": true, - "$ref": "TransitionType" - }, - { - "name": "frameId", - "description": "Frame id to navigate, if not specified navigates the top frame.", - "optional": true, - "$ref": "FrameId" - } - ], - "returns": [ - { - "name": "frameId", - "description": "Frame id that has navigated (or failed to navigate)", - "$ref": "FrameId" - }, - { - "name": "loaderId", - "description": "Loader identifier.", - "optional": true, - "$ref": "Network.LoaderId" - }, - { - "name": "errorText", - "description": "User friendly error message, present if and only if navigation has failed.", - "optional": true, - "type": "string" + "name": "enabled", + "type": "boolean" } ] - }, + } + ], + "events": [ { - "name": "navigateToHistoryEntry", - "description": "Navigates current page to the given history entry.", + "name": "domContentEventFired", "parameters": [ { - "name": "entryId", - "description": "Unique id of the entry to navigate to.", - "type": "integer" + "name": "timestamp", + "$ref": "Network.MonotonicTime" } ] }, { - "name": "printToPDF", - "description": "Print page as PDF.", + "name": "fileChooserOpened", + "description": "Emitted only when `page.interceptFileChooser` is enabled.", "parameters": [ { - "name": "landscape", - "description": "Paper orientation. Defaults to false.", - "optional": true, - "type": "boolean" - }, - { - "name": "displayHeaderFooter", - "description": "Display header and footer. Defaults to false.", - "optional": true, - "type": "boolean" - }, - { - "name": "printBackground", - "description": "Print background graphics. Defaults to false.", - "optional": true, - "type": "boolean" - }, - { - "name": "scale", - "description": "Scale of the webpage rendering. Defaults to 1.", - "optional": true, - "type": "number" - }, - { - "name": "paperWidth", - "description": "Paper width in inches. Defaults to 8.5 inches.", - "optional": true, - "type": "number" - }, - { - "name": "paperHeight", - "description": "Paper height in inches. Defaults to 11 inches.", - "optional": true, - "type": "number" - }, - { - "name": "marginTop", - "description": "Top margin in inches. Defaults to 1cm (~0.4 inches).", - "optional": true, - "type": "number" - }, - { - "name": "marginBottom", - "description": "Bottom margin in inches. Defaults to 1cm (~0.4 inches).", - "optional": true, - "type": "number" - }, - { - "name": "marginLeft", - "description": "Left margin in inches. Defaults to 1cm (~0.4 inches).", - "optional": true, - "type": "number" - }, - { - "name": "marginRight", - "description": "Right margin in inches. Defaults to 1cm (~0.4 inches).", - "optional": true, - "type": "number" - }, - { - "name": "pageRanges", - "description": "Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means\nprint all pages.", - "optional": true, - "type": "string" - }, - { - "name": "ignoreInvalidPageRanges", - "description": "Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'.\nDefaults to false.", - "optional": true, - "type": "boolean" - }, - { - "name": "headerTemplate", - "description": "HTML template for the print header. Should be valid HTML markup with following\nclasses used to inject printing values into them:\n- `date`: formatted print date\n- `title`: document title\n- `url`: document location\n- `pageNumber`: current page number\n- `totalPages`: total pages in the document\n\nFor example, `` would generate span containing the title.", - "optional": true, - "type": "string" - }, - { - "name": "footerTemplate", - "description": "HTML template for the print footer. Should use the same format as the `headerTemplate`.", - "optional": true, - "type": "string" + "name": "frameId", + "description": "Id of the frame containing input node.", + "experimental": true, + "$ref": "FrameId" }, { - "name": "preferCSSPageSize", - "description": "Whether or not to prefer page size as defined by css. Defaults to false,\nin which case the content will be scaled to fit the paper size.", - "optional": true, - "type": "boolean" + "name": "backendNodeId", + "description": "Input node id.", + "experimental": true, + "$ref": "DOM.BackendNodeId" }, { - "name": "transferMode", - "description": "return as stream", - "experimental": true, - "optional": true, + "name": "mode", + "description": "Input mode.", "type": "string", "enum": [ - "ReturnAsBase64", - "ReturnAsStream" + "selectSingle", + "selectMultiple" ] } - ], - "returns": [ - { - "name": "data", - "description": "Base64-encoded pdf data. Empty if |returnAsStream| is specified.", - "type": "string" - }, - { - "name": "stream", - "description": "A handle of the stream that holds resulting PDF data.", - "experimental": true, - "optional": true, - "$ref": "IO.StreamHandle" - } ] }, { - "name": "reload", - "description": "Reloads given page optionally ignoring the cache.", + "name": "frameAttached", + "description": "Fired when frame has been attached to its parent.", "parameters": [ { - "name": "ignoreCache", - "description": "If true, browser cache is ignored (as if the user pressed Shift+refresh).", - "optional": true, - "type": "boolean" + "name": "frameId", + "description": "Id of the frame that has been attached.", + "$ref": "FrameId" + }, + { + "name": "parentFrameId", + "description": "Parent frame identifier.", + "$ref": "FrameId" }, { - "name": "scriptToEvaluateOnLoad", - "description": "If set, the script will be injected into all frames of the inspected page after reload.\nArgument will be ignored if reloading dataURL origin.", + "name": "stack", + "description": "JavaScript stack trace of when frame was attached, only set if frame initiated from script.", "optional": true, - "type": "string" + "$ref": "Runtime.StackTrace" } ] }, { - "name": "removeScriptToEvaluateOnLoad", - "description": "Deprecated, please use removeScriptToEvaluateOnNewDocument instead.", - "experimental": true, + "name": "frameClearedScheduledNavigation", + "description": "Fired when frame no longer has a scheduled navigation.", "deprecated": true, "parameters": [ { - "name": "identifier", - "$ref": "ScriptIdentifier" + "name": "frameId", + "description": "Id of the frame that has cleared its scheduled navigation.", + "$ref": "FrameId" } ] }, { - "name": "removeScriptToEvaluateOnNewDocument", - "description": "Removes given script from the list.", + "name": "frameDetached", + "description": "Fired when frame has been detached from its parent.", "parameters": [ { - "name": "identifier", - "$ref": "ScriptIdentifier" + "name": "frameId", + "description": "Id of the frame that has been detached.", + "$ref": "FrameId" + }, + { + "name": "reason", + "experimental": true, + "type": "string", + "enum": [ + "remove", + "swap" + ] } ] }, { - "name": "screencastFrameAck", - "description": "Acknowledges that a screencast frame has been received by the frontend.", + "name": "frameNavigated", + "description": "Fired once navigation of the frame has completed. Frame is now associated with the new loader.", + "parameters": [ + { + "name": "frame", + "description": "Frame object.", + "$ref": "Frame" + }, + { + "name": "type", + "experimental": true, + "$ref": "NavigationType" + } + ] + }, + { + "name": "documentOpened", + "description": "Fired when opening document to write to.", "experimental": true, "parameters": [ { - "name": "sessionId", - "description": "Frame number.", - "type": "integer" + "name": "frame", + "description": "Frame object.", + "$ref": "Frame" } ] }, { - "name": "searchInResource", - "description": "Searches for given string in resource content.", + "name": "frameResized", + "experimental": true + }, + { + "name": "frameRequestedNavigation", + "description": "Fired when a renderer-initiated navigation is requested.\nNavigation may still be cancelled after the event is issued.", "experimental": true, "parameters": [ { "name": "frameId", - "description": "Frame id for resource to search in.", + "description": "Id of the frame that is being navigated.", "$ref": "FrameId" }, + { + "name": "reason", + "description": "The reason for the navigation.", + "$ref": "ClientNavigationReason" + }, { "name": "url", - "description": "URL of the resource to search in.", + "description": "The destination URL for the requested navigation.", "type": "string" }, { - "name": "query", - "description": "String to search for.", - "type": "string" + "name": "disposition", + "description": "The disposition for the navigation.", + "$ref": "ClientNavigationDisposition" + } + ] + }, + { + "name": "frameScheduledNavigation", + "description": "Fired when frame schedules a potential navigation.", + "deprecated": true, + "parameters": [ + { + "name": "frameId", + "description": "Id of the frame that has scheduled a navigation.", + "$ref": "FrameId" }, { - "name": "caseSensitive", - "description": "If true, search is case sensitive.", - "optional": true, - "type": "boolean" + "name": "delay", + "description": "Delay (in seconds) until the navigation is scheduled to begin. The navigation is not\nguaranteed to start.", + "type": "number" }, { - "name": "isRegex", - "description": "If true, treats string parameter as regex.", - "optional": true, - "type": "boolean" - } - ], - "returns": [ + "name": "reason", + "description": "The reason for the navigation.", + "$ref": "ClientNavigationReason" + }, { - "name": "result", - "description": "List of search matches.", - "type": "array", - "items": { - "$ref": "Debugger.SearchMatch" - } + "name": "url", + "description": "The destination URL for the scheduled navigation.", + "type": "string" } ] }, { - "name": "setAdBlockingEnabled", - "description": "Enable Chrome's experimental ad filter on all sites.", + "name": "frameStartedLoading", + "description": "Fired when frame has started loading.", "experimental": true, "parameters": [ { - "name": "enabled", - "description": "Whether to block ads.", - "type": "boolean" + "name": "frameId", + "description": "Id of the frame that has started loading.", + "$ref": "FrameId" } ] }, { - "name": "setBypassCSP", - "description": "Enable page Content Security Policy by-passing.", + "name": "frameStoppedLoading", + "description": "Fired when frame has stopped loading.", "experimental": true, "parameters": [ { - "name": "enabled", - "description": "Whether to bypass page CSP.", - "type": "boolean" + "name": "frameId", + "description": "Id of the frame that has stopped loading.", + "$ref": "FrameId" } ] }, { - "name": "setDeviceMetricsOverride", - "description": "Overrides the values of device screen dimensions (window.screen.width, window.screen.height,\nwindow.innerWidth, window.innerHeight, and \"device-width\"/\"device-height\"-related CSS media\nquery results).", + "name": "downloadWillBegin", + "description": "Fired when page is about to start a download.\nDeprecated. Use Browser.downloadWillBegin instead.", "experimental": true, "deprecated": true, - "redirect": "Emulation", "parameters": [ { - "name": "width", - "description": "Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.", - "type": "integer" - }, - { - "name": "height", - "description": "Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.", - "type": "integer" - }, - { - "name": "deviceScaleFactor", - "description": "Overriding device scale factor value. 0 disables the override.", - "type": "number" - }, - { - "name": "mobile", - "description": "Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text\nautosizing and more.", - "type": "boolean" - }, - { - "name": "scale", - "description": "Scale to apply to resulting view image.", - "optional": true, - "type": "number" - }, - { - "name": "screenWidth", - "description": "Overriding screen width value in pixels (minimum 0, maximum 10000000).", - "optional": true, - "type": "integer" - }, - { - "name": "screenHeight", - "description": "Overriding screen height value in pixels (minimum 0, maximum 10000000).", - "optional": true, - "type": "integer" - }, - { - "name": "positionX", - "description": "Overriding view X position on screen in pixels (minimum 0, maximum 10000000).", - "optional": true, - "type": "integer" - }, - { - "name": "positionY", - "description": "Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).", - "optional": true, - "type": "integer" + "name": "frameId", + "description": "Id of the frame that caused download to begin.", + "$ref": "FrameId" }, { - "name": "dontSetVisibleSize", - "description": "Do not set visible view size, rely upon explicit setVisibleSize call.", - "optional": true, - "type": "boolean" + "name": "guid", + "description": "Global unique identifier of the download.", + "type": "string" }, { - "name": "screenOrientation", - "description": "Screen orientation override.", - "optional": true, - "$ref": "Emulation.ScreenOrientation" + "name": "url", + "description": "URL of the resource being downloaded.", + "type": "string" }, { - "name": "viewport", - "description": "The viewport dimensions and scale. If not set, the override is cleared.", - "optional": true, - "$ref": "Viewport" + "name": "suggestedFilename", + "description": "Suggested file name of the resource (the actual name of the file saved on disk may differ).", + "type": "string" } ] }, { - "name": "setDeviceOrientationOverride", - "description": "Overrides the Device Orientation.", + "name": "downloadProgress", + "description": "Fired when download makes progress. Last call has |done| == true.\nDeprecated. Use Browser.downloadProgress instead.", "experimental": true, "deprecated": true, - "redirect": "DeviceOrientation", "parameters": [ { - "name": "alpha", - "description": "Mock alpha", - "type": "number" + "name": "guid", + "description": "Global unique identifier of the download.", + "type": "string" }, { - "name": "beta", - "description": "Mock beta", + "name": "totalBytes", + "description": "Total expected bytes to download.", "type": "number" }, { - "name": "gamma", - "description": "Mock gamma", + "name": "receivedBytes", + "description": "Total bytes received.", "type": "number" + }, + { + "name": "state", + "description": "Download status.", + "type": "string", + "enum": [ + "inProgress", + "completed", + "canceled" + ] } ] }, { - "name": "setFontFamilies", - "description": "Set generic font families.", - "experimental": true, - "parameters": [ - { - "name": "fontFamilies", - "description": "Specifies font families to set. If a font family is not specified, it won't be changed.", - "$ref": "FontFamilies" - } - ] + "name": "interstitialHidden", + "description": "Fired when interstitial page was hidden" }, { - "name": "setFontSizes", - "description": "Set default font sizes.", - "experimental": true, + "name": "interstitialShown", + "description": "Fired when interstitial page was shown" + }, + { + "name": "javascriptDialogClosed", + "description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been\nclosed.", "parameters": [ { - "name": "fontSizes", - "description": "Specifies font sizes to set. If a font size is not specified, it won't be changed.", - "$ref": "FontSizes" + "name": "result", + "description": "Whether dialog was confirmed.", + "type": "boolean" + }, + { + "name": "userInput", + "description": "User input in case of prompt.", + "type": "string" } ] }, { - "name": "setDocumentContent", - "description": "Sets given markup as the document's HTML.", + "name": "javascriptDialogOpening", + "description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to\nopen.", "parameters": [ { - "name": "frameId", - "description": "Frame id to set HTML for.", - "$ref": "FrameId" + "name": "url", + "description": "Frame url.", + "type": "string" }, { - "name": "html", - "description": "HTML content to set.", + "name": "message", + "description": "Message that will be displayed by the dialog.", + "type": "string" + }, + { + "name": "type", + "description": "Dialog type.", + "$ref": "DialogType" + }, + { + "name": "hasBrowserHandler", + "description": "True iff browser is capable showing or acting on the given dialog. When browser has no\ndialog handler for given target, calling alert while Page domain is engaged will stall\nthe page execution. Execution can be resumed via calling Page.handleJavaScriptDialog.", + "type": "boolean" + }, + { + "name": "defaultPrompt", + "description": "Default dialog prompt.", + "optional": true, "type": "string" } ] }, { - "name": "setDownloadBehavior", - "description": "Set the behavior when downloading a file.", - "experimental": true, + "name": "lifecycleEvent", + "description": "Fired for top level page lifecycle events such as navigation, load, paint, etc.", "parameters": [ { - "name": "behavior", - "description": "Whether to allow all or deny all download requests, or use default Chrome behavior if\navailable (otherwise deny).", - "type": "string", - "enum": [ - "deny", - "allow", - "default" - ] + "name": "frameId", + "description": "Id of the frame.", + "$ref": "FrameId" }, { - "name": "downloadPath", - "description": "The default path to save downloaded files to. This is requred if behavior is set to 'allow'", - "optional": true, + "name": "loaderId", + "description": "Loader identifier. Empty string if the request is fetched from worker.", + "$ref": "Network.LoaderId" + }, + { + "name": "name", "type": "string" + }, + { + "name": "timestamp", + "$ref": "Network.MonotonicTime" } ] }, { - "name": "setGeolocationOverride", - "description": "Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position\nunavailable.", - "deprecated": true, - "redirect": "Emulation", + "name": "backForwardCacheNotUsed", + "description": "Fired for failed bfcache history navigations if BackForwardCache feature is enabled. Do\nnot assume any ordering with the Page.frameNavigated event. This event is fired only for\nmain-frame history navigation where the document changes (non-same-document navigations),\nwhen bfcache navigation fails.", + "experimental": true, "parameters": [ { - "name": "latitude", - "description": "Mock latitude", - "optional": true, - "type": "number" + "name": "loaderId", + "description": "The loader id for the associated navgation.", + "$ref": "Network.LoaderId" }, { - "name": "longitude", - "description": "Mock longitude", - "optional": true, - "type": "number" + "name": "frameId", + "description": "The frame id of the associated frame.", + "$ref": "FrameId" }, { - "name": "accuracy", - "description": "Mock accuracy", + "name": "notRestoredExplanations", + "description": "Array of reasons why the page could not be cached. This must not be empty.", + "type": "array", + "items": { + "$ref": "BackForwardCacheNotRestoredExplanation" + } + }, + { + "name": "notRestoredExplanationsTree", + "description": "Tree structure of reasons why the page could not be cached for each frame.", "optional": true, - "type": "number" + "$ref": "BackForwardCacheNotRestoredExplanationTree" } ] }, { - "name": "setLifecycleEventsEnabled", - "description": "Controls whether page will emit lifecycle events.", - "experimental": true, + "name": "loadEventFired", "parameters": [ { - "name": "enabled", - "description": "If true, starts emitting lifecycle events.", - "type": "boolean" + "name": "timestamp", + "$ref": "Network.MonotonicTime" } ] }, { - "name": "setTouchEmulationEnabled", - "description": "Toggles mouse event-based touch event emulation.", + "name": "navigatedWithinDocument", + "description": "Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.", "experimental": true, - "deprecated": true, - "redirect": "Emulation", "parameters": [ { - "name": "enabled", - "description": "Whether the touch event emulation should be enabled.", - "type": "boolean" + "name": "frameId", + "description": "Id of the frame.", + "$ref": "FrameId" }, { - "name": "configuration", - "description": "Touch/gesture events configuration. Default: current platform.", - "optional": true, - "type": "string", - "enum": [ - "mobile", - "desktop" - ] + "name": "url", + "description": "Frame's new url.", + "type": "string" } ] }, { - "name": "startScreencast", - "description": "Starts sending each frame using the `screencastFrame` event.", + "name": "screencastFrame", + "description": "Compressed image data requested by the `startScreencast`.", "experimental": true, "parameters": [ { - "name": "format", - "description": "Image compression format.", - "optional": true, - "type": "string", - "enum": [ - "jpeg", - "png" - ] - }, - { - "name": "quality", - "description": "Compression quality from range [0..100].", - "optional": true, - "type": "integer" - }, - { - "name": "maxWidth", - "description": "Maximum screenshot width.", - "optional": true, - "type": "integer" + "name": "data", + "description": "Base64-encoded compressed image. (Encoded as a base64 string when passed over JSON)", + "type": "string" }, { - "name": "maxHeight", - "description": "Maximum screenshot height.", - "optional": true, - "type": "integer" + "name": "metadata", + "description": "Screencast frame metadata.", + "$ref": "ScreencastFrameMetadata" }, { - "name": "everyNthFrame", - "description": "Send every n-th frame.", - "optional": true, + "name": "sessionId", + "description": "Frame number.", "type": "integer" } ] }, { - "name": "stopLoading", - "description": "Force the page stop all navigations and pending resource fetches." - }, - { - "name": "crash", - "description": "Crashes renderer on the IO thread, generates minidumps.", - "experimental": true - }, - { - "name": "close", - "description": "Tries to close page, running its beforeunload hooks, if any.", - "experimental": true - }, - { - "name": "setWebLifecycleState", - "description": "Tries to update the web lifecycle state of the page.\nIt will transition the page to the given state according to:\nhttps://github.com/WICG/web-lifecycle/", + "name": "screencastVisibilityChanged", + "description": "Fired when the page with currently enabled screencast was shown or hidden `.", "experimental": true, "parameters": [ { - "name": "state", - "description": "Target lifecycle state", - "type": "string", - "enum": [ - "frozen", - "active" - ] + "name": "visible", + "description": "True if the page is visible.", + "type": "boolean" } ] }, { - "name": "stopScreencast", - "description": "Stops sending each frame in the `screencastFrame`.", - "experimental": true - }, - { - "name": "setProduceCompilationCache", - "description": "Forces compilation cache to be generated for every subresource script.", - "experimental": true, + "name": "windowOpen", + "description": "Fired when a new window is going to be opened, via window.open(), link click, form submission,\netc.", "parameters": [ { - "name": "enabled", + "name": "url", + "description": "The URL for the new window.", + "type": "string" + }, + { + "name": "windowName", + "description": "Window name.", + "type": "string" + }, + { + "name": "windowFeatures", + "description": "An array of enabled window features.", + "type": "array", + "items": { + "type": "string" + } + }, + { + "name": "userGesture", + "description": "Whether or not it was triggered by user gesture.", "type": "boolean" } ] }, { - "name": "addCompilationCache", - "description": "Seeds compilation cache for given url. Compilation cache does not survive\ncross-process navigation.", + "name": "compilationCacheProduced", + "description": "Issued for every compilation cache generated. Is only available\nif Page.setGenerateCompilationCache is enabled.", "experimental": true, "parameters": [ { @@ -12365,71 +17387,82 @@ }, { "name": "data", - "description": "Base64-encoded data", + "description": "Base64-encoded data (Encoded as a base64 string when passed over JSON)", "type": "string" } ] - }, - { - "name": "clearCompilationCache", - "description": "Clears seeded compilation cache.", - "experimental": true - }, + } + ] + }, + { + "domain": "Performance", + "types": [ { - "name": "generateTestReport", - "description": "Generates a report for testing.", - "experimental": true, - "parameters": [ + "id": "Metric", + "description": "Run-time execution metric.", + "type": "object", + "properties": [ { - "name": "message", - "description": "Message to be displayed in the report.", + "name": "name", + "description": "Metric name.", "type": "string" }, { - "name": "group", - "description": "Specifies the endpoint group to deliver the report to.", - "optional": true, - "type": "string" + "name": "value", + "description": "Metric value.", + "type": "number" } ] - }, + } + ], + "commands": [ { - "name": "waitForDebugger", - "description": "Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.", - "experimental": true + "name": "disable", + "description": "Disable collecting and reporting metrics." }, { - "name": "setInterceptFileChooserDialog", - "description": "Intercept file chooser requests and transfer control to protocol clients.\nWhen file chooser interception is enabled, native file chooser dialog is not shown.\nInstead, a protocol event `Page.fileChooserOpened` is emitted.\nFile chooser can be handled with `page.handleFileChooser` command.", - "experimental": true, + "name": "enable", + "description": "Enable collecting and reporting metrics.", "parameters": [ { - "name": "enabled", - "type": "boolean" + "name": "timeDomain", + "description": "Time domain to use for collecting and reporting duration metrics.", + "optional": true, + "type": "string", + "enum": [ + "timeTicks", + "threadTicks" + ] } ] }, { - "name": "handleFileChooser", - "description": "Accepts or cancels an intercepted file chooser dialog.", + "name": "setTimeDomain", + "description": "Sets time domain to use for collecting and reporting duration metrics.\nNote that this must be called before enabling metrics collection. Calling\nthis method while metrics collection is enabled returns an error.", "experimental": true, + "deprecated": true, "parameters": [ { - "name": "action", + "name": "timeDomain", + "description": "Time domain", "type": "string", "enum": [ - "accept", - "cancel", - "fallback" + "timeTicks", + "threadTicks" ] - }, + } + ] + }, + { + "name": "getMetrics", + "description": "Retrieve current values of run-time metrics.", + "returns": [ { - "name": "files", - "description": "Array of absolute file paths to set, only respected with `accept` action.", - "optional": true, + "name": "metrics", + "description": "Current values for run-time metrics.", "type": "array", "items": { - "type": "string" + "$ref": "Metric" } } ] @@ -12437,487 +17470,385 @@ ], "events": [ { - "name": "domContentEventFired", + "name": "metrics", + "description": "Current values of the metrics.", "parameters": [ { - "name": "timestamp", - "$ref": "Network.MonotonicTime" - } - ] - }, - { - "name": "fileChooserOpened", - "description": "Emitted only when `page.interceptFileChooser` is enabled.", - "parameters": [ + "name": "metrics", + "description": "Current values of the metrics.", + "type": "array", + "items": { + "$ref": "Metric" + } + }, { - "name": "mode", - "type": "string", - "enum": [ - "selectSingle", - "selectMultiple" - ] + "name": "title", + "description": "Timestamp title.", + "type": "string" } ] - }, + } + ] + }, + { + "domain": "PerformanceTimeline", + "description": "Reporting of performance timeline events, as specified in\nhttps://w3c.github.io/performance-timeline/#dom-performanceobserver.", + "experimental": true, + "dependencies": [ + "DOM", + "Network" + ], + "types": [ { - "name": "frameAttached", - "description": "Fired when frame has been attached to its parent.", - "parameters": [ + "id": "LargestContentfulPaint", + "description": "See https://github.com/WICG/LargestContentfulPaint and largest_contentful_paint.idl", + "type": "object", + "properties": [ { - "name": "frameId", - "description": "Id of the frame that has been attached.", - "$ref": "FrameId" + "name": "renderTime", + "$ref": "Network.TimeSinceEpoch" }, { - "name": "parentFrameId", - "description": "Parent frame identifier.", - "$ref": "FrameId" + "name": "loadTime", + "$ref": "Network.TimeSinceEpoch" }, { - "name": "stack", - "description": "JavaScript stack trace of when frame was attached, only set if frame initiated from script.", + "name": "size", + "description": "The number of pixels being painted.", + "type": "number" + }, + { + "name": "elementId", + "description": "The id attribute of the element, if available.", "optional": true, - "$ref": "Runtime.StackTrace" - } - ] - }, - { - "name": "frameClearedScheduledNavigation", - "description": "Fired when frame no longer has a scheduled navigation.", - "deprecated": true, - "parameters": [ + "type": "string" + }, { - "name": "frameId", - "description": "Id of the frame that has cleared its scheduled navigation.", - "$ref": "FrameId" + "name": "url", + "description": "The URL of the image (may be trimmed).", + "optional": true, + "type": "string" + }, + { + "name": "nodeId", + "optional": true, + "$ref": "DOM.BackendNodeId" } ] }, { - "name": "frameDetached", - "description": "Fired when frame has been detached from its parent.", - "parameters": [ + "id": "LayoutShiftAttribution", + "type": "object", + "properties": [ { - "name": "frameId", - "description": "Id of the frame that has been detached.", - "$ref": "FrameId" + "name": "previousRect", + "$ref": "DOM.Rect" + }, + { + "name": "currentRect", + "$ref": "DOM.Rect" + }, + { + "name": "nodeId", + "optional": true, + "$ref": "DOM.BackendNodeId" } ] }, { - "name": "frameNavigated", - "description": "Fired once navigation of the frame has completed. Frame is now associated with the new loader.", - "parameters": [ + "id": "LayoutShift", + "description": "See https://wicg.github.io/layout-instability/#sec-layout-shift and layout_shift.idl", + "type": "object", + "properties": [ { - "name": "frame", - "description": "Frame object.", - "$ref": "Frame" + "name": "value", + "description": "Score increment produced by this event.", + "type": "number" + }, + { + "name": "hadRecentInput", + "type": "boolean" + }, + { + "name": "lastInputTime", + "$ref": "Network.TimeSinceEpoch" + }, + { + "name": "sources", + "type": "array", + "items": { + "$ref": "LayoutShiftAttribution" + } } ] }, { - "name": "frameResized", - "experimental": true - }, - { - "name": "frameRequestedNavigation", - "description": "Fired when a renderer-initiated navigation is requested.\nNavigation may still be cancelled after the event is issued.", - "experimental": true, - "parameters": [ + "id": "TimelineEvent", + "type": "object", + "properties": [ { "name": "frameId", - "description": "Id of the frame that is being navigated.", - "$ref": "FrameId" + "description": "Identifies the frame that this event is related to. Empty for non-frame targets.", + "$ref": "Page.FrameId" }, { - "name": "reason", - "description": "The reason for the navigation.", - "$ref": "ClientNavigationReason" + "name": "type", + "description": "The event type, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype\nThis determines which of the optional \"details\" fiedls is present.", + "type": "string" }, { - "name": "url", - "description": "The destination URL for the requested navigation.", + "name": "name", + "description": "Name may be empty depending on the type.", "type": "string" - } - ] - }, - { - "name": "frameScheduledNavigation", - "description": "Fired when frame schedules a potential navigation.", - "deprecated": true, - "parameters": [ + }, { - "name": "frameId", - "description": "Id of the frame that has scheduled a navigation.", - "$ref": "FrameId" + "name": "time", + "description": "Time in seconds since Epoch, monotonically increasing within document lifetime.", + "$ref": "Network.TimeSinceEpoch" }, { - "name": "delay", - "description": "Delay (in seconds) until the navigation is scheduled to begin. The navigation is not\nguaranteed to start.", + "name": "duration", + "description": "Event duration, if applicable.", + "optional": true, "type": "number" }, { - "name": "reason", - "description": "The reason for the navigation.", - "type": "string", - "enum": [ - "formSubmissionGet", - "formSubmissionPost", - "httpHeaderRefresh", - "scriptInitiated", - "metaTagRefresh", - "pageBlockInterstitial", - "reload" - ] + "name": "lcpDetails", + "optional": true, + "$ref": "LargestContentfulPaint" }, { - "name": "url", - "description": "The destination URL for the scheduled navigation.", - "type": "string" + "name": "layoutShiftDetails", + "optional": true, + "$ref": "LayoutShift" } ] - }, + } + ], + "commands": [ { - "name": "frameStartedLoading", - "description": "Fired when frame has started loading.", - "experimental": true, + "name": "enable", + "description": "Previously buffered events would be reported before method returns.\nSee also: timelineEventAdded", "parameters": [ { - "name": "frameId", - "description": "Id of the frame that has started loading.", - "$ref": "FrameId" + "name": "eventTypes", + "description": "The types of event to report, as specified in\nhttps://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype\nThe specified filter overrides any previous filters, passing empty\nfilter disables recording.\nNote that not all types exposed to the web platform are currently supported.", + "type": "array", + "items": { + "type": "string" + } } ] - }, + } + ], + "events": [ { - "name": "frameStoppedLoading", - "description": "Fired when frame has stopped loading.", - "experimental": true, + "name": "timelineEventAdded", + "description": "Sent when a performance timeline event is added. See reportPerformanceTimeline method.", "parameters": [ { - "name": "frameId", - "description": "Id of the frame that has stopped loading.", - "$ref": "FrameId" + "name": "event", + "$ref": "TimelineEvent" } ] + } + ] + }, + { + "domain": "Security", + "description": "Security", + "types": [ + { + "id": "CertificateId", + "description": "An internal certificate ID value.", + "type": "integer" }, { - "name": "downloadWillBegin", - "description": "Fired when page is about to start a download.", - "experimental": true, - "parameters": [ - { - "name": "frameId", - "description": "Id of the frame that caused download to begin.", - "$ref": "FrameId" - }, - { - "name": "url", - "description": "URL of the resource being downloaded.", - "type": "string" - } + "id": "MixedContentType", + "description": "A description of mixed content (HTTP resources on HTTPS pages), as defined by\nhttps://www.w3.org/TR/mixed-content/#categories", + "type": "string", + "enum": [ + "blockable", + "optionally-blockable", + "none" ] }, { - "name": "interstitialHidden", - "description": "Fired when interstitial page was hidden" - }, - { - "name": "interstitialShown", - "description": "Fired when interstitial page was shown" - }, - { - "name": "javascriptDialogClosed", - "description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been\nclosed.", - "parameters": [ - { - "name": "result", - "description": "Whether dialog was confirmed.", - "type": "boolean" - }, - { - "name": "userInput", - "description": "User input in case of prompt.", - "type": "string" - } + "id": "SecurityState", + "description": "The security level of a page or resource.", + "type": "string", + "enum": [ + "unknown", + "neutral", + "insecure", + "secure", + "info", + "insecure-broken" ] }, { - "name": "javascriptDialogOpening", - "description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to\nopen.", - "parameters": [ + "id": "CertificateSecurityState", + "description": "Details about the security state of the page certificate.", + "experimental": true, + "type": "object", + "properties": [ { - "name": "url", - "description": "Frame url.", + "name": "protocol", + "description": "Protocol name (e.g. \"TLS 1.2\" or \"QUIC\").", "type": "string" }, { - "name": "message", - "description": "Message that will be displayed by the dialog.", + "name": "keyExchange", + "description": "Key Exchange used by the connection, or the empty string if not applicable.", "type": "string" }, { - "name": "type", - "description": "Dialog type.", - "$ref": "DialogType" + "name": "keyExchangeGroup", + "description": "(EC)DH group used by the connection, if applicable.", + "optional": true, + "type": "string" }, { - "name": "hasBrowserHandler", - "description": "True iff browser is capable showing or acting on the given dialog. When browser has no\ndialog handler for given target, calling alert while Page domain is engaged will stall\nthe page execution. Execution can be resumed via calling Page.handleJavaScriptDialog.", - "type": "boolean" + "name": "cipher", + "description": "Cipher name.", + "type": "string" }, { - "name": "defaultPrompt", - "description": "Default dialog prompt.", + "name": "mac", + "description": "TLS MAC. Note that AEAD ciphers do not have separate MACs.", "optional": true, "type": "string" - } - ] - }, - { - "name": "lifecycleEvent", - "description": "Fired for top level page lifecycle events such as navigation, load, paint, etc.", - "parameters": [ - { - "name": "frameId", - "description": "Id of the frame.", - "$ref": "FrameId" }, { - "name": "loaderId", - "description": "Loader identifier. Empty string if the request is fetched from worker.", - "$ref": "Network.LoaderId" + "name": "certificate", + "description": "Page certificate.", + "type": "array", + "items": { + "type": "string" + } }, { - "name": "name", + "name": "subjectName", + "description": "Certificate subject name.", "type": "string" }, { - "name": "timestamp", - "$ref": "Network.MonotonicTime" - } - ] - }, - { - "name": "loadEventFired", - "parameters": [ - { - "name": "timestamp", - "$ref": "Network.MonotonicTime" - } - ] - }, - { - "name": "navigatedWithinDocument", - "description": "Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.", - "experimental": true, - "parameters": [ + "name": "issuer", + "description": "Name of the issuing CA.", + "type": "string" + }, { - "name": "frameId", - "description": "Id of the frame.", - "$ref": "FrameId" + "name": "validFrom", + "description": "Certificate valid from date.", + "$ref": "Network.TimeSinceEpoch" }, { - "name": "url", - "description": "Frame's new url.", - "type": "string" - } - ] - }, - { - "name": "screencastFrame", - "description": "Compressed image data requested by the `startScreencast`.", - "experimental": true, - "parameters": [ + "name": "validTo", + "description": "Certificate valid to (expiration) date", + "$ref": "Network.TimeSinceEpoch" + }, { - "name": "data", - "description": "Base64-encoded compressed image.", + "name": "certificateNetworkError", + "description": "The highest priority network error code, if the certificate has an error.", + "optional": true, "type": "string" }, { - "name": "metadata", - "description": "Screencast frame metadata.", - "$ref": "ScreencastFrameMetadata" + "name": "certificateHasWeakSignature", + "description": "True if the certificate uses a weak signature aglorithm.", + "type": "boolean" }, { - "name": "sessionId", - "description": "Frame number.", - "type": "integer" - } - ] - }, - { - "name": "screencastVisibilityChanged", - "description": "Fired when the page with currently enabled screencast was shown or hidden `.", - "experimental": true, - "parameters": [ + "name": "certificateHasSha1Signature", + "description": "True if the certificate has a SHA1 signature in the chain.", + "type": "boolean" + }, { - "name": "visible", - "description": "True if the page is visible.", + "name": "modernSSL", + "description": "True if modern SSL", "type": "boolean" - } - ] - }, - { - "name": "windowOpen", - "description": "Fired when a new window is going to be opened, via window.open(), link click, form submission,\netc.", - "parameters": [ + }, { - "name": "url", - "description": "The URL for the new window.", - "type": "string" + "name": "obsoleteSslProtocol", + "description": "True if the connection is using an obsolete SSL protocol.", + "type": "boolean" }, { - "name": "windowName", - "description": "Window name.", - "type": "string" + "name": "obsoleteSslKeyExchange", + "description": "True if the connection is using an obsolete SSL key exchange.", + "type": "boolean" }, { - "name": "windowFeatures", - "description": "An array of enabled window features.", - "type": "array", - "items": { - "type": "string" - } + "name": "obsoleteSslCipher", + "description": "True if the connection is using an obsolete SSL cipher.", + "type": "boolean" }, { - "name": "userGesture", - "description": "Whether or not it was triggered by user gesture.", + "name": "obsoleteSslSignature", + "description": "True if the connection is using an obsolete SSL signature.", "type": "boolean" } ] }, { - "name": "compilationCacheProduced", - "description": "Issued for every compilation cache generated. Is only available\nif Page.setGenerateCompilationCache is enabled.", + "id": "SafetyTipStatus", "experimental": true, - "parameters": [ - { - "name": "url", - "type": "string" - }, - { - "name": "data", - "description": "Base64-encoded data", - "type": "string" - } + "type": "string", + "enum": [ + "badReputation", + "lookalike" ] - } - ] - }, - { - "domain": "Performance", - "types": [ + }, { - "id": "Metric", - "description": "Run-time execution metric.", + "id": "SafetyTipInfo", + "experimental": true, "type": "object", "properties": [ { - "name": "name", - "description": "Metric name.", - "type": "string" + "name": "safetyTipStatus", + "description": "Describes whether the page triggers any safety tips or reputation warnings. Default is unknown.", + "$ref": "SafetyTipStatus" }, { - "name": "value", - "description": "Metric value.", - "type": "number" + "name": "safeUrl", + "description": "The URL the safety tip suggested (\"Did you mean?\"). Only filled in for lookalike matches.", + "optional": true, + "type": "string" } ] - } - ], - "commands": [ - { - "name": "disable", - "description": "Disable collecting and reporting metrics." - }, - { - "name": "enable", - "description": "Enable collecting and reporting metrics." }, { - "name": "setTimeDomain", - "description": "Sets time domain to use for collecting and reporting duration metrics.\nNote that this must be called before enabling metrics collection. Calling\nthis method while metrics collection is enabled returns an error.", + "id": "VisibleSecurityState", + "description": "Security state information about the page.", "experimental": true, - "parameters": [ + "type": "object", + "properties": [ { - "name": "timeDomain", - "description": "Time domain", - "type": "string", - "enum": [ - "timeTicks", - "threadTicks" - ] - } - ] - }, - { - "name": "getMetrics", - "description": "Retrieve current values of run-time metrics.", - "returns": [ + "name": "securityState", + "description": "The security level of the page.", + "$ref": "SecurityState" + }, { - "name": "metrics", - "description": "Current values for run-time metrics.", - "type": "array", - "items": { - "$ref": "Metric" - } - } - ] - } - ], - "events": [ - { - "name": "metrics", - "description": "Current values of the metrics.", - "parameters": [ + "name": "certificateSecurityState", + "description": "Security state details about the page certificate.", + "optional": true, + "$ref": "CertificateSecurityState" + }, { - "name": "metrics", - "description": "Current values of the metrics.", + "name": "safetyTipInfo", + "description": "The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown.", + "optional": true, + "$ref": "SafetyTipInfo" + }, + { + "name": "securityStateIssueIds", + "description": "Array of security state issues ids.", "type": "array", "items": { - "$ref": "Metric" + "type": "string" } - }, - { - "name": "title", - "description": "Timestamp title.", - "type": "string" } ] - } - ] - }, - { - "domain": "Security", - "description": "Security", - "types": [ - { - "id": "CertificateId", - "description": "An internal certificate ID value.", - "type": "integer" - }, - { - "id": "MixedContentType", - "description": "A description of mixed content (HTTP resources on HTTPS pages), as defined by\nhttps://www.w3.org/TR/mixed-content/#categories", - "type": "string", - "enum": [ - "blockable", - "optionally-blockable", - "none" - ] - }, - { - "id": "SecurityState", - "description": "The security level of a page or resource.", - "type": "string", - "enum": [ - "unknown", - "neutral", - "insecure", - "secure", - "info" - ] }, { "id": "SecurityStateExplanation", @@ -13096,8 +18027,21 @@ ] }, { - "name": "securityStateChanged", + "name": "visibleSecurityStateChanged", "description": "The security state of the page changed.", + "experimental": true, + "parameters": [ + { + "name": "visibleSecurityState", + "description": "Security state information about the page.", + "$ref": "VisibleSecurityState" + } + ] + }, + { + "name": "securityStateChanged", + "description": "The security state of the page changed. No longer being sent.", + "deprecated": true, "parameters": [ { "name": "securityState", @@ -13112,7 +18056,8 @@ }, { "name": "explanations", - "description": "List of explanations for the security state. If the overall security state is `insecure` or\n`warning`, at least one corresponding explanation should be included.", + "description": "Previously a list of explanations for the security state. Now always\nempty.", + "deprecated": true, "type": "array", "items": { "$ref": "SecurityStateExplanation" @@ -13126,7 +18071,8 @@ }, { "name": "summary", - "description": "Overrides user-visible description of the state.", + "description": "Overrides user-visible description of the state. Always omitted.", + "deprecated": true, "optional": true, "type": "string" } @@ -13137,6 +18083,9 @@ { "domain": "ServiceWorker", "experimental": true, + "dependencies": [ + "Target" + ], "types": [ { "id": "RegistrationID", @@ -13309,6 +18258,23 @@ } ] }, + { + "name": "dispatchPeriodicSyncEvent", + "parameters": [ + { + "name": "origin", + "type": "string" + }, + { + "name": "registrationId", + "$ref": "RegistrationID" + }, + { + "name": "tag", + "type": "string" + } + ] + }, { "name": "enable" }, @@ -13418,6 +18384,10 @@ { "domain": "Storage", "experimental": true, + "dependencies": [ + "Browser", + "Network" + ], "types": [ { "id": "StorageType", @@ -13453,6 +18423,22 @@ "type": "number" } ] + }, + { + "id": "TrustTokens", + "description": "Pair of issuer origin and number of available (signed, but not used) Trust\nTokens from that issuer.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "issuerOrigin", + "type": "string" + }, + { + "name": "count", + "type": "number" + } + ] } ], "commands": [ @@ -13472,6 +18458,60 @@ } ] }, + { + "name": "getCookies", + "description": "Returns all browser cookies.", + "parameters": [ + { + "name": "browserContextId", + "description": "Browser context to use when called on the browser endpoint.", + "optional": true, + "$ref": "Browser.BrowserContextID" + } + ], + "returns": [ + { + "name": "cookies", + "description": "Array of cookie objects.", + "type": "array", + "items": { + "$ref": "Network.Cookie" + } + } + ] + }, + { + "name": "setCookies", + "description": "Sets given cookies.", + "parameters": [ + { + "name": "cookies", + "description": "Cookies to be set.", + "type": "array", + "items": { + "$ref": "Network.CookieParam" + } + }, + { + "name": "browserContextId", + "description": "Browser context to use when called on the browser endpoint.", + "optional": true, + "$ref": "Browser.BrowserContextID" + } + ] + }, + { + "name": "clearCookies", + "description": "Clears cookies.", + "parameters": [ + { + "name": "browserContextId", + "description": "Browser context to use when called on the browser endpoint.", + "optional": true, + "$ref": "Browser.BrowserContextID" + } + ] + }, { "name": "getUsageAndQuota", "description": "Returns usage and quota in bytes.", @@ -13493,6 +18533,11 @@ "description": "Storage quota (bytes).", "type": "number" }, + { + "name": "overrideActive", + "description": "Whether or not the origin has an active storage quota override", + "type": "boolean" + }, { "name": "usageBreakdown", "description": "Storage usage per type (bytes).", @@ -13503,6 +18548,24 @@ } ] }, + { + "name": "overrideQuotaForOrigin", + "description": "Override quota for the specified origin", + "experimental": true, + "parameters": [ + { + "name": "origin", + "description": "Security origin.", + "type": "string" + }, + { + "name": "quotaSize", + "description": "The quota size (in bytes) to override the original quota with.\nIf this is called multiple times, the overridden quota will be equal to\nthe quotaSize provided in the final call. If this is called without\nspecifying a quotaSize, the quota will be reset to the default value for\nthe specified origin. If this is called multiple times with different\norigins, the override will be maintained for each origin until it is\ndisabled (called without a quotaSize).", + "optional": true, + "type": "number" + } + ] + }, { "name": "trackCacheStorageForOrigin", "description": "Registers origin to be notified when an update occurs to its cache storage list.", @@ -13546,6 +18609,38 @@ "type": "string" } ] + }, + { + "name": "getTrustTokens", + "description": "Returns the number of stored Trust Tokens per issuer for the\ncurrent browsing context.", + "experimental": true, + "returns": [ + { + "name": "tokens", + "type": "array", + "items": { + "$ref": "TrustTokens" + } + } + ] + }, + { + "name": "clearTrustTokens", + "description": "Removes all Trust Tokens issued by the provided issuerOrigin.\nLeaves other stored data, including the issuer's Redemption Records, intact.", + "experimental": true, + "parameters": [ + { + "name": "issuerOrigin", + "type": "string" + } + ], + "returns": [ + { + "name": "didDeleteTokens", + "description": "True if any tokens were deleted, false otherwise.", + "type": "boolean" + } + ] } ], "events": [ @@ -13630,6 +18725,18 @@ "description": "PCI ID of the GPU device, if available; 0 otherwise.", "type": "number" }, + { + "name": "subSysId", + "description": "Sub sys ID of the GPU, only available on Windows.", + "optional": true, + "type": "number" + }, + { + "name": "revision", + "description": "Revision of the GPU, only available on Windows.", + "optional": true, + "type": "number" + }, { "name": "vendorString", "description": "String description of the GPU vendor, if the PCI ID is not available.", @@ -13727,6 +18834,16 @@ "yuv444" ] }, + { + "id": "ImageType", + "description": "Image format of a given image.", + "type": "string", + "enum": [ + "jpeg", + "webp", + "unknown" + ] + }, { "id": "ImageDecodeAcceleratorCapability", "description": "Describes a supported image decoding profile with its associated minimum and\nmaximum resolutions and subsampling.", @@ -13735,7 +18852,7 @@ { "name": "imageType", "description": "Image coded, e.g. Jpeg.", - "type": "string" + "$ref": "ImageType" }, { "name": "maxDimensions", @@ -13895,11 +19012,6 @@ "description": "Unique identifier of attached debugging session.", "type": "string" }, - { - "id": "BrowserContextID", - "experimental": true, - "type": "string" - }, { "id": "TargetInfo", "type": "object", @@ -13931,11 +19043,24 @@ "optional": true, "$ref": "TargetID" }, + { + "name": "canAccessOpener", + "description": "Whether the target has access to the originating window.", + "experimental": true, + "type": "boolean" + }, + { + "name": "openerFrameId", + "description": "Frame id of originating window (is only set if target has an opener).", + "experimental": true, + "optional": true, + "$ref": "Page.FrameId" + }, { "name": "browserContextId", "experimental": true, "optional": true, - "$ref": "BrowserContextID" + "$ref": "Browser.BrowserContextID" } ] }, @@ -13976,8 +19101,7 @@ }, { "name": "flatten", - "description": "Enables \"flat\" access to the session via specifying sessionId attribute in the commands.", - "experimental": true, + "description": "Enables \"flat\" access to the session via specifying sessionId attribute in the commands.\nWe plan to make this the default, deprecate non-flattened mode,\nand eventually retire it. See crbug.com/991325.", "optional": true, "type": "boolean" } @@ -14014,6 +19138,8 @@ "returns": [ { "name": "success", + "description": "Always set to true. If an error occurs, the response indicates protocol error.", + "deprecated": true, "type": "boolean" } ] @@ -14039,11 +19165,40 @@ "name": "createBrowserContext", "description": "Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than\none.", "experimental": true, + "parameters": [ + { + "name": "disposeOnDetach", + "description": "If specified, disposes this context when debugging session disconnects.", + "optional": true, + "type": "boolean" + }, + { + "name": "proxyServer", + "description": "Proxy server, similar to the one passed to --proxy-server", + "optional": true, + "type": "string" + }, + { + "name": "proxyBypassList", + "description": "Proxy bypass list, similar to the one passed to --proxy-bypass-list", + "optional": true, + "type": "string" + }, + { + "name": "originsWithUniversalNetworkAccess", + "description": "An optional list of origins to grant unlimited cross-origin access to.\nParts of the URL other than those constituting origin are ignored.", + "optional": true, + "type": "array", + "items": { + "type": "string" + } + } + ], "returns": [ { "name": "browserContextId", "description": "The id of the context created.", - "$ref": "BrowserContextID" + "$ref": "Browser.BrowserContextID" } ] }, @@ -14057,7 +19212,7 @@ "description": "An array of browser context ids.", "type": "array", "items": { - "$ref": "BrowserContextID" + "$ref": "Browser.BrowserContextID" } } ] @@ -14068,7 +19223,7 @@ "parameters": [ { "name": "url", - "description": "The initial URL the page will be navigated to.", + "description": "The initial URL the page will be navigated to. An empty string indicates about:blank.", "type": "string" }, { @@ -14086,8 +19241,9 @@ { "name": "browserContextId", "description": "The browser context to create the page in.", + "experimental": true, "optional": true, - "$ref": "BrowserContextID" + "$ref": "Browser.BrowserContextID" }, { "name": "enableBeginFrameControl", @@ -14143,7 +19299,7 @@ "parameters": [ { "name": "browserContextId", - "$ref": "BrowserContextID" + "$ref": "Browser.BrowserContextID" } ] }, @@ -14181,7 +19337,8 @@ }, { "name": "sendMessageToTarget", - "description": "Sends protocol message over session with given id.", + "description": "Sends protocol message over session with given id.\nConsider using flat mode instead; see commands attachToTarget, setAutoAttach,\nand crbug.com/991325.", + "deprecated": true, "parameters": [ { "name": "message", @@ -14204,7 +19361,7 @@ }, { "name": "setAutoAttach", - "description": "Controls whether to automatically attach to new targets which are considered to be related to\nthis one. When turned on, attaches to all existing related targets as well. When turned off,\nautomatically detaches from all currently attached targets.", + "description": "Controls whether to automatically attach to new targets which are considered to be related to\nthis one. When turned on, attaches to all existing related targets as well. When turned off,\nautomatically detaches from all currently attached targets.\nThis also clears all targets added by `autoAttachRelated` from the list of targets to watch\nfor creation of related targets.", "experimental": true, "parameters": [ { @@ -14219,13 +19376,28 @@ }, { "name": "flatten", - "description": "Enables \"flat\" access to the session via specifying sessionId attribute in the commands.", - "experimental": true, + "description": "Enables \"flat\" access to the session via specifying sessionId attribute in the commands.\nWe plan to make this the default, deprecate non-flattened mode,\nand eventually retire it. See crbug.com/991325.", "optional": true, "type": "boolean" } ] }, + { + "name": "autoAttachRelated", + "description": "Adds the specified target to the list of targets that will be monitored for any related target\ncreation (such as child frames, child workers and new versions of service worker) and reported\nthrough `attachedToTarget`. The specified target is also auto-attached.\nThis cancels the effect of any previous `setAutoAttach` and is also cancelled by subsequent\n`setAutoAttach`. Only available at the Browser target.", + "experimental": true, + "parameters": [ + { + "name": "targetId", + "$ref": "TargetID" + }, + { + "name": "waitForDebuggerOnStart", + "description": "Whether to pause new targets when attaching to them. Use `Runtime.runIfWaitingForDebugger`\nto run paused targets.", + "type": "boolean" + } + ] + }, { "name": "setDiscoverTargets", "description": "Controls whether to discover available targets and notify via\n`targetCreated/targetInfoChanged/targetDestroyed` events.", @@ -14505,12 +19677,32 @@ ] }, { - "id": "StreamCompression", - "description": "Compression type to use for traces returned via streams.", + "id": "StreamCompression", + "description": "Compression type to use for traces returned via streams.", + "type": "string", + "enum": [ + "none", + "gzip" + ] + }, + { + "id": "MemoryDumpLevelOfDetail", + "description": "Details exposed when memory request explicitly declared.\nKeep consistent with memory_dump_request_args.h and\nmemory_instrumentation.mojom", + "type": "string", + "enum": [ + "background", + "light", + "detailed" + ] + }, + { + "id": "TracingBackend", + "description": "Backend type to use for tracing. `chrome` uses the Chrome-integrated\ntracing service and is supported on all platforms. `system` is only\nsupported on Chrome OS and uses the Perfetto system tracing service.\n`auto` chooses `system` when the perfettoConfig provided to Tracing.start\nspecifies at least one non-Chrome data source; otherwise uses `chrome`.", "type": "string", "enum": [ - "none", - "gzip" + "auto", + "chrome", + "system" ] } ], @@ -14547,6 +19739,20 @@ { "name": "requestMemoryDump", "description": "Request a global memory dump.", + "parameters": [ + { + "name": "deterministic", + "description": "Enables more deterministic results by forcing garbage collection", + "optional": true, + "type": "boolean" + }, + { + "name": "levelOfDetail", + "description": "Specifies level of details in memory dump. Defaults to \"detailed\".", + "optional": true, + "$ref": "MemoryDumpLevelOfDetail" + } + ], "returns": [ { "name": "dumpGuid", @@ -14610,6 +19816,18 @@ "name": "traceConfig", "optional": true, "$ref": "TraceConfig" + }, + { + "name": "perfettoConfig", + "description": "Base64-encoded serialized perfetto.protos.TraceConfig protobuf message\nWhen specified, the parameters `categories`, `options`, `traceConfig`\nare ignored. (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" + }, + { + "name": "tracingBackend", + "description": "Backend type (defaults to `auto`)", + "optional": true, + "$ref": "TracingBackend" } ] } @@ -14685,7 +19903,6 @@ { "domain": "Fetch", "description": "A domain for letting clients substitute browser's network layer with client code.", - "experimental": true, "dependencies": [ "Network", "IO", @@ -14699,8 +19916,7 @@ }, { "id": "RequestStage", - "description": "Stages of the request to handle. Request will intercept before the request is\nsent. Response will intercept after the response is received (but before response\nbody is received.", - "experimental": true, + "description": "Stages of the request to handle. Request will intercept before the request is\nsent. Response will intercept after the response is received (but before response\nbody is received).", "type": "string", "enum": [ "Request", @@ -14709,12 +19925,11 @@ }, { "id": "RequestPattern", - "experimental": true, "type": "object", "properties": [ { "name": "urlPattern", - "description": "Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is\nbackslash. Omitting is equivalent to \"*\".", + "description": "Wildcards (`'*'` -> zero or more, `'?'` -> exactly one) are allowed. Escape character is\nbackslash. Omitting is equivalent to `\"*\"`.", "optional": true, "type": "string" }, @@ -14726,7 +19941,7 @@ }, { "name": "requestStage", - "description": "Stage at wich to begin intercepting requests. Default is Request.", + "description": "Stage at which to begin intercepting requests. Default is Request.", "optional": true, "$ref": "RequestStage" } @@ -14750,7 +19965,6 @@ { "id": "AuthChallenge", "description": "Authorization challenge for HTTP status code 401 or 407.", - "experimental": true, "type": "object", "properties": [ { @@ -14783,7 +19997,6 @@ { "id": "AuthChallengeResponse", "description": "Response to an AuthChallenge.", - "experimental": true, "type": "object", "properties": [ { @@ -14870,20 +20083,27 @@ { "name": "responseHeaders", "description": "Response headers.", + "optional": true, "type": "array", "items": { "$ref": "HeaderEntry" } }, + { + "name": "binaryResponseHeaders", + "description": "Alternative way of specifying response headers as a \\0-separated\nseries of name: value pairs. Prefer the above method unless you\nneed to represent some non-UTF8 values that can't be transmitted\nover the protocol as text. (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" + }, { "name": "body", - "description": "A response body.", + "description": "A response body. If absent, original response body will be used if\nthe request is intercepted at the response stage and empty body\nwill be used if the request is intercepted at the request stage. (Encoded as a base64 string when passed over JSON)", "optional": true, "type": "string" }, { "name": "responsePhrase", - "description": "A textual representation of responseCode.\nIf absent, a standard phrase mathcing responseCode is used.", + "description": "A textual representation of responseCode.\nIf absent, a standard phrase matching responseCode is used.", "optional": true, "type": "string" } @@ -14912,18 +20132,25 @@ }, { "name": "postData", - "description": "If set, overrides the post data in the request.", + "description": "If set, overrides the post data in the request. (Encoded as a base64 string when passed over JSON)", "optional": true, "type": "string" }, { "name": "headers", - "description": "If set, overrides the request headrts.", + "description": "If set, overrides the request headers.", "optional": true, "type": "array", "items": { "$ref": "HeaderEntry" } + }, + { + "name": "interceptResponse", + "description": "If set, overrides response interception behavior for this request.", + "experimental": true, + "optional": true, + "type": "boolean" } ] }, @@ -14943,6 +20170,45 @@ } ] }, + { + "name": "continueResponse", + "description": "Continues loading of the paused response, optionally modifying the\nresponse headers. If either responseCode or headers are modified, all of them\nmust be present.", + "experimental": true, + "parameters": [ + { + "name": "requestId", + "description": "An id the client received in requestPaused event.", + "$ref": "RequestId" + }, + { + "name": "responseCode", + "description": "An HTTP response code. If absent, original response code will be used.", + "optional": true, + "type": "integer" + }, + { + "name": "responsePhrase", + "description": "A textual representation of responseCode.\nIf absent, a standard phrase matching responseCode is used.", + "optional": true, + "type": "string" + }, + { + "name": "responseHeaders", + "description": "Response headers. If absent, original response headers will be used.", + "optional": true, + "type": "array", + "items": { + "$ref": "HeaderEntry" + } + }, + { + "name": "binaryResponseHeaders", + "description": "Alternative way of specifying response headers as a \\0-separated\nseries of name: value pairs. Prefer the above method unless you\nneed to represent some non-UTF8 values that can't be transmitted\nover the protocol as text. (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" + } + ] + }, { "name": "getResponseBody", "description": "Causes the body of the response to be received from the server and\nreturned as a single string. May only be issued for a request that\nis paused in the Response stage and is mutually exclusive with\ntakeResponseBodyForInterceptionAsStream. Calling other methods that\naffect the request or disabling fetch domain before body is received\nresults in an undefined behavior.", @@ -15020,6 +20286,12 @@ "optional": true, "type": "integer" }, + { + "name": "responseStatusText", + "description": "Response status text if intercepted at response stage.", + "optional": true, + "type": "string" + }, { "name": "responseHeaders", "description": "Response headers if intercepted at the response stage.", @@ -15076,8 +20348,8 @@ "experimental": true, "types": [ { - "id": "ContextId", - "description": "Context's UUID in string", + "id": "GraphObjectId", + "description": "An unique ID for a graph object (AudioContext, AudioNode, AudioParam) in Web Audio API", "type": "string" }, { @@ -15099,6 +20371,44 @@ "closed" ] }, + { + "id": "NodeType", + "description": "Enum of AudioNode types", + "type": "string" + }, + { + "id": "ChannelCountMode", + "description": "Enum of AudioNode::ChannelCountMode from the spec", + "type": "string", + "enum": [ + "clamped-max", + "explicit", + "max" + ] + }, + { + "id": "ChannelInterpretation", + "description": "Enum of AudioNode::ChannelInterpretation from the spec", + "type": "string", + "enum": [ + "discrete", + "speakers" + ] + }, + { + "id": "ParamType", + "description": "Enum of AudioParam types", + "type": "string" + }, + { + "id": "AutomationRate", + "description": "Enum of AudioParam::AutomationRate from the spec", + "type": "string", + "enum": [ + "a-rate", + "k-rate" + ] + }, { "id": "ContextRealtimeData", "description": "Fields in AudioContext that change in real-time.", @@ -15111,7 +20421,7 @@ }, { "name": "renderCapacity", - "description": "The time spent on rendering graph divided by render qunatum duration,\nand multiplied by 100. 100 means the audio renderer reached the full\ncapacity and glitch may occur.", + "description": "The time spent on rendering graph divided by render quantum duration,\nand multiplied by 100. 100 means the audio renderer reached the full\ncapacity and glitch may occur.", "type": "number" }, { @@ -15133,7 +20443,7 @@ "properties": [ { "name": "contextId", - "$ref": "ContextId" + "$ref": "GraphObjectId" }, { "name": "contextType", @@ -15164,6 +20474,99 @@ "type": "number" } ] + }, + { + "id": "AudioListener", + "description": "Protocol object for AudioListener", + "type": "object", + "properties": [ + { + "name": "listenerId", + "$ref": "GraphObjectId" + }, + { + "name": "contextId", + "$ref": "GraphObjectId" + } + ] + }, + { + "id": "AudioNode", + "description": "Protocol object for AudioNode", + "type": "object", + "properties": [ + { + "name": "nodeId", + "$ref": "GraphObjectId" + }, + { + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "nodeType", + "$ref": "NodeType" + }, + { + "name": "numberOfInputs", + "type": "number" + }, + { + "name": "numberOfOutputs", + "type": "number" + }, + { + "name": "channelCount", + "type": "number" + }, + { + "name": "channelCountMode", + "$ref": "ChannelCountMode" + }, + { + "name": "channelInterpretation", + "$ref": "ChannelInterpretation" + } + ] + }, + { + "id": "AudioParam", + "description": "Protocol object for AudioParam", + "type": "object", + "properties": [ + { + "name": "paramId", + "$ref": "GraphObjectId" + }, + { + "name": "nodeId", + "$ref": "GraphObjectId" + }, + { + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "paramType", + "$ref": "ParamType" + }, + { + "name": "rate", + "$ref": "AutomationRate" + }, + { + "name": "defaultValue", + "type": "number" + }, + { + "name": "minValue", + "type": "number" + }, + { + "name": "maxValue", + "type": "number" + } + ] } ], "commands": [ @@ -15181,7 +20584,7 @@ "parameters": [ { "name": "contextId", - "$ref": "ContextId" + "$ref": "GraphObjectId" } ], "returns": [ @@ -15190,36 +20593,214 @@ "$ref": "ContextRealtimeData" } ] - } - ], - "events": [ + } + ], + "events": [ + { + "name": "contextCreated", + "description": "Notifies that a new BaseAudioContext has been created.", + "parameters": [ + { + "name": "context", + "$ref": "BaseAudioContext" + } + ] + }, + { + "name": "contextWillBeDestroyed", + "description": "Notifies that an existing BaseAudioContext will be destroyed.", + "parameters": [ + { + "name": "contextId", + "$ref": "GraphObjectId" + } + ] + }, + { + "name": "contextChanged", + "description": "Notifies that existing BaseAudioContext has changed some properties (id stays the same)..", + "parameters": [ + { + "name": "context", + "$ref": "BaseAudioContext" + } + ] + }, + { + "name": "audioListenerCreated", + "description": "Notifies that the construction of an AudioListener has finished.", + "parameters": [ + { + "name": "listener", + "$ref": "AudioListener" + } + ] + }, + { + "name": "audioListenerWillBeDestroyed", + "description": "Notifies that a new AudioListener has been created.", + "parameters": [ + { + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "listenerId", + "$ref": "GraphObjectId" + } + ] + }, + { + "name": "audioNodeCreated", + "description": "Notifies that a new AudioNode has been created.", + "parameters": [ + { + "name": "node", + "$ref": "AudioNode" + } + ] + }, + { + "name": "audioNodeWillBeDestroyed", + "description": "Notifies that an existing AudioNode has been destroyed.", + "parameters": [ + { + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "nodeId", + "$ref": "GraphObjectId" + } + ] + }, + { + "name": "audioParamCreated", + "description": "Notifies that a new AudioParam has been created.", + "parameters": [ + { + "name": "param", + "$ref": "AudioParam" + } + ] + }, + { + "name": "audioParamWillBeDestroyed", + "description": "Notifies that an existing AudioParam has been destroyed.", + "parameters": [ + { + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "nodeId", + "$ref": "GraphObjectId" + }, + { + "name": "paramId", + "$ref": "GraphObjectId" + } + ] + }, + { + "name": "nodesConnected", + "description": "Notifies that two AudioNodes are connected.", + "parameters": [ + { + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "sourceId", + "$ref": "GraphObjectId" + }, + { + "name": "destinationId", + "$ref": "GraphObjectId" + }, + { + "name": "sourceOutputIndex", + "optional": true, + "type": "number" + }, + { + "name": "destinationInputIndex", + "optional": true, + "type": "number" + } + ] + }, { - "name": "contextCreated", - "description": "Notifies that a new BaseAudioContext has been created.", + "name": "nodesDisconnected", + "description": "Notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected.", "parameters": [ { - "name": "context", - "$ref": "BaseAudioContext" + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "sourceId", + "$ref": "GraphObjectId" + }, + { + "name": "destinationId", + "$ref": "GraphObjectId" + }, + { + "name": "sourceOutputIndex", + "optional": true, + "type": "number" + }, + { + "name": "destinationInputIndex", + "optional": true, + "type": "number" } ] }, { - "name": "contextDestroyed", - "description": "Notifies that existing BaseAudioContext has been destroyed.", + "name": "nodeParamConnected", + "description": "Notifies that an AudioNode is connected to an AudioParam.", "parameters": [ { "name": "contextId", - "$ref": "ContextId" + "$ref": "GraphObjectId" + }, + { + "name": "sourceId", + "$ref": "GraphObjectId" + }, + { + "name": "destinationId", + "$ref": "GraphObjectId" + }, + { + "name": "sourceOutputIndex", + "optional": true, + "type": "number" } ] }, { - "name": "contextChanged", - "description": "Notifies that existing BaseAudioContext has changed some properties (id stays the same)..", + "name": "nodeParamDisconnected", + "description": "Notifies that an AudioNode is disconnected to an AudioParam.", "parameters": [ { - "name": "context", - "$ref": "BaseAudioContext" + "name": "contextId", + "$ref": "GraphObjectId" + }, + { + "name": "sourceId", + "$ref": "GraphObjectId" + }, + { + "name": "destinationId", + "$ref": "GraphObjectId" + }, + { + "name": "sourceOutputIndex", + "optional": true, + "type": "number" } ] } @@ -15242,6 +20823,14 @@ "ctap2" ] }, + { + "id": "Ctap2Version", + "type": "string", + "enum": [ + "ctap2_0", + "ctap2_1" + ] + }, { "id": "AuthenticatorTransport", "type": "string", @@ -15261,16 +20850,44 @@ "name": "protocol", "$ref": "AuthenticatorProtocol" }, + { + "name": "ctap2Version", + "description": "Defaults to ctap2_0. Ignored if |protocol| == u2f.", + "optional": true, + "$ref": "Ctap2Version" + }, { "name": "transport", "$ref": "AuthenticatorTransport" }, { "name": "hasResidentKey", + "description": "Defaults to false.", + "optional": true, "type": "boolean" }, { "name": "hasUserVerification", + "description": "Defaults to false.", + "optional": true, + "type": "boolean" + }, + { + "name": "hasLargeBlob", + "description": "If set to true, the authenticator will support the largeBlob extension.\nhttps://w3c.github.io/webauthn#largeBlob\nDefaults to false.", + "optional": true, + "type": "boolean" + }, + { + "name": "hasCredBlob", + "description": "If set to true, the authenticator will support the credBlob extension.\nhttps://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension\nDefaults to false.", + "optional": true, + "type": "boolean" + }, + { + "name": "hasMinPinLength", + "description": "If set to true, the authenticator will support the minPinLength extension.\nhttps://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension\nDefaults to false.", + "optional": true, "type": "boolean" }, { @@ -15278,6 +20895,12 @@ "description": "If set to true, tests of user presence will succeed immediately.\nOtherwise, they will not be resolved. Defaults to true.", "optional": true, "type": "boolean" + }, + { + "name": "isUserVerified", + "description": "Sets whether User Verification succeeds or fails for an authenticator.\nDefaults to false.", + "optional": true, + "type": "boolean" } ] }, @@ -15290,19 +20913,36 @@ "type": "string" }, { - "name": "rpIdHash", - "description": "SHA-256 hash of the Relying Party ID the credential is scoped to. Must\nbe 32 bytes long.\nSee https://w3c.github.io/webauthn/#rpidhash", + "name": "isResidentCredential", + "type": "boolean" + }, + { + "name": "rpId", + "description": "Relying Party ID the credential is scoped to. Must be set when adding a\ncredential.", + "optional": true, "type": "string" }, { "name": "privateKey", - "description": "The private key in PKCS#8 format.", + "description": "The ECDSA P-256 private key in PKCS#8 format. (Encoded as a base64 string when passed over JSON)", + "type": "string" + }, + { + "name": "userHandle", + "description": "An opaque byte sequence with a maximum size of 64 bytes mapping the\ncredential to a specific user. (Encoded as a base64 string when passed over JSON)", + "optional": true, "type": "string" }, { "name": "signCount", "description": "Signature counter. This is incremented by one for each successful\nassertion.\nSee https://w3c.github.io/webauthn/#signature-counter", "type": "integer" + }, + { + "name": "largeBlob", + "description": "The large blob associated with the credential.\nSee https://w3c.github.io/webauthn/#sctn-large-blob-extension (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" } ] } @@ -15356,6 +20996,26 @@ } ] }, + { + "name": "getCredential", + "description": "Returns a single credential stored in the given virtual authenticator that\nmatches the credential ID.", + "parameters": [ + { + "name": "authenticatorId", + "$ref": "AuthenticatorId" + }, + { + "name": "credentialId", + "type": "string" + } + ], + "returns": [ + { + "name": "credential", + "$ref": "Credential" + } + ] + }, { "name": "getCredentials", "description": "Returns all the credentials stored in the given virtual authenticator.", @@ -15375,6 +21035,20 @@ } ] }, + { + "name": "removeCredential", + "description": "Removes a credential from the authenticator.", + "parameters": [ + { + "name": "authenticatorId", + "$ref": "AuthenticatorId" + }, + { + "name": "credentialId", + "type": "string" + } + ] + }, { "name": "clearCredentials", "description": "Clears all the credentials from the specified device.", @@ -15398,6 +21072,201 @@ "type": "boolean" } ] + }, + { + "name": "setAutomaticPresenceSimulation", + "description": "Sets whether tests of user presence will succeed immediately (if true) or fail to resolve (if false) for an authenticator.\nThe default is true.", + "parameters": [ + { + "name": "authenticatorId", + "$ref": "AuthenticatorId" + }, + { + "name": "enabled", + "type": "boolean" + } + ] + } + ] + }, + { + "domain": "Media", + "description": "This domain allows detailed inspection of media elements", + "experimental": true, + "types": [ + { + "id": "PlayerId", + "description": "Players will get an ID that is unique within the agent context.", + "type": "string" + }, + { + "id": "Timestamp", + "type": "number" + }, + { + "id": "PlayerMessage", + "description": "Have one type per entry in MediaLogRecord::Type\nCorresponds to kMessage", + "type": "object", + "properties": [ + { + "name": "level", + "description": "Keep in sync with MediaLogMessageLevel\nWe are currently keeping the message level 'error' separate from the\nPlayerError type because right now they represent different things,\nthis one being a DVLOG(ERROR) style log message that gets printed\nbased on what log level is selected in the UI, and the other is a\nrepresentation of a media::PipelineStatus object. Soon however we're\ngoing to be moving away from using PipelineStatus for errors and\nintroducing a new error type which should hopefully let us integrate\nthe error log level into the PlayerError type.", + "type": "string", + "enum": [ + "error", + "warning", + "info", + "debug" + ] + }, + { + "name": "message", + "type": "string" + } + ] + }, + { + "id": "PlayerProperty", + "description": "Corresponds to kMediaPropertyChange", + "type": "object", + "properties": [ + { + "name": "name", + "type": "string" + }, + { + "name": "value", + "type": "string" + } + ] + }, + { + "id": "PlayerEvent", + "description": "Corresponds to kMediaEventTriggered", + "type": "object", + "properties": [ + { + "name": "timestamp", + "$ref": "Timestamp" + }, + { + "name": "value", + "type": "string" + } + ] + }, + { + "id": "PlayerError", + "description": "Corresponds to kMediaError", + "type": "object", + "properties": [ + { + "name": "type", + "type": "string", + "enum": [ + "pipeline_error", + "media_error" + ] + }, + { + "name": "errorCode", + "description": "When this switches to using media::Status instead of PipelineStatus\nwe can remove \"errorCode\" and replace it with the fields from\na Status instance. This also seems like a duplicate of the error\nlevel enum - there is a todo bug to have that level removed and\nuse this instead. (crbug.com/1068454)", + "type": "string" + } + ] + } + ], + "events": [ + { + "name": "playerPropertiesChanged", + "description": "This can be called multiple times, and can be used to set / override /\nremove player properties. A null propValue indicates removal.", + "parameters": [ + { + "name": "playerId", + "$ref": "PlayerId" + }, + { + "name": "properties", + "type": "array", + "items": { + "$ref": "PlayerProperty" + } + } + ] + }, + { + "name": "playerEventsAdded", + "description": "Send events as a list, allowing them to be batched on the browser for less\ncongestion. If batched, events must ALWAYS be in chronological order.", + "parameters": [ + { + "name": "playerId", + "$ref": "PlayerId" + }, + { + "name": "events", + "type": "array", + "items": { + "$ref": "PlayerEvent" + } + } + ] + }, + { + "name": "playerMessagesLogged", + "description": "Send a list of any messages that need to be delivered.", + "parameters": [ + { + "name": "playerId", + "$ref": "PlayerId" + }, + { + "name": "messages", + "type": "array", + "items": { + "$ref": "PlayerMessage" + } + } + ] + }, + { + "name": "playerErrorsRaised", + "description": "Send a list of any errors that need to be delivered.", + "parameters": [ + { + "name": "playerId", + "$ref": "PlayerId" + }, + { + "name": "errors", + "type": "array", + "items": { + "$ref": "PlayerError" + } + } + ] + }, + { + "name": "playersCreated", + "description": "Called whenever a player is created, or when a new agent joins and receives\na list of active players. If an agent is restored, it will receive the full\nlist of player ids and all events again.", + "parameters": [ + { + "name": "players", + "type": "array", + "items": { + "$ref": "PlayerId" + } + } + ] + } + ], + "commands": [ + { + "name": "enable", + "description": "Enables the Media domain" + }, + { + "name": "disable", + "description": "Disables the Media domain." } ] } diff --git a/generator/generate.py b/generator/generate.py index 6f2d9d3..928adec 100644 --- a/generator/generate.py +++ b/generator/generate.py @@ -90,7 +90,7 @@ def docstring(description: typing.Optional[str]) -> str: return '' description = escape_backticks(description) - return dedent("'''\n{}\n'''").format(description) + return dedent("r'''\n{}\n'''").format(description) def is_builtin(name: str) -> bool: @@ -596,7 +596,8 @@ def generate_code(self) -> str: if self.parameters: code += '\n' code += indent( - ',\n'.join(p.generate_code() for p in self.parameters), 8) + ',\n'.join([p.generate_code() for p in self.parameters if not p.optional] + [p.generate_code() for p in self.parameters if p.optional]), + 8) code += '\n' code += indent(ret, 4) else: @@ -951,6 +952,38 @@ def generate_docs(docs_path, domains): f.write(domain.generate_sphinx()) +def patchCDP(domains): + '''Patch up CDP errors. It's easier to patch that here than it is to modify the generator code.''' + + # 1. DOM includes an erroneous $ref that refers to itself. + # 2. Page includes an event with an extraneous backtick in the description. + # 3. Network.requestWillBeSent.redirectHasExtraInfo is not marked as optional but it is not present in all events + # 4. Network.responseReceived.hasExtraInfo is not marked as optional but it is not present in all events + for domain in domains: + if domain.domain == 'DOM': + for cmd in domain.commands: + if cmd.name == 'resolveNode': + # Patch 1 + cmd.parameters[1].ref = 'BackendNodeId' + elif domain.domain == 'Page': + for event in domain.events: + if event.name == 'screencastVisibilityChanged': + # Patch 2 + event.description = event.description.replace('`', '') + elif domain.domain == 'Network': + for event in domain.events: + if event.name == 'requestWillBeSent': + for param in event.parameters: + if param.name == 'redirectHasExtraInfo': + # Patch 3 + param.optional = True + if event.name == 'responseReceived': + for param in event.parameters: + if param.name == 'hasExtraInfo': + # Patch 4 + param.optional = True + + def main(): ''' Main entry point. ''' here = Path(__file__).parent.resolve() @@ -973,21 +1006,7 @@ def main(): domains.extend(parse(json_path, output_path)) domains.sort(key=operator.attrgetter('domain')) - # Patch up CDP errors. It's easier to patch that here than it is to modify - # the generator code. - # 1. DOM includes an erroneous $ref that refers to itself. - # 2. Page includes an event with an extraneous backtick in the description. - for domain in domains: - if domain.domain == 'DOM': - for cmd in domain.commands: - if cmd.name == 'resolveNode': - # Patch 1 - cmd.parameters[1].ref = 'BackendNodeId' - elif domain.domain == 'Page': - for event in domain.events: - if event.name == 'screencastVisibilityChanged': - # Patch 2 - event.description = event.description.replace('`', '') + patchCDP(domains) for domain in domains: logger.info('Generating module: %s → %s.py', domain.domain, diff --git a/generator/js_protocol.json b/generator/js_protocol.json index 004daa2..727d69e 100644 --- a/generator/js_protocol.json +++ b/generator/js_protocol.json @@ -157,6 +157,26 @@ } ] }, + { + "id": "LocationRange", + "description": "Location range within one script.", + "experimental": true, + "type": "object", + "properties": [ + { + "name": "scriptId", + "$ref": "Runtime.ScriptId" + }, + { + "name": "start", + "$ref": "ScriptPosition" + }, + { + "name": "end", + "$ref": "ScriptPosition" + } + ] + }, { "id": "CallFrame", "description": "JavaScript call frame. Array of call frames form the call stack.", @@ -227,7 +247,8 @@ "block", "script", "eval", - "module" + "module", + "wasm-expression-stack" ] }, { @@ -302,6 +323,39 @@ ] } ] + }, + { + "id": "ScriptLanguage", + "description": "Enum of possible script languages.", + "type": "string", + "enum": [ + "JavaScript", + "WebAssembly" + ] + }, + { + "id": "DebugSymbols", + "description": "Debug symbols available for a wasm script.", + "type": "object", + "properties": [ + { + "name": "type", + "description": "Type of the debug symbols.", + "type": "string", + "enum": [ + "None", + "SourceMap", + "EmbeddedDWARF", + "ExternalDWARF" + ] + }, + { + "name": "externalURL", + "description": "URL of the external symbol source.", + "optional": true, + "type": "string" + } + ] } ], "commands": [ @@ -335,7 +389,7 @@ "parameters": [ { "name": "maxScriptsCacheSize", - "description": "The maximum size in bytes of collected scripts (not referenced by other heap objects)\nthe debugger can hold. Puts no limit if paramter is omitted.", + "description": "The maximum size in bytes of collected scripts (not referenced by other heap objects)\nthe debugger can hold. Puts no limit if parameter is omitted.", "experimental": true, "optional": true, "type": "number" @@ -469,7 +523,32 @@ "returns": [ { "name": "scriptSource", - "description": "Script source.", + "description": "Script source (empty in case of Wasm bytecode).", + "type": "string" + }, + { + "name": "bytecode", + "description": "Wasm bytecode. (Encoded as a base64 string when passed over JSON)", + "optional": true, + "type": "string" + } + ] + }, + { + "name": "getWasmBytecode", + "description": "This command is deprecated. Use getScriptSource instead.", + "deprecated": true, + "parameters": [ + { + "name": "scriptId", + "description": "Id of the Wasm script to get source for.", + "$ref": "Runtime.ScriptId" + } + ], + "returns": [ + { + "name": "bytecode", + "description": "Script source. (Encoded as a base64 string when passed over JSON)", "type": "string" } ] @@ -498,6 +577,7 @@ { "name": "pauseOnAsyncCall", "experimental": true, + "deprecated": true, "parameters": [ { "name": "parentStackTraceId", @@ -519,6 +599,7 @@ { "name": "restartFrame", "description": "Restarts particular call frame from the beginning.", + "deprecated": true, "parameters": [ { "name": "callFrameId", @@ -552,7 +633,15 @@ }, { "name": "resume", - "description": "Resumes JavaScript execution." + "description": "Resumes JavaScript execution.", + "parameters": [ + { + "name": "terminateOnResume", + "description": "Set to true to terminate execution upon resuming execution. In contrast\nto Runtime.terminateExecution, this will allows to execute further\nJavaScript (i.e. via evaluation) until execution of the paused code\nis actually resumed, at which point termination is triggered.\nIf execution is currently not paused, this parameter has no effect.", + "optional": true, + "type": "boolean" + } + ] }, { "name": "searchInContent", @@ -909,10 +998,20 @@ "parameters": [ { "name": "breakOnAsyncCall", - "description": "Debugger will issue additional Debugger.paused notification if any async task is scheduled\nbefore next pause.", + "description": "Debugger will pause on the execution of the first async task which was scheduled\nbefore next pause.", "experimental": true, "optional": true, "type": "boolean" + }, + { + "name": "skipList", + "description": "The skipList specifies location ranges that should be skipped on step into.", + "experimental": true, + "optional": true, + "type": "array", + "items": { + "$ref": "LocationRange" + } } ] }, @@ -922,7 +1021,19 @@ }, { "name": "stepOver", - "description": "Steps over the statement." + "description": "Steps over the statement.", + "parameters": [ + { + "name": "skipList", + "description": "The skipList specifies location ranges that should be skipped on step over.", + "experimental": true, + "optional": true, + "type": "array", + "items": { + "$ref": "LocationRange" + } + } + ] } ], "events": [ @@ -961,6 +1072,7 @@ "enum": [ "ambiguous", "assert", + "CSPViolation", "debugCommand", "DOM", "EventListener", @@ -1002,8 +1114,9 @@ }, { "name": "asyncCallStackTraceId", - "description": "Just scheduled async call will have this stack trace as parent stack during async execution.\nThis field is available only after `Debugger.stepInto` call with `breakOnAsynCall` flag.", + "description": "Never present, will be removed.", "experimental": true, + "deprecated": true, "optional": true, "$ref": "Runtime.StackTraceId" } @@ -1093,6 +1206,27 @@ "experimental": true, "optional": true, "$ref": "Runtime.StackTrace" + }, + { + "name": "codeOffset", + "description": "If the scriptLanguage is WebAssembly, the code section offset in the module.", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "scriptLanguage", + "description": "The language of the script.", + "experimental": true, + "optional": true, + "$ref": "Debugger.ScriptLanguage" + }, + { + "name": "embedderName", + "description": "The name the embedder supplied for this script.", + "experimental": true, + "optional": true, + "type": "string" } ] }, @@ -1183,6 +1317,34 @@ "experimental": true, "optional": true, "$ref": "Runtime.StackTrace" + }, + { + "name": "codeOffset", + "description": "If the scriptLanguage is WebAssembly, the code section offset in the module.", + "experimental": true, + "optional": true, + "type": "integer" + }, + { + "name": "scriptLanguage", + "description": "The language of the script.", + "experimental": true, + "optional": true, + "$ref": "Debugger.ScriptLanguage" + }, + { + "name": "debugSymbols", + "description": "If the scriptLanguage is WebASsembly, the source of debug symbols for the module.", + "experimental": true, + "optional": true, + "$ref": "Debugger.DebugSymbols" + }, + { + "name": "embedderName", + "description": "The name the embedder supplied for this script.", + "experimental": true, + "optional": true, + "type": "string" } ] } @@ -1380,6 +1542,17 @@ "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken\nwhen the tracking is stopped.", "optional": true, "type": "boolean" + }, + { + "name": "treatGlobalObjectsAsRoots", + "optional": true, + "type": "boolean" + }, + { + "name": "captureNumericValue", + "description": "If true, numerical values are included in the snapshot", + "optional": true, + "type": "boolean" } ] }, @@ -1391,6 +1564,18 @@ "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.", "optional": true, "type": "boolean" + }, + { + "name": "treatGlobalObjectsAsRoots", + "description": "If true, a raw snapshot without artificial roots will be generated", + "optional": true, + "type": "boolean" + }, + { + "name": "captureNumericValue", + "description": "If true, numerical values are included in the snapshot", + "optional": true, + "type": "boolean" } ] } @@ -1753,6 +1938,19 @@ "description": "Collect block-based coverage.", "optional": true, "type": "boolean" + }, + { + "name": "allowTriggeredUpdates", + "description": "Allow the backend to send updates on its own initiative", + "optional": true, + "type": "boolean" + } + ], + "returns": [ + { + "name": "timestamp", + "description": "Monotonically increasing time (in seconds) when the coverage update was taken in the backend.", + "type": "number" } ] }, @@ -1791,6 +1989,11 @@ "items": { "$ref": "ScriptCoverage" } + }, + { + "name": "timestamp", + "description": "Monotonically increasing time (in seconds) when the coverage update was taken in the backend.", + "type": "number" } ] }, @@ -1855,6 +2058,31 @@ "type": "string" } ] + }, + { + "name": "preciseCoverageDeltaUpdate", + "description": "Reports coverage delta since the last poll (either from an event like this, or from\n`takePreciseCoverage` for the current isolate. May only be sent if precise code\ncoverage has been started. This event can be trigged by the embedder to, for example,\ntrigger collection of coverage data immediately at a certain point in time.", + "experimental": true, + "parameters": [ + { + "name": "timestamp", + "description": "Monotonically increasing time (in seconds) when the coverage update was taken in the backend.", + "type": "number" + }, + { + "name": "occasion", + "description": "Identifier for distinguishing coverage events.", + "type": "string" + }, + { + "name": "result", + "description": "Coverage data for the current isolate.", + "type": "array", + "items": { + "$ref": "ScriptCoverage" + } + } + ] } ] }, @@ -1899,7 +2127,7 @@ }, { "name": "subtype", - "description": "Object subtype hint. Specified for `object` type values only.", + "description": "Object subtype hint. Specified for `object` type values only.\nNOTE: If you change anything here, make sure to also update\n`subtype` in `ObjectPreview` and `PropertyPreview` below.", "optional": true, "type": "string", "enum": [ @@ -1919,7 +2147,9 @@ "promise", "typedarray", "arraybuffer", - "dataview" + "dataview", + "webassemblymemory", + "wasmvalue" ] }, { @@ -2023,7 +2253,14 @@ "weakset", "iterator", "generator", - "error" + "error", + "proxy", + "promise", + "typedarray", + "arraybuffer", + "dataview", + "webassemblymemory", + "wasmvalue" ] }, { @@ -2111,7 +2348,14 @@ "weakset", "iterator", "generator", - "error" + "error", + "proxy", + "promise", + "typedarray", + "arraybuffer", + "dataview", + "webassemblymemory", + "wasmvalue" ] } ] @@ -2230,6 +2474,19 @@ { "name": "value", "description": "The value associated with the private property.", + "optional": true, + "$ref": "RemoteObject" + }, + { + "name": "get", + "description": "A function which serves as a getter for the private property,\nor `undefined` if there is no getter (accessor descriptors only).", + "optional": true, + "$ref": "RemoteObject" + }, + { + "name": "set", + "description": "A function which serves as a setter for the private property,\nor `undefined` if there is no setter (accessor descriptors only).", + "optional": true, "$ref": "RemoteObject" } ] @@ -2284,6 +2541,12 @@ "description": "Human readable name describing given context.", "type": "string" }, + { + "name": "uniqueId", + "description": "A system-unique execution context identifier. Unlike the id, this is unique across\nmultiple processes, so can be reliably used to identify specific context while backend\nperforms a cross-process navigation.", + "experimental": true, + "type": "string" + }, { "name": "auxData", "description": "Embedder-specific auxiliary data.", @@ -2346,6 +2609,13 @@ "description": "Identifier of the context where exception happened.", "optional": true, "$ref": "ExecutionContextId" + }, + { + "name": "exceptionMetaData", + "description": "Dictionary with entries of meta data that the client associated\nwith this exception, such as information about associated network\nrequests, etc.", + "experimental": true, + "optional": true, + "type": "object" } ] }, @@ -2552,6 +2822,13 @@ "description": "Symbolic group name that can be used to release multiple objects. If objectGroup is not\nspecified and objectId is, objectGroup will be inherited from object.", "optional": true, "type": "string" + }, + { + "name": "throwOnSideEffect", + "description": "Whether to throw an exception if side effect cannot be ruled out during evaluation.", + "experimental": true, + "optional": true, + "type": "boolean" } ], "returns": [ @@ -2650,7 +2927,7 @@ }, { "name": "contextId", - "description": "Specifies in which execution context to perform evaluation. If the parameter is omitted the\nevaluation will be performed in the context of the inspected page.", + "description": "Specifies in which execution context to perform evaluation. If the parameter is omitted the\nevaluation will be performed in the context of the inspected page.\nThis is mutually exclusive with `uniqueContextId`, which offers an\nalternative way to identify the execution context that is more reliable\nin a multi-process environment.", "optional": true, "$ref": "ExecutionContextId" }, @@ -2681,7 +2958,7 @@ }, { "name": "throwOnSideEffect", - "description": "Whether to throw an exception if side effect cannot be ruled out during evaluation.", + "description": "Whether to throw an exception if side effect cannot be ruled out during evaluation.\nThis implies `disableBreaks` below.", "experimental": true, "optional": true, "type": "boolean" @@ -2692,6 +2969,34 @@ "experimental": true, "optional": true, "$ref": "TimeDelta" + }, + { + "name": "disableBreaks", + "description": "Disable breakpoints during execution.", + "experimental": true, + "optional": true, + "type": "boolean" + }, + { + "name": "replMode", + "description": "Setting this flag to true enables `let` re-declaration and top-level `await`.\nNote that `let` variables can only be re-declared if they originate from\n`replMode` themselves.", + "experimental": true, + "optional": true, + "type": "boolean" + }, + { + "name": "allowUnsafeEvalBlockedByCSP", + "description": "The Content Security Policy (CSP) for the target might block 'unsafe-eval'\nwhich includes eval(), Function(), setTimeout() and setInterval()\nwhen called with non-callable arguments. This flag bypasses CSP for this\nevaluation and allows unsafe-eval. Defaults to true.", + "experimental": true, + "optional": true, + "type": "boolean" + }, + { + "name": "uniqueContextId", + "description": "An alternative way to specify the execution context to evaluate in.\nCompared to contextId that may be reused across processes, this is guaranteed to be\nsystem-unique, so it can be used to prevent accidental evaluation of the expression\nin context different than intended (e.g. as a result of navigation across process\nboundaries).\nThis is mutually exclusive with `contextId`.", + "experimental": true, + "optional": true, + "type": "string" } ], "returns": [ @@ -2765,6 +3070,13 @@ "experimental": true, "optional": true, "type": "boolean" + }, + { + "name": "nonIndexedPropertiesOnly", + "description": "If true, returns non-indexed properties only.", + "experimental": true, + "optional": true, + "type": "boolean" } ], "returns": [ @@ -2978,7 +3290,7 @@ }, { "name": "addBinding", - "description": "If executionContextId is empty, adds binding with the given name on the\nglobal objects of all inspected contexts, including those created later,\nbindings survive reloads.\nIf executionContextId is specified, adds binding only on global object of\ngiven execution context.\nBinding function takes exactly one argument, this argument should be string,\nin case of any other input, function throws an exception.\nEach binding function call produces Runtime.bindingCalled notification.", + "description": "If executionContextId is empty, adds binding with the given name on the\nglobal objects of all inspected contexts, including those created later,\nbindings survive reloads.\nBinding function takes exactly one argument, this argument should be string,\nin case of any other input, function throws an exception.\nEach binding function call produces Runtime.bindingCalled notification.", "experimental": true, "parameters": [ { @@ -2987,8 +3299,17 @@ }, { "name": "executionContextId", + "description": "If specified, the binding would only be exposed to the specified\nexecution context. If omitted and `executionContextName` is not set,\nthe binding is exposed to all execution contexts of the target.\nThis parameter is mutually exclusive with `executionContextName`.\nDeprecated in favor of `executionContextName` due to an unclear use case\nand bugs in implementation (crbug.com/1169639). `executionContextId` will be\nremoved in the future.", + "deprecated": true, "optional": true, "$ref": "ExecutionContextId" + }, + { + "name": "executionContextName", + "description": "If specified, the binding is exposed to the executionContext with\nmatching name, even for contexts created after the binding is added.\nSee also `ExecutionContext.name` and `worldName` parameter to\n`Page.addScriptToEvaluateOnNewDocument`.\nThis parameter is mutually exclusive with `executionContextId`.", + "experimental": true, + "optional": true, + "type": "string" } ] }, @@ -3155,6 +3476,13 @@ { "name": "hints", "type": "object" + }, + { + "name": "executionContextId", + "description": "Identifier of the context where the call was made.", + "experimental": true, + "optional": true, + "$ref": "ExecutionContextId" } ] } diff --git a/generator/test_generate.py b/generator/test_generate.py index e8b2344..ef99854 100644 --- a/generator/test_generate.py +++ b/generator/test_generate.py @@ -25,7 +25,7 @@ def test_docstring(): "widgets\n- from 'activedescendant' to 'owns' - relationships " \ "between elements other than parent/child/sibling." expected = dedent("""\ - ''' + r''' Values of AXProperty name: - from 'busy' to 'roledescription': states which apply to every AX node - from 'live' to 'root': attributes which apply to nodes in live regions @@ -40,13 +40,23 @@ def test_docstring(): def test_escape_docstring(): description = 'Escape a `Backtick` and some `Backtick`s.' expected = dedent("""\ - ''' + r''' Escape a ``Backtick`` and some ``Backtick``'s. '''""") actual = docstring(description) assert expected == actual +def test_escape_zero_char(): + description = r'String is terminated by \0 character' + expected = dedent("""\ + r''' + String is terminated by \\0 character + '''""") + actual = docstring(description) + assert expected == actual + + def test_cdp_primitive_type(): json_type = { "id": "AXNodeId", @@ -55,7 +65,7 @@ def test_cdp_primitive_type(): } expected = dedent("""\ class AXNodeId(str): - ''' + r''' Unique accessibility node identifier. ''' def to_json(self) -> str: @@ -84,7 +94,7 @@ def test_cdp_array_of_primitive_type(): } expected = dedent("""\ class ArrayOfStrings(list): - ''' + r''' Index of the string in the strings table. ''' def to_json(self) -> typing.List[StringIndex]: @@ -118,7 +128,7 @@ def test_cdp_enum_type(): } expected = dedent("""\ class AXValueSourceType(enum.Enum): - ''' + r''' Enum of possible property sources. ''' ATTRIBUTE = "attribute" @@ -180,7 +190,7 @@ def test_cdp_class_type(): expected = dedent("""\ @dataclass class AXValue: - ''' + r''' A single computed AX property. ''' #: The type of this value. @@ -269,7 +279,7 @@ def get_partial_ax_tree( object_id: typing.Optional[runtime.RemoteObjectId] = None, fetch_relatives: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[AXNode]]: - ''' + r''' Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists. **EXPERIMENTAL** @@ -308,7 +318,7 @@ def test_cdp_command_no_params_or_returns(): } expected = dedent("""\ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Disables the accessibility domain. ''' cmd_dict: T_JSON_DICT = { @@ -344,7 +354,7 @@ def test_cdp_command_return_primitive(): def get_current_time( id_: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,float]: - ''' + r''' Returns the current time of the an animation. :param id_: Id of animation. @@ -382,7 +392,7 @@ def test_cdp_command_return_array_of_primitive(): } expected = dedent("""\ def get_browser_command_line() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]: - ''' + r''' Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline. @@ -420,7 +430,7 @@ def test_cdp_command_array_of_primitive_parameter(): def release_animations( animations: typing.List[str] ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Releases a set of animations to no longer be manipulated. :param animations: List of animation ids to seek. @@ -461,7 +471,7 @@ def test_cdp_command_ref_parameter(): def resolve_animation( animation_id: str ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,runtime.RemoteObject]: - ''' + r''' Gets the remote object of the Animation. :param animation_id: Animation id. @@ -540,7 +550,7 @@ def get_encoded_response( quality: typing.Optional[float] = None, size_only: typing.Optional[bool] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[str], int, int]]: - ''' + r''' Returns the response body and size if it were re-encoded with the specified settings. Only applies to images. @@ -608,7 +618,7 @@ def grant_permissions( permissions: typing.List[PermissionType], browser_context_id: typing.Optional[target.BrowserContextID] = None ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]: - ''' + r''' Grant specific permissions to the given origin and reject all others. **EXPERIMENTAL** @@ -652,7 +662,7 @@ def test_cdp_event(): @event_class('BackgroundService.recordingStateChanged') @dataclass class RecordingStateChanged: - ''' + r''' Called when the recording state for the service has been updated. ''' is_recording: bool @@ -704,7 +714,7 @@ def test_cdp_event_parameter_docs(): @event_class('Page.windowOpen') @dataclass class WindowOpen: - ''' + r''' Fired when a new window is going to be opened, via window.open(), link click, form submission, etc. '''