Page#
Actions and events related to the inspected page belong to the page domain.
Types#
Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.
- class AdFrameType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Indicates whether a frame has been identified as an ad.
- NONE = 'none'#
- CHILD = 'child'#
- ROOT = 'root'#
- class AdFrameExplanation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
- PARENT_IS_AD = 'ParentIsAd'#
- CREATED_BY_AD_SCRIPT = 'CreatedByAdScript'#
- MATCHED_BLOCKING_RULE = 'MatchedBlockingRule'#
- class AdFrameStatus(ad_frame_type, explanations=None)[source]#
Indicates whether a frame has been identified as an ad and why.
-
ad_frame_type:
AdFrameType#
-
explanations:
Optional[List[AdFrameExplanation]] = None#
-
ad_frame_type:
- class AdScriptId(script_id, debugger_id)[source]#
Identifies the script which caused a script or frame to be labelled as an ad.
-
script_id:
ScriptId# Script Id of the script which caused a script or frame to be labelled as an ad.
-
debugger_id:
UniqueDebuggerId# Id of scriptId’s debugger.
-
script_id:
- class AdScriptAncestry(ancestry_chain, root_script_filterlist_rule=None)[source]#
Encapsulates the script ancestry and the root script filterlist rule that caused the frame to be labelled as an ad. Only created when
ancestryChainis not empty.-
ancestry_chain:
List[AdScriptId]# A chain of
AdScriptId’s representing the ancestry of an ad script that led to the creation of a frame. The chain is ordered from the script itself (lower level) up to its root ancestor that was flagged by filterlist.
-
ancestry_chain:
- class SecureContextType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
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'#
- class CrossOriginIsolatedContextType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Indicates whether the frame is cross-origin isolated and why it is the case.
- ISOLATED = 'Isolated'#
- NOT_ISOLATED = 'NotIsolated'#
- NOT_ISOLATED_FEATURE_DISABLED = 'NotIsolatedFeatureDisabled'#
- class GatedAPIFeatures(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
- SHARED_ARRAY_BUFFERS = 'SharedArrayBuffers'#
- SHARED_ARRAY_BUFFERS_TRANSFER_ALLOWED = 'SharedArrayBuffersTransferAllowed'#
- PERFORMANCE_MEASURE_MEMORY = 'PerformanceMeasureMemory'#
- PERFORMANCE_PROFILE = 'PerformanceProfile'#
- class PermissionsPolicyFeature(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
All Permissions Policy features. This enum should match the one defined in services/network/public/cpp/permissions_policy/permissions_policy_features.json5. LINT.IfChange(PermissionsPolicyFeature)
- ACCELEROMETER = 'accelerometer'#
- ALL_SCREENS_CAPTURE = 'all-screens-capture'#
- AMBIENT_LIGHT_SENSOR = 'ambient-light-sensor'#
- ARIA_NOTIFY = 'aria-notify'#
- ATTRIBUTION_REPORTING = 'attribution-reporting'#
- AUTOPLAY = 'autoplay'#
- BLUETOOTH = 'bluetooth'#
- BROWSING_TOPICS = 'browsing-topics'#
- CAMERA = 'camera'#
- CAPTURED_SURFACE_CONTROL = 'captured-surface-control'#
- 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_PREFERS_REDUCED_MOTION = 'ch-prefers-reduced-motion'#
- CH_PREFERS_REDUCED_TRANSPARENCY = 'ch-prefers-reduced-transparency'#
- CH_RTT = 'ch-rtt'#
- CH_SAVE_DATA = 'ch-save-data'#
- CH_UA = 'ch-ua'#
- CH_UA_ARCH = 'ch-ua-arch'#
- CH_UA_BITNESS = 'ch-ua-bitness'#
- CH_UA_HIGH_ENTROPY_VALUES = 'ch-ua-high-entropy-values'#
- CH_UA_PLATFORM = 'ch-ua-platform'#
- CH_UA_MODEL = 'ch-ua-model'#
- CH_UA_MOBILE = 'ch-ua-mobile'#
- CH_UA_FORM_FACTORS = 'ch-ua-form-factors'#
- 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_WOW64 = 'ch-ua-wow64'#
- CH_VIEWPORT_HEIGHT = 'ch-viewport-height'#
- CH_VIEWPORT_WIDTH = 'ch-viewport-width'#
- CH_WIDTH = 'ch-width'#
- CLIPBOARD_READ = 'clipboard-read'#
- CLIPBOARD_WRITE = 'clipboard-write'#
- COMPUTE_PRESSURE = 'compute-pressure'#
- CONTROLLED_FRAME = 'controlled-frame'#
- CROSS_ORIGIN_ISOLATED = 'cross-origin-isolated'#
- DEFERRED_FETCH = 'deferred-fetch'#
- DEFERRED_FETCH_MINIMAL = 'deferred-fetch-minimal'#
- DEVICE_ATTRIBUTES = 'device-attributes'#
- DIGITAL_CREDENTIALS_CREATE = 'digital-credentials-create'#
- DIGITAL_CREDENTIALS_GET = 'digital-credentials-get'#
- DIRECT_SOCKETS = 'direct-sockets'#
- DIRECT_SOCKETS_MULTICAST = 'direct-sockets-multicast'#
- DIRECT_SOCKETS_PRIVATE = 'direct-sockets-private'#
- 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'#
- FENCED_UNPARTITIONED_STORAGE_READ = 'fenced-unpartitioned-storage-read'#
- FOCUS_WITHOUT_USER_ACTIVATION = 'focus-without-user-activation'#
- FULLSCREEN = 'fullscreen'#
- FROBULATE = 'frobulate'#
- GAMEPAD = 'gamepad'#
- GEOLOCATION = 'geolocation'#
- GYROSCOPE = 'gyroscope'#
- HID = 'hid'#
- IDENTITY_CREDENTIALS_GET = 'identity-credentials-get'#
- IDLE_DETECTION = 'idle-detection'#
- INTEREST_COHORT = 'interest-cohort'#
- JOIN_AD_INTEREST_GROUP = 'join-ad-interest-group'#
- KEYBOARD_MAP = 'keyboard-map'#
- LANGUAGE_DETECTOR = 'language-detector'#
- LANGUAGE_MODEL = 'language-model'#
- LOCAL_FONTS = 'local-fonts'#
- LOCAL_NETWORK_ACCESS = 'local-network-access'#
- MAGNETOMETER = 'magnetometer'#
- MEDIA_PLAYBACK_WHILE_NOT_VISIBLE = 'media-playback-while-not-visible'#
- MICROPHONE = 'microphone'#
- MIDI = 'midi'#
- ON_DEVICE_SPEECH_RECOGNITION = 'on-device-speech-recognition'#
- OTP_CREDENTIALS = 'otp-credentials'#
- PAYMENT = 'payment'#
- PICTURE_IN_PICTURE = 'picture-in-picture'#
- POPINS = 'popins'#
- PRIVATE_AGGREGATION = 'private-aggregation'#
- PRIVATE_STATE_TOKEN_ISSUANCE = 'private-state-token-issuance'#
- PRIVATE_STATE_TOKEN_REDEMPTION = 'private-state-token-redemption'#
- PUBLICKEY_CREDENTIALS_CREATE = 'publickey-credentials-create'#
- PUBLICKEY_CREDENTIALS_GET = 'publickey-credentials-get'#
- RECORD_AD_AUCTION_EVENTS = 'record-ad-auction-events'#
- REWRITER = 'rewriter'#
- RUN_AD_AUCTION = 'run-ad-auction'#
- SCREEN_WAKE_LOCK = 'screen-wake-lock'#
- SERIAL = 'serial'#
- SHARED_AUTOFILL = 'shared-autofill'#
- SHARED_STORAGE = 'shared-storage'#
- SHARED_STORAGE_SELECT_URL = 'shared-storage-select-url'#
- SMART_CARD = 'smart-card'#
- SPEAKER_SELECTION = 'speaker-selection'#
- STORAGE_ACCESS = 'storage-access'#
- SUB_APPS = 'sub-apps'#
- SUMMARIZER = 'summarizer'#
- SYNC_XHR = 'sync-xhr'#
- TRANSLATOR = 'translator'#
- UNLOAD = 'unload'#
- USB = 'usb'#
- USB_UNRESTRICTED = 'usb-unrestricted'#
- VERTICAL_SCROLL = 'vertical-scroll'#
- WEB_APP_INSTALLATION = 'web-app-installation'#
- WEB_PRINTING = 'web-printing'#
- WEB_SHARE = 'web-share'#
- WINDOW_MANAGEMENT = 'window-management'#
- WRITER = 'writer'#
- XR_SPATIAL_TRACKING = 'xr-spatial-tracking'#
- class PermissionsPolicyBlockReason(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Reason for a permissions policy feature to be disabled.
- HEADER = 'Header'#
- IFRAME_ATTRIBUTE = 'IframeAttribute'#
- IN_FENCED_FRAME_TREE = 'InFencedFrameTree'#
- IN_ISOLATED_APP = 'InIsolatedApp'#
- class PermissionsPolicyBlockLocator(frame_id, block_reason)[source]#
-
-
block_reason:
PermissionsPolicyBlockReason#
-
block_reason:
- class PermissionsPolicyFeatureState(feature, allowed, locator=None)[source]#
-
feature:
PermissionsPolicyFeature#
-
locator:
Optional[PermissionsPolicyBlockLocator] = None#
-
feature:
- class OriginTrialTokenStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
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'#
- class OriginTrialStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Status for an Origin Trial.
- ENABLED = 'Enabled'#
- VALID_TOKEN_NOT_PROVIDED = 'ValidTokenNotProvided'#
- OS_NOT_SUPPORTED = 'OSNotSupported'#
- TRIAL_NOT_ALLOWED = 'TrialNotAllowed'#
- class OriginTrialUsageRestriction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
- NONE = 'None'#
- SUBSET = 'Subset'#
- class OriginTrialToken(origin, match_sub_domains, trial_name, expiry_time, is_third_party, usage_restriction)[source]#
-
-
expiry_time:
TimeSinceEpoch#
-
usage_restriction:
OriginTrialUsageRestriction#
-
expiry_time:
- class OriginTrialTokenWithStatus(raw_token_text, status, parsed_token=None)[source]#
-
-
status:
OriginTrialTokenStatus#
-
parsed_token:
Optional[OriginTrialToken] = None# parsedTokenis present only when the token is extractable and parsable.
-
status:
- class OriginTrial(trial_name, status, tokens_with_status)[source]#
-
-
status:
OriginTrialStatus#
-
tokens_with_status:
List[OriginTrialTokenWithStatus]#
-
status:
- class SecurityOriginDetails(is_localhost)[source]#
Additional information about the frame document’s security origin.
- class Frame(id_, loader_id, url, domain_and_registry, security_origin, mime_type, secure_context_type, cross_origin_isolated_context_type, gated_api_features, parent_id=None, name=None, url_fragment=None, security_origin_details=None, unreachable_url=None, ad_frame_status=None)[source]#
Information about the Frame on the page.
-
domain_and_registry:
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”
-
secure_context_type:
SecureContextType# Indicates whether the main document is a secure context and explains why that is the case.
-
cross_origin_isolated_context_type:
CrossOriginIsolatedContextType# Indicates whether this is a cross origin isolated context.
-
gated_api_features:
List[GatedAPIFeatures]# Indicated which gated APIs / features are available.
-
security_origin_details:
Optional[SecurityOriginDetails] = None# Additional details about the frame document’s security origin.
-
unreachable_url:
Optional[str] = None# 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.
-
ad_frame_status:
Optional[AdFrameStatus] = None# Indicates whether this frame was tagged as an ad and why.
-
domain_and_registry:
- class FrameResource(url, type_, mime_type, last_modified=None, content_size=None, failed=None, canceled=None)[source]#
Information about the Resource on the page.
-
type_:
ResourceType# Type of this resource.
-
last_modified:
Optional[TimeSinceEpoch] = None# last-modified timestamp as reported by server.
-
type_:
- class FrameResourceTree(frame, resources, child_frames=None)[source]#
Information about the Frame hierarchy along with their cached resources.
-
resources:
List[FrameResource]# Information about frame resources.
-
child_frames:
Optional[List[FrameResourceTree]] = None# Child frames.
-
resources:
- class TransitionType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Transition type.
- LINK = 'link'#
- TYPED = 'typed'#
- ADDRESS_BAR = 'address_bar'#
- AUTO_BOOKMARK = 'auto_bookmark'#
- AUTO_SUBFRAME = 'auto_subframe'#
- MANUAL_SUBFRAME = 'manual_subframe'#
- GENERATED = 'generated'#
- AUTO_TOPLEVEL = 'auto_toplevel'#
- FORM_SUBMIT = 'form_submit'#
- RELOAD = 'reload'#
- KEYWORD = 'keyword'#
- KEYWORD_GENERATED = 'keyword_generated'#
- OTHER = 'other'#
Navigation history entry.
Unique id of the navigation history entry.
URL of the navigation history entry.
URL that the user typed in the url bar.
Title of the navigation history entry.
Transition type.
- class ScreencastFrameMetadata(offset_top, page_scale_factor, device_width, device_height, scroll_offset_x, scroll_offset_y, timestamp=None)[source]#
Screencast frame metadata.
-
timestamp:
Optional[TimeSinceEpoch] = None# Frame swap timestamp.
-
timestamp:
- class DialogType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Javascript dialog type.
- ALERT = 'alert'#
- CONFIRM = 'confirm'#
- PROMPT = 'prompt'#
- BEFOREUNLOAD = 'beforeunload'#
- class LayoutViewport(page_x, page_y, client_width, client_height)[source]#
Layout viewport position and dimensions.
- class VisualViewport(offset_x, offset_y, page_x, page_y, client_width, client_height, scale, zoom=None)[source]#
Visual viewport position, dimensions, and scale.
- class FontFamilies(standard=None, fixed=None, serif=None, sans_serif=None, cursive=None, fantasy=None, math=None)[source]#
Generic font families collection.
- class ScriptFontFamilies(script, font_families)[source]#
Font families collection for a script.
-
font_families:
FontFamilies# Generic font families collection for the script.
-
font_families:
- class InstallabilityError(error_id, error_arguments)[source]#
The installability error
-
error_arguments:
List[InstallabilityErrorArgument]# ‘64’}).
- Type:
The list of error arguments (e.g. {name
- Type:
‘minimum-icon-size-in-pixels’, value
-
error_arguments:
- class ReferrerPolicy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
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'#
- class CompilationCacheParams(url, eager=None)[source]#
Per-script compilation cache parameters for
Page.produceCompilationCache
- class FileHandler(action, name, launch_type, icons=None, accepts=None)[source]#
-
-
launch_type:
str# Won’t repeat the enums, using string for easy comparison. Same as the other enums below.
-
icons:
Optional[List[ImageResource]] = None#
-
accepts:
Optional[List[FileFilter]] = None# Mimic a map, name is the key, accepts is the value.
-
launch_type:
- class ImageResource(url, sizes=None, type_=None)[source]#
The image definition used in both icon and screenshot.
- class ScopeExtension(origin, has_origin_wildcard)[source]#
- class Screenshot(image, form_factor, label=None)[source]#
-
image:
ImageResource#
-
image:
Embed the ShareTargetParams
- class WebAppManifest(background_color=None, description=None, dir_=None, display=None, display_overrides=None, file_handlers=None, icons=None, id_=None, lang=None, launch_handler=None, name=None, orientation=None, prefer_related_applications=None, protocol_handlers=None, related_applications=None, scope=None, scope_extensions=None, screenshots=None, share_target=None, short_name=None, shortcuts=None, start_url=None, theme_color=None)[source]#
-
-
file_handlers:
Optional[List[FileHandler]] = None# The handlers to open files.
-
icons:
Optional[List[ImageResource]] = None#
-
launch_handler:
Optional[LaunchHandler] = None# This field is non-standard and part of a Chrome experiment. See: https://github.com/WICG/web-app-launch/blob/main/launch_handler.md
- Type:
TODO(crbug.com/1231886)
-
protocol_handlers:
Optional[List[ProtocolHandler]] = None# The handlers to open protocols.
-
scope_extensions:
Optional[List[ScopeExtension]] = None# Non-standard, see https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md
-
screenshots:
Optional[List[Screenshot]] = None# The screenshots used by chromium.
-
file_handlers:
The type of a frameNavigated event.
- class BackForwardCacheNotRestoredReason(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
List of not restored reasons for back-forward cache.
- NOT_PRIMARY_MAIN_FRAME = 'NotPrimaryMainFrame'#
- 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'#
- 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'#
- 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'#
- ERROR_DOCUMENT = 'ErrorDocument'#
- FENCED_FRAMES_EMBEDDER = 'FencedFramesEmbedder'#
- COOKIE_DISABLED = 'CookieDisabled'#
- HTTP_AUTH_REQUIRED = 'HTTPAuthRequired'#
- COOKIE_FLUSHED = 'CookieFlushed'#
- BROADCAST_CHANNEL_ON_MESSAGE = 'BroadcastChannelOnMessage'#
- WEB_VIEW_SETTINGS_CHANGED = 'WebViewSettingsChanged'#
- WEB_VIEW_JAVA_SCRIPT_OBJECT_CHANGED = 'WebViewJavaScriptObjectChanged'#
- WEB_VIEW_MESSAGE_LISTENER_INJECTED = 'WebViewMessageListenerInjected'#
- WEB_VIEW_SAFE_BROWSING_ALLOWLIST_CHANGED = 'WebViewSafeBrowsingAllowlistChanged'#
- WEB_VIEW_DOCUMENT_START_JAVASCRIPT_CHANGED = 'WebViewDocumentStartJavascriptChanged'#
- 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'#
- OUTSTANDING_NETWORK_REQUEST_OTHERS = 'OutstandingNetworkRequestOthers'#
- 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'#
- WEB_XR = 'WebXR'#
- SHARED_WORKER = 'SharedWorker'#
- SHARED_WORKER_MESSAGE = 'SharedWorkerMessage'#
- 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'#
- 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'#
- KEEPALIVE_REQUEST = 'KeepaliveRequest'#
- INDEXED_DB_EVENT = 'IndexedDBEvent'#
- DUMMY = 'Dummy'#
- JS_NETWORK_REQUEST_RECEIVED_CACHE_CONTROL_NO_STORE_RESOURCE = 'JsNetworkRequestReceivedCacheControlNoStoreResource'#
- WEB_RTC_USED_WITH_CCNS = 'WebRTCUsedWithCCNS'#
- WEB_TRANSPORT_USED_WITH_CCNS = 'WebTransportUsedWithCCNS'#
- WEB_SOCKET_USED_WITH_CCNS = 'WebSocketUsedWithCCNS'#
- SMART_CARD = 'SmartCard'#
- LIVE_MEDIA_STREAM_TRACK = 'LiveMediaStreamTrack'#
- UNLOAD_HANDLER = 'UnloadHandler'#
- PARSER_ABORTED = 'ParserAborted'#
- 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_SERVICE = 'ContentMediaSessionService'#
- CONTENT_SCREEN_READER = 'ContentScreenReader'#
- CONTENT_DISCARDED = 'ContentDiscarded'#
- 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'#
- REQUESTED_BY_WEB_VIEW_CLIENT = 'RequestedByWebViewClient'#
- POST_MESSAGE_BY_WEB_VIEW_CLIENT = 'PostMessageByWebViewClient'#
- CACHE_CONTROL_NO_STORE_DEVICE_BOUND_SESSION_TERMINATED = 'CacheControlNoStoreDeviceBoundSessionTerminated'#
- CACHE_LIMIT_PRUNED_ON_MODERATE_MEMORY_PRESSURE = 'CacheLimitPrunedOnModerateMemoryPressure'#
- CACHE_LIMIT_PRUNED_ON_CRITICAL_MEMORY_PRESSURE = 'CacheLimitPrunedOnCriticalMemoryPressure'#
- class BackForwardCacheNotRestoredReasonType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Types of not restored reasons for back-forward cache.
- SUPPORT_PENDING = 'SupportPending'#
- PAGE_SUPPORT_NEEDED = 'PageSupportNeeded'#
- CIRCUMSTANTIAL = 'Circumstantial'#
- class BackForwardCacheNotRestoredExplanation(type_, reason, context=None, details=None)[source]#
-
type_:
BackForwardCacheNotRestoredReasonType# Type of the reason
-
reason:
BackForwardCacheNotRestoredReason# Not restored reason
-
context:
Optional[str] = None# Context associated with the reason. The meaning of this context is dependent on the reason: - EmbedderExtensionSentMessageToCachedFrame: the extension ID.
-
details:
Optional[List[BackForwardCacheBlockingDetails]] = None#
-
type_:
- class BackForwardCacheNotRestoredExplanationTree(url, explanations, children)[source]#
-
-
explanations:
List[BackForwardCacheNotRestoredExplanation]# Not restored reasons of each frame
-
children:
List[BackForwardCacheNotRestoredExplanationTree]# Array of children frame
-
explanations:
Commands#
Each command is a generator function. The return
type Generator[x, y, z] indicates that the generator
yields arguments of type x, it must be resumed with
an argument of type y, and it returns type z. In
this library, types x and y are the same for all
commands, and z is the return type you should pay attention
to. For more information, see
Getting Started: Commands.
- add_compilation_cache(url, data)[source]#
Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.
EXPERIMENTAL
- add_script_to_evaluate_on_load(script_source)[source]#
Deprecated, please use addScriptToEvaluateOnNewDocument instead.
Deprecated since version 1.3.
EXPERIMENTAL
- Parameters:
script_source (
str) –- Return type:
- Returns:
Identifier of the added script.
Deprecated since version 1.3.
- add_script_to_evaluate_on_new_document(source, world_name=None, include_command_line_api=None, run_immediately=None)[source]#
Evaluates given script in every frame upon creation (before loading frame’s scripts).
- Parameters:
source (
str) –world_name (
Optional[str]) – (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.include_command_line_api (
Optional[bool]) – (EXPERIMENTAL) (Optional) Specifies whether command line API should be available to the script, defaults to false.run_immediately (
Optional[bool]) – (EXPERIMENTAL) (Optional) If true, runs the script immediately on existing execution contexts or worlds. Default: false.
- Return type:
- Returns:
Identifier of the added script.
- capture_screenshot(format_=None, quality=None, clip=None, from_surface=None, capture_beyond_viewport=None, optimize_for_speed=None)[source]#
Capture page screenshot.
- Parameters:
format – (Optional) Image compression format (defaults to png).
quality (
Optional[int]) – (Optional) Compression quality from range [0..100] (jpeg only).clip (
Optional[Viewport]) – (Optional) Capture the screenshot of a given region only.from_surface (
Optional[bool]) – (EXPERIMENTAL) (Optional) Capture the screenshot from the surface, rather than the view. Defaults to true.capture_beyond_viewport (
Optional[bool]) – (EXPERIMENTAL) (Optional) Capture the screenshot beyond the viewport. Defaults to false.optimize_for_speed (
Optional[bool]) – (EXPERIMENTAL) (Optional) Optimize image encoding for speed, not for resulting size (defaults to false)
- Return type:
- Returns:
Base64-encoded image data. (Encoded as a base64 string when passed over JSON)
- capture_snapshot(format_=None)[source]#
Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.
EXPERIMENTAL
- clear_device_metrics_override()[source]#
Clears the overridden device metrics. :rtype:
Generator[Dict[str,Any],Dict[str,Any],None]Deprecated since version 1.3.
EXPERIMENTAL
Deprecated since version 1.3.
- clear_device_orientation_override()[source]#
Clears the overridden Device Orientation. :rtype:
Generator[Dict[str,Any],Dict[str,Any],None]Deprecated since version 1.3.
EXPERIMENTAL
Deprecated since version 1.3.
- clear_geolocation_override()[source]#
Clears the overridden Geolocation Position and Error. :rtype:
Generator[Dict[str,Any],Dict[str,Any],None]Deprecated since version 1.3.
Deprecated since version 1.3.
- create_isolated_world(frame_id, world_name=None, grant_univeral_access=None)[source]#
Creates an isolated world for the given frame.
- Parameters:
frame_id (
FrameId) – Id of the frame in which the isolated world should be created.world_name (
Optional[str]) – (Optional) An optional name which is reported in the Execution Context.grant_univeral_access (
Optional[bool]) – (Optional) Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],ExecutionContextId]- Returns:
Execution context of the isolated world.
- delete_cookie(cookie_name, url)[source]#
Deletes browser cookie with given name, domain and path.
Deprecated since version 1.3.
EXPERIMENTAL
- Parameters:
- Return type:
Deprecated since version 1.3.
- enable(enable_file_chooser_opened_event=None)[source]#
Enables page domain notifications.
- get_ad_script_ancestry(frame_id)[source]#
EXPERIMENTAL
- Parameters:
frame_id (
FrameId) –- Return type:
Generator[Dict[str,Any],Dict[str,Any],Optional[AdScriptAncestry]]- Returns:
(Optional) The ancestry chain of ad script identifiers leading to this frame’s creation, along with the root script’s filterlist rule. The ancestry chain is ordered from the most immediate script (in the frame creation stack) to more distant ancestors (that created the immediately preceding script). Only sent if frame is labelled as an ad and ids are available.
- get_app_id()[source]#
Returns the unique (PWA) app id. Only returns values if the feature flag ‘WebAppEnableManifestId’ is enabled
EXPERIMENTAL
- Return type:
Generator[Dict[str,Any],Dict[str,Any],Tuple[Optional[str],Optional[str]]]- Returns:
A tuple with the following items:
appId - (Optional) App id, either from manifest’s id attribute or computed from start_url
recommendedId - (Optional) Recommendation for manifest’s id attribute to match current id computed from start_url
- get_app_manifest(manifest_id=None)[source]#
- Gets the processed manifest for this current document.
This API always waits for the manifest to be loaded. If manifestId is provided, and it does not match the manifest of the
current document, this API errors out.
If there is not a loaded page, this API errors out immediately.
- Parameters:
- Return type:
Generator[Dict[str,Any],Dict[str,Any],Tuple[str,List[AppManifestError],Optional[str],Optional[AppManifestParsedProperties],WebAppManifest]]- Returns:
A tuple with the following items:
url - Manifest location.
errors -
data - (Optional) Manifest content.
parsed - (Optional) Parsed manifest properties. Deprecated, use manifest instead.
manifest -
- get_layout_metrics()[source]#
Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],Tuple[LayoutViewport,VisualViewport,Rect,LayoutViewport,VisualViewport,Rect]]- Returns:
A tuple with the following items:
layoutViewport - Deprecated metrics relating to the layout viewport. Is in device pixels. Use
cssLayoutViewportinstead.visualViewport - Deprecated metrics relating to the visual viewport. Is in device pixels. Use
cssVisualViewportinstead.contentSize - Deprecated size of scrollable area. Is in DP. Use
cssContentSizeinstead.cssLayoutViewport - Metrics relating to the layout viewport in CSS pixels.
cssVisualViewport - Metrics relating to the visual viewport in CSS pixels.
cssContentSize - Size of scrollable area in CSS pixels.
- get_manifest_icons()[source]#
Deprecated because it’s not guaranteed that the returned icon is in fact the one used for PWA installation.
Deprecated since version 1.3.
EXPERIMENTAL
Deprecated since version 1.3.
Returns navigation history for the current page.
- get_permissions_policy_state(frame_id)[source]#
Get Permissions Policy state on given frame.
EXPERIMENTAL
- get_resource_content(frame_id, url)[source]#
Returns content of the given resource.
EXPERIMENTAL
- Parameters:
- Return type:
- Returns:
A tuple with the following items:
content - Resource content.
base64Encoded - True, if content was served as base64.
- handle_java_script_dialog(accept, prompt_text=None)[source]#
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
Navigates current page to the given URL.
- Parameters:
url (
str) – URL to navigate the page to.transition_type (
Optional[TransitionType]) – (Optional) Intended transition type.frame_id (
Optional[FrameId]) – (Optional) Frame id to navigate, if not specified navigates the top frame.referrer_policy (
Optional[ReferrerPolicy]) – (EXPERIMENTAL) (Optional) Referrer-policy used for the navigation.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],Tuple[FrameId,Optional[LoaderId],Optional[str],Optional[bool]]]- Returns:
A tuple with the following items:
frameId - Frame id that has navigated (or failed to navigate)
loaderId - (Optional) Loader identifier. This is omitted in case of same-document navigation, as the previously committed loaderId would not change.
errorText - (Optional) User friendly error message, present if and only if navigation has failed.
isDownload - (Optional) Whether the navigation resulted in a download.
Navigates current page to the given history entry.
- print_to_pdf(landscape=None, display_header_footer=None, print_background=None, scale=None, paper_width=None, paper_height=None, margin_top=None, margin_bottom=None, margin_left=None, margin_right=None, page_ranges=None, header_template=None, footer_template=None, prefer_css_page_size=None, transfer_mode=None, generate_tagged_pdf=None, generate_document_outline=None)[source]#
Print page as PDF.
- Parameters:
landscape (
Optional[bool]) – (Optional) Paper orientation. Defaults to false.display_header_footer (
Optional[bool]) – (Optional) Display header and footer. Defaults to false.print_background (
Optional[bool]) – (Optional) Print background graphics. Defaults to false.scale (
Optional[float]) – (Optional) Scale of the webpage rendering. Defaults to 1.paper_width (
Optional[float]) – (Optional) Paper width in inches. Defaults to 8.5 inches.paper_height (
Optional[float]) – (Optional) Paper height in inches. Defaults to 11 inches.margin_top (
Optional[float]) – (Optional) Top margin in inches. Defaults to 1cm (~0.4 inches).margin_bottom (
Optional[float]) – (Optional) Bottom margin in inches. Defaults to 1cm (~0.4 inches).margin_left (
Optional[float]) – (Optional) Left margin in inches. Defaults to 1cm (~0.4 inches).margin_right (
Optional[float]) – (Optional) Right margin in inches. Defaults to 1cm (~0.4 inches).page_ranges (
Optional[str]) – (Optional) Paper ranges to print, one based, e.g., ‘1-5, 8, 11-13’. Pages are printed in the document order, not in the order specified, and no more than once. Defaults to empty string, which implies the entire document is printed. The page numbers are quietly capped to actual page count of the document, and ranges beyond the end of the document are ignored. If this results in no pages to print, an error is reported. It is an error to specify a range with start greater than end.header_template (
Optional[str]) – (Optional) HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: -`date``: formatted print date -``title``: document title -``url``: document location -``pageNumber``: current page number -``totalPages``: total pages in the document For example,``<span class=title></span>``would generate span containing the title.footer_template (
Optional[str]) – (Optional) HTML template for the print footer. Should use the same format as the``headerTemplate``.prefer_css_page_size (
Optional[bool]) – (Optional) Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.transfer_mode (
Optional[str]) – (EXPERIMENTAL) (Optional) return as streamgenerate_tagged_pdf (
Optional[bool]) – (EXPERIMENTAL) (Optional) Whether or not to generate tagged (accessible) PDF. Defaults to embedder choice.generate_document_outline (
Optional[bool]) – (EXPERIMENTAL) (Optional) Whether or not to embed the document outline into the PDF.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],Tuple[str,Optional[StreamHandle]]]- Returns:
A tuple with the following items:
data - Base64-encoded pdf data. Empty if `` returnAsStream` is specified. (Encoded as a base64 string when passed over JSON)
stream - (Optional) A handle of the stream that holds resulting PDF data.
- produce_compilation_cache(scripts)[source]#
Requests backend to produce compilation cache for the specified scripts.
scriptsare appended 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
- reload(ignore_cache=None, script_to_evaluate_on_load=None, loader_id=None)[source]#
Reloads given page optionally ignoring the cache.
- Parameters:
ignore_cache (
Optional[bool]) – (Optional) If true, browser cache is ignored (as if the user pressed Shift+refresh).script_to_evaluate_on_load (
Optional[str]) – (Optional) If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin.loader_id (
Optional[LoaderId]) – (EXPERIMENTAL) (Optional) If set, an error will be thrown if the target page’s main frame’s loader id does not match the provided id. This prevents accidentally reloading an unintended target in case there’s a racing navigation.
- Return type:
- remove_script_to_evaluate_on_load(identifier)[source]#
Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
Deprecated since version 1.3.
EXPERIMENTAL
- Parameters:
identifier (
ScriptIdentifier) –- Return type:
Deprecated since version 1.3.
Resets navigation history for the current page.
- screencast_frame_ack(session_id)[source]#
Acknowledges that a screencast frame has been received by the frontend.
EXPERIMENTAL
- search_in_resource(frame_id, url, query, case_sensitive=None, is_regex=None)[source]#
Searches for given string in resource content.
EXPERIMENTAL
- Parameters:
frame_id (
FrameId) – Frame id for resource to search in.url (
str) – URL of the resource to search in.query (
str) – String to search for.case_sensitive (
Optional[bool]) – (Optional) If true, search is case sensitive.is_regex (
Optional[bool]) – (Optional) If true, treats string parameter as regex.
- Return type:
Generator[Dict[str,Any],Dict[str,Any],List[SearchMatch]]- Returns:
List of search matches.
- set_ad_blocking_enabled(enabled)[source]#
Enable Chrome’s experimental ad filter on all sites.
EXPERIMENTAL
- set_device_metrics_override(width, height, device_scale_factor, mobile, scale=None, screen_width=None, screen_height=None, position_x=None, position_y=None, dont_set_visible_size=None, screen_orientation=None, viewport=None)[source]#
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).
Deprecated since version 1.3.
EXPERIMENTAL
- Parameters:
width (
int) – Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.height (
int) – Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.device_scale_factor (
float) – Overriding device scale factor value. 0 disables the override.mobile (
bool) – Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.scale (
Optional[float]) – (Optional) Scale to apply to resulting view image.screen_width (
Optional[int]) – (Optional) Overriding screen width value in pixels (minimum 0, maximum 10000000).screen_height (
Optional[int]) – (Optional) Overriding screen height value in pixels (minimum 0, maximum 10000000).position_x (
Optional[int]) – (Optional) Overriding view X position on screen in pixels (minimum 0, maximum 10000000).position_y (
Optional[int]) – (Optional) Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).dont_set_visible_size (
Optional[bool]) – (Optional) Do not set visible view size, rely upon explicit setVisibleSize call.screen_orientation (
Optional[ScreenOrientation]) – (Optional) Screen orientation override.viewport (
Optional[Viewport]) – (Optional) The viewport dimensions and scale. If not set, the override is cleared.
- Return type:
Deprecated since version 1.3.
- set_device_orientation_override(alpha, beta, gamma)[source]#
Overrides the Device Orientation.
Deprecated since version 1.3.
EXPERIMENTAL
- Parameters:
- Return type:
Deprecated since version 1.3.
- set_download_behavior(behavior, download_path=None)[source]#
Set the behavior when downloading a file.
Deprecated since version 1.3.
EXPERIMENTAL
- Parameters:
- Return type:
Deprecated since version 1.3.
- set_font_families(font_families, for_scripts=None)[source]#
Set generic font families.
EXPERIMENTAL
- Parameters:
font_families (
FontFamilies) – Specifies font families to set. If a font family is not specified, it won’t be changed.for_scripts (
Optional[List[ScriptFontFamilies]]) – (Optional) Specifies font families to set for individual scripts.
- Return type:
- set_geolocation_override(latitude=None, longitude=None, accuracy=None)[source]#
Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
Deprecated since version 1.3.
- Parameters:
- Return type:
Deprecated since version 1.3.
- set_intercept_file_chooser_dialog(enabled, cancel=None)[source]#
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.fileChooserOpenedis emitted.
- set_prerendering_allowed(is_allowed)[source]#
Enable/disable prerendering manually.
This command is a short-term solution for https://crbug.com/1440085. See https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA for more details.
TODO(https://crbug.com/1440085): Remove this once Puppeteer supports tab targets.
EXPERIMENTAL
- set_rph_registration_mode(mode)[source]#
Extensions for Custom Handlers API: https://html.spec.whatwg.org/multipage/system-state.html#rph-automation
EXPERIMENTAL
- set_spc_transaction_mode(mode)[source]#
Sets the Secure Payment Confirmation transaction mode. https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode
EXPERIMENTAL
- set_touch_emulation_enabled(enabled, configuration=None)[source]#
Toggles mouse event-based touch event emulation.
Deprecated since version 1.3.
EXPERIMENTAL
- Parameters:
- Return type:
Deprecated since version 1.3.
- set_web_lifecycle_state(state)[source]#
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/
EXPERIMENTAL
- start_screencast(format_=None, quality=None, max_width=None, max_height=None, every_nth_frame=None)[source]#
Starts sending each frame using the
screencastFrameevent.EXPERIMENTAL
- Parameters:
format – (Optional) Image compression format.
quality (
Optional[int]) – (Optional) Compression quality from range [0..100].max_width (
Optional[int]) – (Optional) Maximum screenshot width.max_height (
Optional[int]) – (Optional) Maximum screenshot height.every_nth_frame (
Optional[int]) – (Optional) Send every n-th frame.
- Return type:
Events#
Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.
- class DomContentEventFired(timestamp)[source]#
-
timestamp:
MonotonicTime#
-
timestamp:
- class FileChooserOpened(frame_id, mode, backend_node_id)[source]#
Emitted only when
page.interceptFileChooseris enabled.-
backend_node_id:
Optional[BackendNodeId]# Input node id. Only present for file choosers opened via an
<input type="file">element.
-
backend_node_id:
- class FrameAttached(frame_id, parent_frame_id, stack)[source]#
Fired when frame has been attached to its parent.
-
stack:
Optional[StackTrace]# JavaScript stack trace of when frame was attached, only set if frame initiated from script.
-
stack:
Fired when frame no longer has a scheduled navigation.
Deprecated since version 1.3.
Id of the frame that has cleared its scheduled navigation.
- class FrameSubtreeWillBeDetached(frame_id)[source]#
EXPERIMENTAL
Fired before frame subtree is detached. Emitted before any frame of the subtree is actually detached.
Fired once navigation of the frame has completed. Frame is now associated with the new loader.
Frame object.
EXPERIMENTAL
Fired when a navigation starts. This event is fired for both renderer-initiated and browser-initiated navigations. For renderer-initiated navigations, the event is fired after
frameRequestedNavigation. Navigation may still be cancelled after the event is issued. Multiple events can be fired for a single navigation, for example, when a same-document navigation becomes a cross-document navigation (such as in the case of a frameset).ID of the frame that is being navigated.
The URL the navigation started with. The final URL can be different.
Loader identifier. Even though it is present in case of same-document navigation, the previously committed loaderId would not change unless the navigation changes from a same-document to a cross-document navigation.
EXPERIMENTAL
Fired when a renderer-initiated navigation is requested. Navigation may still be cancelled after the event is issued.
Id of the frame that is being navigated.
The reason for the navigation.
The destination URL for the requested navigation.
The disposition for the navigation.
Fired when frame schedules a potential navigation.
Deprecated since version 1.3.
Id of the frame that has scheduled a navigation.
Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start.
The reason for the navigation.
The destination URL for the scheduled navigation.
- class DownloadWillBegin(frame_id, guid, url, suggested_filename)[source]#
EXPERIMENTAL
Fired when page is about to start a download. Deprecated. Use Browser.downloadWillBegin instead.
Deprecated since version 1.3.
- class DownloadProgress(guid, total_bytes, received_bytes, state)[source]#
EXPERIMENTAL
Fired when download makes progress. Last call has
done== true. Deprecated. Use Browser.downloadProgress instead.Deprecated since version 1.3.
- class JavascriptDialogClosed(frame_id, result, user_input)[source]#
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.
- class JavascriptDialogOpening(url, frame_id, message, type_, has_browser_handler, default_prompt)[source]#
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.
-
type_:
DialogType# Dialog type.
-
type_:
- class LifecycleEvent(frame_id, loader_id, name, timestamp)[source]#
Fired for lifecycle events (navigation, load, paint, etc) in the current target (including local frames).
-
timestamp:
MonotonicTime#
-
timestamp:
- class BackForwardCacheNotUsed(loader_id, frame_id, not_restored_explanations, not_restored_explanations_tree)[source]#
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.
-
not_restored_explanations:
List[BackForwardCacheNotRestoredExplanation]# Array of reasons why the page could not be cached. This must not be empty.
-
not_restored_explanations_tree:
Optional[BackForwardCacheNotRestoredExplanationTree]# Tree structure of reasons why the page could not be cached for each frame.
-
not_restored_explanations:
- class LoadEventFired(timestamp)[source]#
-
timestamp:
MonotonicTime#
-
timestamp:
EXPERIMENTAL
Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.
Id of the frame.
Frame’s new url.
Navigation type
- class ScreencastFrame(data, metadata, session_id)[source]#
EXPERIMENTAL
Compressed image data requested by the
startScreencast.-
metadata:
ScreencastFrameMetadata# Screencast frame metadata.
-
metadata:
- class ScreencastVisibilityChanged(visible)[source]#
EXPERIMENTAL
Fired when the page with currently enabled screencast was shown or hidden .