Skip to content

preload

PrefetchStatus

Bases: Enum

TODO(https://crbug.com/1384419): revisit the list of PrefetchStatus and filter out the ones that aren't necessary to the developers.

Source code in zendriver/cdp/preload.py
class PrefetchStatus(enum.Enum):
    """
    TODO(https://crbug.com/1384419): revisit the list of PrefetchStatus and
    filter out the ones that aren't necessary to the developers.
    """

    PREFETCH_ALLOWED = "PrefetchAllowed"
    PREFETCH_FAILED_INELIGIBLE_REDIRECT = "PrefetchFailedIneligibleRedirect"
    PREFETCH_FAILED_INVALID_REDIRECT = "PrefetchFailedInvalidRedirect"
    PREFETCH_FAILED_MIME_NOT_SUPPORTED = "PrefetchFailedMIMENotSupported"
    PREFETCH_FAILED_NET_ERROR = "PrefetchFailedNetError"
    PREFETCH_FAILED_NON2_XX = "PrefetchFailedNon2XX"
    PREFETCH_EVICTED_AFTER_CANDIDATE_REMOVED = "PrefetchEvictedAfterCandidateRemoved"
    PREFETCH_EVICTED_FOR_NEWER_PREFETCH = "PrefetchEvictedForNewerPrefetch"
    PREFETCH_HELDBACK = "PrefetchHeldback"
    PREFETCH_INELIGIBLE_RETRY_AFTER = "PrefetchIneligibleRetryAfter"
    PREFETCH_IS_PRIVACY_DECOY = "PrefetchIsPrivacyDecoy"
    PREFETCH_IS_STALE = "PrefetchIsStale"
    PREFETCH_NOT_ELIGIBLE_BROWSER_CONTEXT_OFF_THE_RECORD = (
        "PrefetchNotEligibleBrowserContextOffTheRecord"
    )
    PREFETCH_NOT_ELIGIBLE_DATA_SAVER_ENABLED = "PrefetchNotEligibleDataSaverEnabled"
    PREFETCH_NOT_ELIGIBLE_EXISTING_PROXY = "PrefetchNotEligibleExistingProxy"
    PREFETCH_NOT_ELIGIBLE_HOST_IS_NON_UNIQUE = "PrefetchNotEligibleHostIsNonUnique"
    PREFETCH_NOT_ELIGIBLE_NON_DEFAULT_STORAGE_PARTITION = (
        "PrefetchNotEligibleNonDefaultStoragePartition"
    )
    PREFETCH_NOT_ELIGIBLE_SAME_SITE_CROSS_ORIGIN_PREFETCH_REQUIRED_PROXY = (
        "PrefetchNotEligibleSameSiteCrossOriginPrefetchRequiredProxy"
    )
    PREFETCH_NOT_ELIGIBLE_SCHEME_IS_NOT_HTTPS = "PrefetchNotEligibleSchemeIsNotHttps"
    PREFETCH_NOT_ELIGIBLE_USER_HAS_COOKIES = "PrefetchNotEligibleUserHasCookies"
    PREFETCH_NOT_ELIGIBLE_USER_HAS_SERVICE_WORKER = (
        "PrefetchNotEligibleUserHasServiceWorker"
    )
    PREFETCH_NOT_ELIGIBLE_BATTERY_SAVER_ENABLED = (
        "PrefetchNotEligibleBatterySaverEnabled"
    )
    PREFETCH_NOT_ELIGIBLE_PRELOADING_DISABLED = "PrefetchNotEligiblePreloadingDisabled"
    PREFETCH_NOT_FINISHED_IN_TIME = "PrefetchNotFinishedInTime"
    PREFETCH_NOT_STARTED = "PrefetchNotStarted"
    PREFETCH_NOT_USED_COOKIES_CHANGED = "PrefetchNotUsedCookiesChanged"
    PREFETCH_PROXY_NOT_AVAILABLE = "PrefetchProxyNotAvailable"
    PREFETCH_RESPONSE_USED = "PrefetchResponseUsed"
    PREFETCH_SUCCESSFUL_BUT_NOT_USED = "PrefetchSuccessfulButNotUsed"
    PREFETCH_NOT_USED_PROBE_FAILED = "PrefetchNotUsedProbeFailed"

    def to_json(self) -> str:
        return self.value

    @classmethod
    def from_json(cls, json: str) -> PrefetchStatus:
        return cls(json)

PREFETCH_ALLOWED = 'PrefetchAllowed' class-attribute instance-attribute

PREFETCH_EVICTED_AFTER_CANDIDATE_REMOVED = 'PrefetchEvictedAfterCandidateRemoved' class-attribute instance-attribute

PREFETCH_EVICTED_FOR_NEWER_PREFETCH = 'PrefetchEvictedForNewerPrefetch' class-attribute instance-attribute

PREFETCH_FAILED_INELIGIBLE_REDIRECT = 'PrefetchFailedIneligibleRedirect' class-attribute instance-attribute

PREFETCH_FAILED_INVALID_REDIRECT = 'PrefetchFailedInvalidRedirect' class-attribute instance-attribute

PREFETCH_FAILED_MIME_NOT_SUPPORTED = 'PrefetchFailedMIMENotSupported' class-attribute instance-attribute

PREFETCH_FAILED_NET_ERROR = 'PrefetchFailedNetError' class-attribute instance-attribute

PREFETCH_FAILED_NON2_XX = 'PrefetchFailedNon2XX' class-attribute instance-attribute

PREFETCH_HELDBACK = 'PrefetchHeldback' class-attribute instance-attribute

PREFETCH_INELIGIBLE_RETRY_AFTER = 'PrefetchIneligibleRetryAfter' class-attribute instance-attribute

PREFETCH_IS_PRIVACY_DECOY = 'PrefetchIsPrivacyDecoy' class-attribute instance-attribute

PREFETCH_IS_STALE = 'PrefetchIsStale' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_BATTERY_SAVER_ENABLED = 'PrefetchNotEligibleBatterySaverEnabled' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_BROWSER_CONTEXT_OFF_THE_RECORD = 'PrefetchNotEligibleBrowserContextOffTheRecord' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_DATA_SAVER_ENABLED = 'PrefetchNotEligibleDataSaverEnabled' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_EXISTING_PROXY = 'PrefetchNotEligibleExistingProxy' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_HOST_IS_NON_UNIQUE = 'PrefetchNotEligibleHostIsNonUnique' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_NON_DEFAULT_STORAGE_PARTITION = 'PrefetchNotEligibleNonDefaultStoragePartition' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_PRELOADING_DISABLED = 'PrefetchNotEligiblePreloadingDisabled' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_SAME_SITE_CROSS_ORIGIN_PREFETCH_REQUIRED_PROXY = 'PrefetchNotEligibleSameSiteCrossOriginPrefetchRequiredProxy' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_SCHEME_IS_NOT_HTTPS = 'PrefetchNotEligibleSchemeIsNotHttps' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_USER_HAS_COOKIES = 'PrefetchNotEligibleUserHasCookies' class-attribute instance-attribute

PREFETCH_NOT_ELIGIBLE_USER_HAS_SERVICE_WORKER = 'PrefetchNotEligibleUserHasServiceWorker' class-attribute instance-attribute

PREFETCH_NOT_FINISHED_IN_TIME = 'PrefetchNotFinishedInTime' class-attribute instance-attribute

PREFETCH_NOT_STARTED = 'PrefetchNotStarted' class-attribute instance-attribute

PREFETCH_NOT_USED_COOKIES_CHANGED = 'PrefetchNotUsedCookiesChanged' class-attribute instance-attribute

PREFETCH_NOT_USED_PROBE_FAILED = 'PrefetchNotUsedProbeFailed' class-attribute instance-attribute

PREFETCH_PROXY_NOT_AVAILABLE = 'PrefetchProxyNotAvailable' class-attribute instance-attribute

PREFETCH_RESPONSE_USED = 'PrefetchResponseUsed' class-attribute instance-attribute

PREFETCH_SUCCESSFUL_BUT_NOT_USED = 'PrefetchSuccessfulButNotUsed' class-attribute instance-attribute

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: str) -> PrefetchStatus:
    return cls(json)

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> str:
    return self.value

