Skip to content

crash_report_context

CrashReportContextEntry dataclass

Key-value pair in CrashReportContext.

Source code in zendriver/cdp/crash_report_context.py
@dataclass
class CrashReportContextEntry:
    """
    Key-value pair in CrashReportContext.
    """

    key: str

    value: str

    #: The ID of the frame where the key-value pair was set.
    frame_id: page.FrameId

    def to_json(self) -> T_JSON_DICT:
        json: T_JSON_DICT = dict()
        json["key"] = self.key
        json["value"] = self.value
        json["frameId"] = self.frame_id.to_json()
        return json

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> CrashReportContextEntry:
        return cls(
            key=str(json["key"]),
            value=str(json["value"]),
            frame_id=page.FrameId.from_json(json["frameId"]),
        )

frame_id: page.FrameId instance-attribute

key: str instance-attribute

value: str instance-attribute

__init__(key, value, frame_id)

from_json(json) classmethod

Source code in zendriver/cdp/crash_report_context.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> CrashReportContextEntry:
    return cls(
        key=str(json["key"]),
        value=str(json["value"]),
        frame_id=page.FrameId.from_json(json["frameId"]),
    )

to_json()

Source code in zendriver/cdp/crash_report_context.py
def to_json(self) -> T_JSON_DICT:
    json: T_JSON_DICT = dict()
    json["key"] = self.key
    json["value"] = self.value
    json["frameId"] = self.frame_id.to_json()
    return json

get_entries()

Returns all entries in the CrashReportContext across all frames in the page.

Returns:

Type Description
Generator[T_JSON_DICT, T_JSON_DICT, List[CrashReportContextEntry]]
Source code in zendriver/cdp/crash_report_context.py
def get_entries() -> (
    typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[CrashReportContextEntry]]
):
    """
    Returns all entries in the CrashReportContext across all frames in the page.

    :returns:
    """
    cmd_dict: T_JSON_DICT = {
        "method": "CrashReportContext.getEntries",
    }
    json = yield cmd_dict
    return [CrashReportContextEntry.from_json(i) for i in json["entries"]]