PrefetchStatusUpdated dataclass

Fired when a prefetch attempt is updated.

Source code in zendriver/cdp/preload.py
@event_class("Preload.prefetchStatusUpdated")
@dataclass
class PrefetchStatusUpdated:
    """
    Fired when a prefetch attempt is updated.
    """

    key: PreloadingAttemptKey
    #: The frame id of the frame initiating prefetch.
    initiating_frame_id: page.FrameId
    prefetch_url: str
    status: PreloadingStatus
    prefetch_status: PrefetchStatus
    request_id: network.RequestId

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> PrefetchStatusUpdated:
        return cls(
            key=PreloadingAttemptKey.from_json(json["key"]),
            initiating_frame_id=page.FrameId.from_json(json["initiatingFrameId"]),
            prefetch_url=str(json["prefetchUrl"]),
            status=PreloadingStatus.from_json(json["status"]),
            prefetch_status=PrefetchStatus.from_json(json["prefetchStatus"]),
            request_id=network.RequestId.from_json(json["requestId"]),
        )

initiating_frame_id: page.FrameId instance-attribute

key: PreloadingAttemptKey instance-attribute

prefetch_status: PrefetchStatus instance-attribute

prefetch_url: str instance-attribute

request_id: network.RequestId instance-attribute

status: PreloadingStatus instance-attribute

__init__(key, initiating_frame_id, prefetch_url, status, prefetch_status, request_id)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> PrefetchStatusUpdated:
    return cls(
        key=PreloadingAttemptKey.from_json(json["key"]),
        initiating_frame_id=page.FrameId.from_json(json["initiatingFrameId"]),
        prefetch_url=str(json["prefetchUrl"]),
        status=PreloadingStatus.from_json(json["status"]),
        prefetch_status=PrefetchStatus.from_json(json["prefetchStatus"]),
        request_id=network.RequestId.from_json(json["requestId"]),
    )

PreloadEnabledStateUpdated dataclass

Fired when a preload enabled state is updated.

Source code in zendriver/cdp/preload.py
@event_class("Preload.preloadEnabledStateUpdated")
@dataclass
class PreloadEnabledStateUpdated:
    """
    Fired when a preload enabled state is updated.
    """

    disabled_by_preference: bool
    disabled_by_data_saver: bool
    disabled_by_battery_saver: bool
    disabled_by_holdback_prefetch_speculation_rules: bool
    disabled_by_holdback_prerender_speculation_rules: bool

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> PreloadEnabledStateUpdated:
        return cls(
            disabled_by_preference=bool(json["disabledByPreference"]),
            disabled_by_data_saver=bool(json["disabledByDataSaver"]),
            disabled_by_battery_saver=bool(json["disabledByBatterySaver"]),
            disabled_by_holdback_prefetch_speculation_rules=bool(
                json["disabledByHoldbackPrefetchSpeculationRules"]
            ),
            disabled_by_holdback_prerender_speculation_rules=bool(
                json["disabledByHoldbackPrerenderSpeculationRules"]
            ),
        )

disabled_by_battery_saver: bool instance-attribute

disabled_by_data_saver: bool instance-attribute

disabled_by_holdback_prefetch_speculation_rules: bool instance-attribute

disabled_by_holdback_prerender_speculation_rules: bool instance-attribute

disabled_by_preference: bool instance-attribute

__init__(disabled_by_preference, disabled_by_data_saver, disabled_by_battery_saver, disabled_by_holdback_prefetch_speculation_rules, disabled_by_holdback_prerender_speculation_rules)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> PreloadEnabledStateUpdated:
    return cls(
        disabled_by_preference=bool(json["disabledByPreference"]),
        disabled_by_data_saver=bool(json["disabledByDataSaver"]),
        disabled_by_battery_saver=bool(json["disabledByBatterySaver"]),
        disabled_by_holdback_prefetch_speculation_rules=bool(
            json["disabledByHoldbackPrefetchSpeculationRules"]
        ),
        disabled_by_holdback_prerender_speculation_rules=bool(
            json["disabledByHoldbackPrerenderSpeculationRules"]
        ),
    )

PreloadingAttemptKey dataclass

A key that identifies a preloading attempt.

The url used is the url specified by the trigger (i.e. the initial URL), and not the final url that is navigated to. For example, prerendering allows same-origin main frame navigations during the attempt, but the attempt is still keyed with the initial URL.

Source code in zendriver/cdp/preload.py
@dataclass
class PreloadingAttemptKey:
    """
    A key that identifies a preloading attempt.

    The url used is the url specified by the trigger (i.e. the initial URL), and
    not the final url that is navigated to. For example, prerendering allows
    same-origin main frame navigations during the attempt, but the attempt is
    still keyed with the initial URL.
    """

    loader_id: network.LoaderId

    action: SpeculationAction

    url: str

    target_hint: typing.Optional[SpeculationTargetHint] = None

    def to_json(self) -> T_JSON_DICT:
        json: T_JSON_DICT = dict()
        json["loaderId"] = self.loader_id.to_json()
        json["action"] = self.action.to_json()
        json["url"] = self.url
        if self.target_hint is not None:
            json["targetHint"] = self.target_hint.to_json()
        return json

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> PreloadingAttemptKey:
        return cls(
            loader_id=network.LoaderId.from_json(json["loaderId"]),
            action=SpeculationAction.from_json(json["action"]),
            url=str(json["url"]),
            target_hint=SpeculationTargetHint.from_json(json["targetHint"])
            if json.get("targetHint", None) is not None
            else None,
        )

action: SpeculationAction instance-attribute

loader_id: network.LoaderId instance-attribute

target_hint: typing.Optional[SpeculationTargetHint] = None class-attribute instance-attribute

url: str instance-attribute

__init__(loader_id, action, url, target_hint=None)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> PreloadingAttemptKey:
    return cls(
        loader_id=network.LoaderId.from_json(json["loaderId"]),
        action=SpeculationAction.from_json(json["action"]),
        url=str(json["url"]),
        target_hint=SpeculationTargetHint.from_json(json["targetHint"])
        if json.get("targetHint", None) is not None
        else None,
    )

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> T_JSON_DICT:
    json: T_JSON_DICT = dict()
    json["loaderId"] = self.loader_id.to_json()
    json["action"] = self.action.to_json()
    json["url"] = self.url
    if self.target_hint is not None:
        json["targetHint"] = self.target_hint.to_json()
    return json

PreloadingAttemptSource dataclass

Lists sources for a preloading attempt, specifically the ids of rule sets that had a speculation rule that triggered the attempt, and the BackendNodeIds of or elements that triggered the attempt (in the case of attempts triggered by a document rule). It is possible for multiple rule sets and links to trigger a single attempt.

Source code in zendriver/cdp/preload.py
@dataclass
class PreloadingAttemptSource:
    """
    Lists sources for a preloading attempt, specifically the ids of rule sets
    that had a speculation rule that triggered the attempt, and the
    BackendNodeIds of <a href> or <area href> elements that triggered the
    attempt (in the case of attempts triggered by a document rule). It is
    possible for multiple rule sets and links to trigger a single attempt.
    """

    key: PreloadingAttemptKey

    rule_set_ids: typing.List[RuleSetId]

    node_ids: typing.List[dom.BackendNodeId]

    def to_json(self) -> T_JSON_DICT:
        json: T_JSON_DICT = dict()
        json["key"] = self.key.to_json()
        json["ruleSetIds"] = [i.to_json() for i in self.rule_set_ids]
        json["nodeIds"] = [i.to_json() for i in self.node_ids]
        return json

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> PreloadingAttemptSource:
        return cls(
            key=PreloadingAttemptKey.from_json(json["key"]),
            rule_set_ids=[RuleSetId.from_json(i) for i in json["ruleSetIds"]],
            node_ids=[dom.BackendNodeId.from_json(i) for i in json["nodeIds"]],
        )

key: PreloadingAttemptKey instance-attribute

node_ids: typing.List[dom.BackendNodeId] instance-attribute

rule_set_ids: typing.List[RuleSetId] instance-attribute

__init__(key, rule_set_ids, node_ids)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> PreloadingAttemptSource:
    return cls(
        key=PreloadingAttemptKey.from_json(json["key"]),
        rule_set_ids=[RuleSetId.from_json(i) for i in json["ruleSetIds"]],
        node_ids=[dom.BackendNodeId.from_json(i) for i in json["nodeIds"]],
    )

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> T_JSON_DICT:
    json: T_JSON_DICT = dict()
    json["key"] = self.key.to_json()
    json["ruleSetIds"] = [i.to_json() for i in self.rule_set_ids]
    json["nodeIds"] = [i.to_json() for i in self.node_ids]
    return json

PreloadingAttemptSourcesUpdated dataclass

Send a list of sources for all preloading attempts in a document.

Source code in zendriver/cdp/preload.py
@event_class("Preload.preloadingAttemptSourcesUpdated")
@dataclass
class PreloadingAttemptSourcesUpdated:
    """
    Send a list of sources for all preloading attempts in a document.
    """

    loader_id: network.LoaderId
    preloading_attempt_sources: typing.List[PreloadingAttemptSource]

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> PreloadingAttemptSourcesUpdated:
        return cls(
            loader_id=network.LoaderId.from_json(json["loaderId"]),
            preloading_attempt_sources=[
                PreloadingAttemptSource.from_json(i)
                for i in json["preloadingAttemptSources"]
            ],
        )

loader_id: network.LoaderId instance-attribute

preloading_attempt_sources: typing.List[PreloadingAttemptSource] instance-attribute

__init__(loader_id, preloading_attempt_sources)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> PreloadingAttemptSourcesUpdated:
    return cls(
        loader_id=network.LoaderId.from_json(json["loaderId"]),
        preloading_attempt_sources=[
            PreloadingAttemptSource.from_json(i)
            for i in json["preloadingAttemptSources"]
        ],
    )

PreloadingStatus

Bases: Enum

Preloading status values, see also PreloadingTriggeringOutcome. This status is shared by prefetchStatusUpdated and prerenderStatusUpdated.

Source code in zendriver/cdp/preload.py
class PreloadingStatus(enum.Enum):
    """
    Preloading status values, see also PreloadingTriggeringOutcome. This
    status is shared by prefetchStatusUpdated and prerenderStatusUpdated.
    """

    PENDING = "Pending"
    RUNNING = "Running"
    READY = "Ready"
    SUCCESS = "Success"
    FAILURE = "Failure"
    NOT_SUPPORTED = "NotSupported"

    def to_json(self) -> str:
        return self.value

    @classmethod
    def from_json(cls, json: str) -> PreloadingStatus:
        return cls(json)

FAILURE = 'Failure' class-attribute instance-attribute

NOT_SUPPORTED = 'NotSupported' class-attribute instance-attribute

PENDING = 'Pending' class-attribute instance-attribute

READY = 'Ready' class-attribute instance-attribute

RUNNING = 'Running' class-attribute instance-attribute

SUCCESS = 'Success' class-attribute instance-attribute

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: str) -> PreloadingStatus:
    return cls(json)

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> str:
    return self.value

PrerenderFinalStatus

Bases: Enum

List of FinalStatus reasons for Prerender2.

Source code in zendriver/cdp/preload.py
class PrerenderFinalStatus(enum.Enum):
    """
    List of FinalStatus reasons for Prerender2.
    """

    ACTIVATED = "Activated"
    DESTROYED = "Destroyed"
    LOW_END_DEVICE = "LowEndDevice"
    INVALID_SCHEME_REDIRECT = "InvalidSchemeRedirect"
    INVALID_SCHEME_NAVIGATION = "InvalidSchemeNavigation"
    NAVIGATION_REQUEST_BLOCKED_BY_CSP = "NavigationRequestBlockedByCsp"
    MAIN_FRAME_NAVIGATION = "MainFrameNavigation"
    MOJO_BINDER_POLICY = "MojoBinderPolicy"
    RENDERER_PROCESS_CRASHED = "RendererProcessCrashed"
    RENDERER_PROCESS_KILLED = "RendererProcessKilled"
    DOWNLOAD = "Download"
    TRIGGER_DESTROYED = "TriggerDestroyed"
    NAVIGATION_NOT_COMMITTED = "NavigationNotCommitted"
    NAVIGATION_BAD_HTTP_STATUS = "NavigationBadHttpStatus"
    CLIENT_CERT_REQUESTED = "ClientCertRequested"
    NAVIGATION_REQUEST_NETWORK_ERROR = "NavigationRequestNetworkError"
    CANCEL_ALL_HOSTS_FOR_TESTING = "CancelAllHostsForTesting"
    DID_FAIL_LOAD = "DidFailLoad"
    STOP = "Stop"
    SSL_CERTIFICATE_ERROR = "SslCertificateError"
    LOGIN_AUTH_REQUESTED = "LoginAuthRequested"
    UA_CHANGE_REQUIRES_RELOAD = "UaChangeRequiresReload"
    BLOCKED_BY_CLIENT = "BlockedByClient"
    AUDIO_OUTPUT_DEVICE_REQUESTED = "AudioOutputDeviceRequested"
    MIXED_CONTENT = "MixedContent"
    TRIGGER_BACKGROUNDED = "TriggerBackgrounded"
    MEMORY_LIMIT_EXCEEDED = "MemoryLimitExceeded"
    DATA_SAVER_ENABLED = "DataSaverEnabled"
    TRIGGER_URL_HAS_EFFECTIVE_URL = "TriggerUrlHasEffectiveUrl"
    ACTIVATED_BEFORE_STARTED = "ActivatedBeforeStarted"
    INACTIVE_PAGE_RESTRICTION = "InactivePageRestriction"
    START_FAILED = "StartFailed"
    TIMEOUT_BACKGROUNDED = "TimeoutBackgrounded"
    CROSS_SITE_REDIRECT_IN_INITIAL_NAVIGATION = "CrossSiteRedirectInInitialNavigation"
    CROSS_SITE_NAVIGATION_IN_INITIAL_NAVIGATION = (
        "CrossSiteNavigationInInitialNavigation"
    )
    SAME_SITE_CROSS_ORIGIN_REDIRECT_NOT_OPT_IN_IN_INITIAL_NAVIGATION = (
        "SameSiteCrossOriginRedirectNotOptInInInitialNavigation"
    )
    SAME_SITE_CROSS_ORIGIN_NAVIGATION_NOT_OPT_IN_IN_INITIAL_NAVIGATION = (
        "SameSiteCrossOriginNavigationNotOptInInInitialNavigation"
    )
    ACTIVATION_NAVIGATION_PARAMETER_MISMATCH = "ActivationNavigationParameterMismatch"
    ACTIVATED_IN_BACKGROUND = "ActivatedInBackground"
    EMBEDDER_HOST_DISALLOWED = "EmbedderHostDisallowed"
    ACTIVATION_NAVIGATION_DESTROYED_BEFORE_SUCCESS = (
        "ActivationNavigationDestroyedBeforeSuccess"
    )
    TAB_CLOSED_BY_USER_GESTURE = "TabClosedByUserGesture"
    TAB_CLOSED_WITHOUT_USER_GESTURE = "TabClosedWithoutUserGesture"
    PRIMARY_MAIN_FRAME_RENDERER_PROCESS_CRASHED = (
        "PrimaryMainFrameRendererProcessCrashed"
    )
    PRIMARY_MAIN_FRAME_RENDERER_PROCESS_KILLED = "PrimaryMainFrameRendererProcessKilled"
    ACTIVATION_FRAME_POLICY_NOT_COMPATIBLE = "ActivationFramePolicyNotCompatible"
    PRELOADING_DISABLED = "PreloadingDisabled"
    BATTERY_SAVER_ENABLED = "BatterySaverEnabled"
    ACTIVATED_DURING_MAIN_FRAME_NAVIGATION = "ActivatedDuringMainFrameNavigation"
    PRELOADING_UNSUPPORTED_BY_WEB_CONTENTS = "PreloadingUnsupportedByWebContents"
    CROSS_SITE_REDIRECT_IN_MAIN_FRAME_NAVIGATION = (
        "CrossSiteRedirectInMainFrameNavigation"
    )
    CROSS_SITE_NAVIGATION_IN_MAIN_FRAME_NAVIGATION = (
        "CrossSiteNavigationInMainFrameNavigation"
    )
    SAME_SITE_CROSS_ORIGIN_REDIRECT_NOT_OPT_IN_IN_MAIN_FRAME_NAVIGATION = (
        "SameSiteCrossOriginRedirectNotOptInInMainFrameNavigation"
    )
    SAME_SITE_CROSS_ORIGIN_NAVIGATION_NOT_OPT_IN_IN_MAIN_FRAME_NAVIGATION = (
        "SameSiteCrossOriginNavigationNotOptInInMainFrameNavigation"
    )
    MEMORY_PRESSURE_ON_TRIGGER = "MemoryPressureOnTrigger"
    MEMORY_PRESSURE_AFTER_TRIGGERED = "MemoryPressureAfterTriggered"
    PRERENDERING_DISABLED_BY_DEV_TOOLS = "PrerenderingDisabledByDevTools"
    SPECULATION_RULE_REMOVED = "SpeculationRuleRemoved"
    ACTIVATED_WITH_AUXILIARY_BROWSING_CONTEXTS = (
        "ActivatedWithAuxiliaryBrowsingContexts"
    )
    MAX_NUM_OF_RUNNING_EAGER_PRERENDERS_EXCEEDED = (
        "MaxNumOfRunningEagerPrerendersExceeded"
    )
    MAX_NUM_OF_RUNNING_NON_EAGER_PRERENDERS_EXCEEDED = (
        "MaxNumOfRunningNonEagerPrerendersExceeded"
    )
    MAX_NUM_OF_RUNNING_EMBEDDER_PRERENDERS_EXCEEDED = (
        "MaxNumOfRunningEmbedderPrerendersExceeded"
    )
    PRERENDERING_URL_HAS_EFFECTIVE_URL = "PrerenderingUrlHasEffectiveUrl"
    REDIRECTED_PRERENDERING_URL_HAS_EFFECTIVE_URL = (
        "RedirectedPrerenderingUrlHasEffectiveUrl"
    )
    ACTIVATION_URL_HAS_EFFECTIVE_URL = "ActivationUrlHasEffectiveUrl"
    JAVA_SCRIPT_INTERFACE_ADDED = "JavaScriptInterfaceAdded"
    JAVA_SCRIPT_INTERFACE_REMOVED = "JavaScriptInterfaceRemoved"
    ALL_PRERENDERING_CANCELED = "AllPrerenderingCanceled"
    WINDOW_CLOSED = "WindowClosed"
    SLOW_NETWORK = "SlowNetwork"
    OTHER_PRERENDERED_PAGE_ACTIVATED = "OtherPrerenderedPageActivated"
    V8_OPTIMIZER_DISABLED = "V8OptimizerDisabled"
    PRERENDER_FAILED_DURING_PREFETCH = "PrerenderFailedDuringPrefetch"

    def to_json(self) -> str:
        return self.value

    @classmethod
    def from_json(cls, json: str) -> PrerenderFinalStatus:
        return cls(json)

ACTIVATED = 'Activated' class-attribute instance-attribute

ACTIVATED_BEFORE_STARTED = 'ActivatedBeforeStarted' class-attribute instance-attribute

ACTIVATED_DURING_MAIN_FRAME_NAVIGATION = 'ActivatedDuringMainFrameNavigation' class-attribute instance-attribute

ACTIVATED_IN_BACKGROUND = 'ActivatedInBackground' class-attribute instance-attribute

ACTIVATED_WITH_AUXILIARY_BROWSING_CONTEXTS = 'ActivatedWithAuxiliaryBrowsingContexts' class-attribute instance-attribute

ACTIVATION_FRAME_POLICY_NOT_COMPATIBLE = 'ActivationFramePolicyNotCompatible' class-attribute instance-attribute

ACTIVATION_NAVIGATION_DESTROYED_BEFORE_SUCCESS = 'ActivationNavigationDestroyedBeforeSuccess' class-attribute instance-attribute

ACTIVATION_NAVIGATION_PARAMETER_MISMATCH = 'ActivationNavigationParameterMismatch' class-attribute instance-attribute

ACTIVATION_URL_HAS_EFFECTIVE_URL = 'ActivationUrlHasEffectiveUrl' class-attribute instance-attribute

ALL_PRERENDERING_CANCELED = 'AllPrerenderingCanceled' class-attribute instance-attribute

AUDIO_OUTPUT_DEVICE_REQUESTED = 'AudioOutputDeviceRequested' class-attribute instance-attribute

BATTERY_SAVER_ENABLED = 'BatterySaverEnabled' class-attribute instance-attribute

BLOCKED_BY_CLIENT = 'BlockedByClient' class-attribute instance-attribute

CANCEL_ALL_HOSTS_FOR_TESTING = 'CancelAllHostsForTesting' class-attribute instance-attribute

CLIENT_CERT_REQUESTED = 'ClientCertRequested' class-attribute instance-attribute

CROSS_SITE_NAVIGATION_IN_INITIAL_NAVIGATION = 'CrossSiteNavigationInInitialNavigation' class-attribute instance-attribute

CROSS_SITE_NAVIGATION_IN_MAIN_FRAME_NAVIGATION = 'CrossSiteNavigationInMainFrameNavigation' class-attribute instance-attribute

CROSS_SITE_REDIRECT_IN_INITIAL_NAVIGATION = 'CrossSiteRedirectInInitialNavigation' class-attribute instance-attribute

CROSS_SITE_REDIRECT_IN_MAIN_FRAME_NAVIGATION = 'CrossSiteRedirectInMainFrameNavigation' class-attribute instance-attribute

DATA_SAVER_ENABLED = 'DataSaverEnabled' class-attribute instance-attribute

DESTROYED = 'Destroyed' class-attribute instance-attribute

DID_FAIL_LOAD = 'DidFailLoad' class-attribute instance-attribute

DOWNLOAD = 'Download' class-attribute instance-attribute

EMBEDDER_HOST_DISALLOWED = 'EmbedderHostDisallowed' class-attribute instance-attribute

INACTIVE_PAGE_RESTRICTION = 'InactivePageRestriction' class-attribute instance-attribute

INVALID_SCHEME_NAVIGATION = 'InvalidSchemeNavigation' class-attribute instance-attribute

INVALID_SCHEME_REDIRECT = 'InvalidSchemeRedirect' class-attribute instance-attribute

JAVA_SCRIPT_INTERFACE_ADDED = 'JavaScriptInterfaceAdded' class-attribute instance-attribute

JAVA_SCRIPT_INTERFACE_REMOVED = 'JavaScriptInterfaceRemoved' class-attribute instance-attribute

LOGIN_AUTH_REQUESTED = 'LoginAuthRequested' class-attribute instance-attribute

LOW_END_DEVICE = 'LowEndDevice' class-attribute instance-attribute

MAIN_FRAME_NAVIGATION = 'MainFrameNavigation' class-attribute instance-attribute

MAX_NUM_OF_RUNNING_EAGER_PRERENDERS_EXCEEDED = 'MaxNumOfRunningEagerPrerendersExceeded' class-attribute instance-attribute

MAX_NUM_OF_RUNNING_EMBEDDER_PRERENDERS_EXCEEDED = 'MaxNumOfRunningEmbedderPrerendersExceeded' class-attribute instance-attribute

MAX_NUM_OF_RUNNING_NON_EAGER_PRERENDERS_EXCEEDED = 'MaxNumOfRunningNonEagerPrerendersExceeded' class-attribute instance-attribute

MEMORY_LIMIT_EXCEEDED = 'MemoryLimitExceeded' class-attribute instance-attribute

MEMORY_PRESSURE_AFTER_TRIGGERED = 'MemoryPressureAfterTriggered' class-attribute instance-attribute

MEMORY_PRESSURE_ON_TRIGGER = 'MemoryPressureOnTrigger' class-attribute instance-attribute

MIXED_CONTENT = 'MixedContent' class-attribute instance-attribute

MOJO_BINDER_POLICY = 'MojoBinderPolicy' class-attribute instance-attribute

NAVIGATION_BAD_HTTP_STATUS = 'NavigationBadHttpStatus' class-attribute instance-attribute

NAVIGATION_NOT_COMMITTED = 'NavigationNotCommitted' class-attribute instance-attribute

NAVIGATION_REQUEST_BLOCKED_BY_CSP = 'NavigationRequestBlockedByCsp' class-attribute instance-attribute

NAVIGATION_REQUEST_NETWORK_ERROR = 'NavigationRequestNetworkError' class-attribute instance-attribute

OTHER_PRERENDERED_PAGE_ACTIVATED = 'OtherPrerenderedPageActivated' class-attribute instance-attribute

PRELOADING_DISABLED = 'PreloadingDisabled' class-attribute instance-attribute

PRELOADING_UNSUPPORTED_BY_WEB_CONTENTS = 'PreloadingUnsupportedByWebContents' class-attribute instance-attribute

PRERENDERING_DISABLED_BY_DEV_TOOLS = 'PrerenderingDisabledByDevTools' class-attribute instance-attribute

PRERENDERING_URL_HAS_EFFECTIVE_URL = 'PrerenderingUrlHasEffectiveUrl' class-attribute instance-attribute

PRERENDER_FAILED_DURING_PREFETCH = 'PrerenderFailedDuringPrefetch' class-attribute instance-attribute

PRIMARY_MAIN_FRAME_RENDERER_PROCESS_CRASHED = 'PrimaryMainFrameRendererProcessCrashed' class-attribute instance-attribute

PRIMARY_MAIN_FRAME_RENDERER_PROCESS_KILLED = 'PrimaryMainFrameRendererProcessKilled' class-attribute instance-attribute

REDIRECTED_PRERENDERING_URL_HAS_EFFECTIVE_URL = 'RedirectedPrerenderingUrlHasEffectiveUrl' class-attribute instance-attribute

RENDERER_PROCESS_CRASHED = 'RendererProcessCrashed' class-attribute instance-attribute

RENDERER_PROCESS_KILLED = 'RendererProcessKilled' class-attribute instance-attribute

SAME_SITE_CROSS_ORIGIN_NAVIGATION_NOT_OPT_IN_IN_INITIAL_NAVIGATION = 'SameSiteCrossOriginNavigationNotOptInInInitialNavigation' class-attribute instance-attribute

SAME_SITE_CROSS_ORIGIN_NAVIGATION_NOT_OPT_IN_IN_MAIN_FRAME_NAVIGATION = 'SameSiteCrossOriginNavigationNotOptInInMainFrameNavigation' class-attribute instance-attribute

SAME_SITE_CROSS_ORIGIN_REDIRECT_NOT_OPT_IN_IN_INITIAL_NAVIGATION = 'SameSiteCrossOriginRedirectNotOptInInInitialNavigation' class-attribute instance-attribute

SAME_SITE_CROSS_ORIGIN_REDIRECT_NOT_OPT_IN_IN_MAIN_FRAME_NAVIGATION = 'SameSiteCrossOriginRedirectNotOptInInMainFrameNavigation' class-attribute instance-attribute

SLOW_NETWORK = 'SlowNetwork' class-attribute instance-attribute

SPECULATION_RULE_REMOVED = 'SpeculationRuleRemoved' class-attribute instance-attribute

SSL_CERTIFICATE_ERROR = 'SslCertificateError' class-attribute instance-attribute

START_FAILED = 'StartFailed' class-attribute instance-attribute

STOP = 'Stop' class-attribute instance-attribute

TAB_CLOSED_BY_USER_GESTURE = 'TabClosedByUserGesture' class-attribute instance-attribute

TAB_CLOSED_WITHOUT_USER_GESTURE = 'TabClosedWithoutUserGesture' class-attribute instance-attribute

TIMEOUT_BACKGROUNDED = 'TimeoutBackgrounded' class-attribute instance-attribute

TRIGGER_BACKGROUNDED = 'TriggerBackgrounded' class-attribute instance-attribute

TRIGGER_DESTROYED = 'TriggerDestroyed' class-attribute instance-attribute

TRIGGER_URL_HAS_EFFECTIVE_URL = 'TriggerUrlHasEffectiveUrl' class-attribute instance-attribute

UA_CHANGE_REQUIRES_RELOAD = 'UaChangeRequiresReload' class-attribute instance-attribute

V8_OPTIMIZER_DISABLED = 'V8OptimizerDisabled' class-attribute instance-attribute

WINDOW_CLOSED = 'WindowClosed' class-attribute instance-attribute

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: str) -> PrerenderFinalStatus:
    return cls(json)

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> str:
    return self.value

PrerenderMismatchedHeaders dataclass

Information of headers to be displayed when the header mismatch occurred.

Source code in zendriver/cdp/preload.py
@dataclass
class PrerenderMismatchedHeaders:
    """
    Information of headers to be displayed when the header mismatch occurred.
    """

    header_name: str

    initial_value: typing.Optional[str] = None

    activation_value: typing.Optional[str] = None

    def to_json(self) -> T_JSON_DICT:
        json: T_JSON_DICT = dict()
        json["headerName"] = self.header_name
        if self.initial_value is not None:
            json["initialValue"] = self.initial_value
        if self.activation_value is not None:
            json["activationValue"] = self.activation_value
        return json

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> PrerenderMismatchedHeaders:
        return cls(
            header_name=str(json["headerName"]),
            initial_value=str(json["initialValue"])
            if json.get("initialValue", None) is not None
            else None,
            activation_value=str(json["activationValue"])
            if json.get("activationValue", None) is not None
            else None,
        )

activation_value: typing.Optional[str] = None class-attribute instance-attribute

header_name: str instance-attribute

initial_value: typing.Optional[str] = None class-attribute instance-attribute

__init__(header_name, initial_value=None, activation_value=None)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> PrerenderMismatchedHeaders:
    return cls(
        header_name=str(json["headerName"]),
        initial_value=str(json["initialValue"])
        if json.get("initialValue", None) is not None
        else None,
        activation_value=str(json["activationValue"])
        if json.get("activationValue", None) is not None
        else None,
    )

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> T_JSON_DICT:
    json: T_JSON_DICT = dict()
    json["headerName"] = self.header_name
    if self.initial_value is not None:
        json["initialValue"] = self.initial_value
    if self.activation_value is not None:
        json["activationValue"] = self.activation_value
    return json

PrerenderStatusUpdated dataclass

Fired when a prerender attempt is updated.

Source code in zendriver/cdp/preload.py
@event_class("Preload.prerenderStatusUpdated")
@dataclass
class PrerenderStatusUpdated:
    """
    Fired when a prerender attempt is updated.
    """

    key: PreloadingAttemptKey
    status: PreloadingStatus
    prerender_status: typing.Optional[PrerenderFinalStatus]
    #: This is used to give users more information about the name of Mojo interface
    #: that is incompatible with prerender and has caused the cancellation of the attempt.
    disallowed_mojo_interface: typing.Optional[str]
    mismatched_headers: typing.Optional[typing.List[PrerenderMismatchedHeaders]]

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> PrerenderStatusUpdated:
        return cls(
            key=PreloadingAttemptKey.from_json(json["key"]),
            status=PreloadingStatus.from_json(json["status"]),
            prerender_status=PrerenderFinalStatus.from_json(json["prerenderStatus"])
            if json.get("prerenderStatus", None) is not None
            else None,
            disallowed_mojo_interface=str(json["disallowedMojoInterface"])
            if json.get("disallowedMojoInterface", None) is not None
            else None,
            mismatched_headers=[
                PrerenderMismatchedHeaders.from_json(i)
                for i in json["mismatchedHeaders"]
            ]
            if json.get("mismatchedHeaders", None) is not None
            else None,
        )

disallowed_mojo_interface: typing.Optional[str] instance-attribute

key: PreloadingAttemptKey instance-attribute

mismatched_headers: typing.Optional[typing.List[PrerenderMismatchedHeaders]] instance-attribute

prerender_status: typing.Optional[PrerenderFinalStatus] instance-attribute

status: PreloadingStatus instance-attribute

__init__(key, status, prerender_status, disallowed_mojo_interface, mismatched_headers)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> PrerenderStatusUpdated:
    return cls(
        key=PreloadingAttemptKey.from_json(json["key"]),
        status=PreloadingStatus.from_json(json["status"]),
        prerender_status=PrerenderFinalStatus.from_json(json["prerenderStatus"])
        if json.get("prerenderStatus", None) is not None
        else None,
        disallowed_mojo_interface=str(json["disallowedMojoInterface"])
        if json.get("disallowedMojoInterface", None) is not None
        else None,
        mismatched_headers=[
            PrerenderMismatchedHeaders.from_json(i)
            for i in json["mismatchedHeaders"]
        ]
        if json.get("mismatchedHeaders", None) is not None
        else None,
    )

RuleSet dataclass

Corresponds to SpeculationRuleSet

Source code in zendriver/cdp/preload.py
@dataclass
class RuleSet:
    """
    Corresponds to SpeculationRuleSet
    """

    id_: RuleSetId

    #: Identifies a document which the rule set is associated with.
    loader_id: network.LoaderId

    #: Source text of JSON representing the rule set. If it comes from
    #: ``<script>`` tag, it is the textContent of the node. Note that it is
    #: a JSON for valid case.
    #:
    #: See also:
    #: - https://wicg.github.io/nav-speculation/speculation-rules.html
    #: - https://github.com/WICG/nav-speculation/blob/main/triggers.md
    source_text: str

    #: A speculation rule set is either added through an inline
    #: ``<script>`` tag or through an external resource via the
    #: 'Speculation-Rules' HTTP header. For the first case, we include
    #: the BackendNodeId of the relevant ``<script>`` tag. For the second
    #: case, we include the external URL where the rule set was loaded
    #: from, and also RequestId if Network domain is enabled.
    #:
    #: See also:
    #: - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-script
    #: - https://wicg.github.io/nav-speculation/speculation-rules.html#speculation-rules-header
    backend_node_id: typing.Optional[dom.BackendNodeId] = None

    url: typing.Optional[str] = None

    request_id: typing.Optional[network.RequestId] = None

    #: Error information
    #: ``errorMessage`` is null iff ``errorType`` is null.
    error_type: typing.Optional[RuleSetErrorType] = None

    #: TODO(https://crbug.com/1425354): Replace this property with structured error.
    error_message: typing.Optional[str] = None

    def to_json(self) -> T_JSON_DICT:
        json: T_JSON_DICT = dict()
        json["id"] = self.id_.to_json()
        json["loaderId"] = self.loader_id.to_json()
        json["sourceText"] = self.source_text
        if self.backend_node_id is not None:
            json["backendNodeId"] = self.backend_node_id.to_json()
        if self.url is not None:
            json["url"] = self.url
        if self.request_id is not None:
            json["requestId"] = self.request_id.to_json()
        if self.error_type is not None:
            json["errorType"] = self.error_type.to_json()
        if self.error_message is not None:
            json["errorMessage"] = self.error_message
        return json

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> RuleSet:
        return cls(
            id_=RuleSetId.from_json(json["id"]),
            loader_id=network.LoaderId.from_json(json["loaderId"]),
            source_text=str(json["sourceText"]),
            backend_node_id=dom.BackendNodeId.from_json(json["backendNodeId"])
            if json.get("backendNodeId", None) is not None
            else None,
            url=str(json["url"]) if json.get("url", None) is not None else None,
            request_id=network.RequestId.from_json(json["requestId"])
            if json.get("requestId", None) is not None
            else None,
            error_type=RuleSetErrorType.from_json(json["errorType"])
            if json.get("errorType", None) is not None
            else None,
            error_message=str(json["errorMessage"])
            if json.get("errorMessage", None) is not None
            else None,
        )

backend_node_id: typing.Optional[dom.BackendNodeId] = None class-attribute instance-attribute

error_message: typing.Optional[str] = None class-attribute instance-attribute

error_type: typing.Optional[RuleSetErrorType] = None class-attribute instance-attribute

id_: RuleSetId instance-attribute

loader_id: network.LoaderId instance-attribute

request_id: typing.Optional[network.RequestId] = None class-attribute instance-attribute

source_text: str instance-attribute

url: typing.Optional[str] = None class-attribute instance-attribute

__init__(id_, loader_id, source_text, backend_node_id=None, url=None, request_id=None, error_type=None, error_message=None)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> RuleSet:
    return cls(
        id_=RuleSetId.from_json(json["id"]),
        loader_id=network.LoaderId.from_json(json["loaderId"]),
        source_text=str(json["sourceText"]),
        backend_node_id=dom.BackendNodeId.from_json(json["backendNodeId"])
        if json.get("backendNodeId", None) is not None
        else None,
        url=str(json["url"]) if json.get("url", None) is not None else None,
        request_id=network.RequestId.from_json(json["requestId"])
        if json.get("requestId", None) is not None
        else None,
        error_type=RuleSetErrorType.from_json(json["errorType"])
        if json.get("errorType", None) is not None
        else None,
        error_message=str(json["errorMessage"])
        if json.get("errorMessage", None) is not None
        else None,
    )

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> T_JSON_DICT:
    json: T_JSON_DICT = dict()
    json["id"] = self.id_.to_json()
    json["loaderId"] = self.loader_id.to_json()
    json["sourceText"] = self.source_text
    if self.backend_node_id is not None:
        json["backendNodeId"] = self.backend_node_id.to_json()
    if self.url is not None:
        json["url"] = self.url
    if self.request_id is not None:
        json["requestId"] = self.request_id.to_json()
    if self.error_type is not None:
        json["errorType"] = self.error_type.to_json()
    if self.error_message is not None:
        json["errorMessage"] = self.error_message
    return json

RuleSetErrorType

Bases: Enum

Source code in zendriver/cdp/preload.py
class RuleSetErrorType(enum.Enum):
    SOURCE_IS_NOT_JSON_OBJECT = "SourceIsNotJsonObject"
    INVALID_RULES_SKIPPED = "InvalidRulesSkipped"

    def to_json(self) -> str:
        return self.value

    @classmethod
    def from_json(cls, json: str) -> RuleSetErrorType:
        return cls(json)

INVALID_RULES_SKIPPED = 'InvalidRulesSkipped' class-attribute instance-attribute

SOURCE_IS_NOT_JSON_OBJECT = 'SourceIsNotJsonObject' class-attribute instance-attribute

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: str) -> RuleSetErrorType:
    return cls(json)

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> str:
    return self.value

RuleSetId

Bases: str

Unique id

Source code in zendriver/cdp/preload.py
class RuleSetId(str):
    """
    Unique id
    """

    def to_json(self) -> str:
        return self

    @classmethod
    def from_json(cls, json: str) -> RuleSetId:
        return cls(json)

    def __repr__(self):
        return "RuleSetId({})".format(super().__repr__())

__repr__()

Source code in zendriver/cdp/preload.py
def __repr__(self):
    return "RuleSetId({})".format(super().__repr__())

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: str) -> RuleSetId:
    return cls(json)

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> str:
    return self

RuleSetRemoved dataclass

Source code in zendriver/cdp/preload.py
@event_class("Preload.ruleSetRemoved")
@dataclass
class RuleSetRemoved:
    id_: RuleSetId

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> RuleSetRemoved:
        return cls(id_=RuleSetId.from_json(json["id"]))

id_: RuleSetId instance-attribute

__init__(id_)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> RuleSetRemoved:
    return cls(id_=RuleSetId.from_json(json["id"]))

RuleSetUpdated dataclass

Upsert. Currently, it is only emitted when a rule set added.

Source code in zendriver/cdp/preload.py
@event_class("Preload.ruleSetUpdated")
@dataclass
class RuleSetUpdated:
    """
    Upsert. Currently, it is only emitted when a rule set added.
    """

    rule_set: RuleSet

    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> RuleSetUpdated:
        return cls(rule_set=RuleSet.from_json(json["ruleSet"]))

rule_set: RuleSet instance-attribute

__init__(rule_set)

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: T_JSON_DICT) -> RuleSetUpdated:
    return cls(rule_set=RuleSet.from_json(json["ruleSet"]))

SpeculationAction

Bases: Enum

The type of preloading attempted. It corresponds to mojom::SpeculationAction (although PrefetchWithSubresources is omitted as it isn't being used by clients).

Source code in zendriver/cdp/preload.py
class SpeculationAction(enum.Enum):
    """
    The type of preloading attempted. It corresponds to
    mojom::SpeculationAction (although PrefetchWithSubresources is omitted as it
    isn't being used by clients).
    """

    PREFETCH = "Prefetch"
    PRERENDER = "Prerender"

    def to_json(self) -> str:
        return self.value

    @classmethod
    def from_json(cls, json: str) -> SpeculationAction:
        return cls(json)

PREFETCH = 'Prefetch' class-attribute instance-attribute

PRERENDER = 'Prerender' class-attribute instance-attribute

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: str) -> SpeculationAction:
    return cls(json)

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> str:
    return self.value

SpeculationTargetHint

Bases: Enum

Corresponds to mojom::SpeculationTargetHint. See https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints

Source code in zendriver/cdp/preload.py
class SpeculationTargetHint(enum.Enum):
    """
    Corresponds to mojom::SpeculationTargetHint.
    See https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints
    """

    BLANK = "Blank"
    SELF = "Self"

    def to_json(self) -> str:
        return self.value

    @classmethod
    def from_json(cls, json: str) -> SpeculationTargetHint:
        return cls(json)

BLANK = 'Blank' class-attribute instance-attribute

SELF = 'Self' class-attribute instance-attribute

from_json(json) classmethod

Source code in zendriver/cdp/preload.py
@classmethod
def from_json(cls, json: str) -> SpeculationTargetHint:
    return cls(json)

to_json()

Source code in zendriver/cdp/preload.py
def to_json(self) -> str:
    return self.value

disable()

Source code in zendriver/cdp/preload.py
def disable() -> typing.Generator[T_JSON_DICT, T_JSON_DICT, None]:
    cmd_dict: T_JSON_DICT = {
        "method": "Preload.disable",
    }
    json = yield cmd_dict

enable()

Source code in zendriver/cdp/preload.py
def enable() -> typing.Generator[T_JSON_DICT, T_JSON_DICT, None]:
    cmd_dict: T_JSON_DICT = {
        "method": "Preload.enable",
    }
    json = yield cmd_dict