browser
Bounds
dataclass
Browser window bounds information
Source code in zendriver/cdp/browser.py
height: typing.Optional[int] = None
class-attribute
instance-attribute
left: typing.Optional[int] = None
class-attribute
instance-attribute
top: typing.Optional[int] = None
class-attribute
instance-attribute
width: typing.Optional[int] = None
class-attribute
instance-attribute
window_state: typing.Optional[WindowState] = None
class-attribute
instance-attribute
__init__(left=None, top=None, width=None, height=None, window_state=None)
from_json(json)
classmethod
Source code in zendriver/cdp/browser.py
to_json()
Source code in zendriver/cdp/browser.py
BrowserCommandId
Bases: Enum
Browser command ids used by executeBrowserCommand.
Source code in zendriver/cdp/browser.py
CLOSE_TAB_SEARCH = 'closeTabSearch'
class-attribute
instance-attribute
OPEN_GLIC = 'openGlic'
class-attribute
instance-attribute
OPEN_TAB_SEARCH = 'openTabSearch'
class-attribute
instance-attribute
from_json(json)
classmethod
BrowserContextID
Bases: str
Source code in zendriver/cdp/browser.py
__repr__()
from_json(json)
classmethod
Bucket
dataclass
Chrome histogram bucket.
Source code in zendriver/cdp/browser.py
count: int
instance-attribute
high: int
instance-attribute
low: int
instance-attribute
__init__(low, high, count)
from_json(json)
classmethod
DownloadProgress
dataclass
EXPERIMENTAL
Fired when download makes progress. Last call has done == true.
Source code in zendriver/cdp/browser.py
file_path: typing.Optional[str]
instance-attribute
guid: str
instance-attribute
received_bytes: float
instance-attribute
state: str
instance-attribute
total_bytes: float
instance-attribute
__init__(guid, total_bytes, received_bytes, state, file_path)
from_json(json)
classmethod
Source code in zendriver/cdp/browser.py
DownloadWillBegin
dataclass
EXPERIMENTAL
Fired when page is about to start a download.
Source code in zendriver/cdp/browser.py
frame_id: page.FrameId
instance-attribute
guid: str
instance-attribute
suggested_filename: str
instance-attribute
url: str
instance-attribute
__init__(frame_id, guid, url, suggested_filename)
from_json(json)
classmethod
Source code in zendriver/cdp/browser.py
Histogram
dataclass
Chrome histogram.
Source code in zendriver/cdp/browser.py
buckets: typing.List[Bucket]
instance-attribute
count: int
instance-attribute
name: str
instance-attribute
sum_: int
instance-attribute
__init__(name, sum_, count, buckets)
from_json(json)
classmethod
PermissionDescriptor
dataclass
Definition of PermissionDescriptor defined in the Permissions API: https://w3c.github.io/permissions/#dom-permissiondescriptor.
Source code in zendriver/cdp/browser.py
allow_without_gesture: typing.Optional[bool] = None
class-attribute
instance-attribute
allow_without_sanitization: typing.Optional[bool] = None
class-attribute
instance-attribute
name: str
instance-attribute
pan_tilt_zoom: typing.Optional[bool] = None
class-attribute
instance-attribute
sysex: typing.Optional[bool] = None
class-attribute
instance-attribute
user_visible_only: typing.Optional[bool] = None
class-attribute
instance-attribute
__init__(name, sysex=None, user_visible_only=None, allow_without_sanitization=None, allow_without_gesture=None, pan_tilt_zoom=None)
from_json(json)
classmethod
Source code in zendriver/cdp/browser.py
to_json()
Source code in zendriver/cdp/browser.py
PermissionSetting
Bases: Enum
Source code in zendriver/cdp/browser.py
DENIED = 'denied'
class-attribute
instance-attribute
GRANTED = 'granted'
class-attribute
instance-attribute
PROMPT = 'prompt'
class-attribute
instance-attribute
from_json(json)
classmethod
PermissionType
Bases: Enum
Source code in zendriver/cdp/browser.py
AR = 'ar'
class-attribute
instance-attribute
AUDIO_CAPTURE = 'audioCapture'
class-attribute
instance-attribute
AUTOMATIC_FULLSCREEN = 'automaticFullscreen'
class-attribute
instance-attribute
BACKGROUND_FETCH = 'backgroundFetch'
class-attribute
instance-attribute
BACKGROUND_SYNC = 'backgroundSync'
class-attribute
instance-attribute
CAMERA_PAN_TILT_ZOOM = 'cameraPanTiltZoom'
class-attribute
instance-attribute
CAPTURED_SURFACE_CONTROL = 'capturedSurfaceControl'
class-attribute
instance-attribute
CLIPBOARD_READ_WRITE = 'clipboardReadWrite'
class-attribute
instance-attribute
CLIPBOARD_SANITIZED_WRITE = 'clipboardSanitizedWrite'
class-attribute
instance-attribute
DISPLAY_CAPTURE = 'displayCapture'
class-attribute
instance-attribute
DURABLE_STORAGE = 'durableStorage'
class-attribute
instance-attribute
GEOLOCATION = 'geolocation'
class-attribute
instance-attribute
HAND_TRACKING = 'handTracking'
class-attribute
instance-attribute
IDLE_DETECTION = 'idleDetection'
class-attribute
instance-attribute
KEYBOARD_LOCK = 'keyboardLock'
class-attribute
instance-attribute
LOCAL_FONTS = 'localFonts'
class-attribute
instance-attribute
LOCAL_NETWORK = 'localNetwork'
class-attribute
instance-attribute
LOCAL_NETWORK_ACCESS = 'localNetworkAccess'
class-attribute
instance-attribute
LOOPBACK_NETWORK = 'loopbackNetwork'
class-attribute
instance-attribute
MIDI = 'midi'
class-attribute
instance-attribute
MIDI_SYSEX = 'midiSysex'
class-attribute
instance-attribute
NFC = 'nfc'
class-attribute
instance-attribute
NOTIFICATIONS = 'notifications'
class-attribute
instance-attribute
PAYMENT_HANDLER = 'paymentHandler'
class-attribute
instance-attribute
PERIODIC_BACKGROUND_SYNC = 'periodicBackgroundSync'
class-attribute
instance-attribute
POINTER_LOCK = 'pointerLock'
class-attribute
instance-attribute
PROTECTED_MEDIA_IDENTIFIER = 'protectedMediaIdentifier'
class-attribute
instance-attribute
SENSORS = 'sensors'
class-attribute
instance-attribute
SMART_CARD = 'smartCard'
class-attribute
instance-attribute
SPEAKER_SELECTION = 'speakerSelection'
class-attribute
instance-attribute
STORAGE_ACCESS = 'storageAccess'
class-attribute
instance-attribute
TOP_LEVEL_STORAGE_ACCESS = 'topLevelStorageAccess'
class-attribute
instance-attribute
VIDEO_CAPTURE = 'videoCapture'
class-attribute
instance-attribute
VR = 'vr'
class-attribute
instance-attribute
WAKE_LOCK_SCREEN = 'wakeLockScreen'
class-attribute
instance-attribute
WAKE_LOCK_SYSTEM = 'wakeLockSystem'
class-attribute
instance-attribute
WEB_APP_INSTALLATION = 'webAppInstallation'
class-attribute
instance-attribute
WEB_PRINTING = 'webPrinting'
class-attribute
instance-attribute
WINDOW_MANAGEMENT = 'windowManagement'
class-attribute
instance-attribute
from_json(json)
classmethod
PrivacySandboxAPI
Bases: Enum
Source code in zendriver/cdp/browser.py
BIDDING_AND_AUCTION_SERVICES = 'BiddingAndAuctionServices'
class-attribute
instance-attribute
TRUSTED_KEY_VALUE = 'TrustedKeyValue'
class-attribute
instance-attribute
from_json(json)
classmethod
WindowID
Bases: int
Source code in zendriver/cdp/browser.py
__repr__()
from_json(json)
classmethod
WindowState
Bases: Enum
The state of the browser window.
Source code in zendriver/cdp/browser.py
FULLSCREEN = 'fullscreen'
class-attribute
instance-attribute
MAXIMIZED = 'maximized'
class-attribute
instance-attribute
MINIMIZED = 'minimized'
class-attribute
instance-attribute
NORMAL = 'normal'
class-attribute
instance-attribute
from_json(json)
classmethod
add_privacy_sandbox_coordinator_key_config(api, coordinator_origin, key_config, browser_context_id=None)
Configures encryption keys used with a given privacy sandbox API to talk to a trusted coordinator. Since this is intended for test automation only, coordinatorOrigin must be a .test domain. No existing coordinator configuration for the origin may exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api
|
PrivacySandboxAPI
|
|
required |
coordinator_origin
|
str
|
|
required |
key_config
|
str
|
|
required |
browser_context_id
|
Optional[BrowserContextID]
|
(Optional) BrowserContext to perform the action in. When omitted, default browser context is used. |
None
|
Source code in zendriver/cdp/browser.py
add_privacy_sandbox_enrollment_override(url)
Allows a site to use privacy sandbox features that require enrollment without the site actually being enrolled. Only supported on page targets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
|
required |
Source code in zendriver/cdp/browser.py
cancel_download(guid, browser_context_id=None)
Cancel a download if in progress
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
guid
|
str
|
Global unique identifier of the download. |
required |
browser_context_id
|
Optional[BrowserContextID]
|
(Optional) BrowserContext to perform the action in. When omitted, default browser context is used. |
None
|
Source code in zendriver/cdp/browser.py
close()
crash()
Crashes browser on the main thread.
EXPERIMENTAL
crash_gpu_process()
Crashes GPU process.
EXPERIMENTAL
execute_browser_command(command_id)
Invoke custom browser commands used by telemetry.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command_id
|
BrowserCommandId
|
|
required |
Source code in zendriver/cdp/browser.py
get_browser_command_line()
Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.
EXPERIMENTAL
Returns:
| Type | Description |
|---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[str]]
|
Commandline parameters |
Source code in zendriver/cdp/browser.py
get_histogram(name, delta=None)
Get a Chrome histogram by name.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Requested histogram name. |
required |
delta
|
Optional[bool]
|
(Optional) If true, retrieve delta since last delta call. |
None
|
Returns:
| Type | Description |
|---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Histogram]
|
Histogram. |
Source code in zendriver/cdp/browser.py
get_histograms(query=None, delta=None)
Get Chrome histograms.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Optional[str]
|
(Optional) Requested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms. |
None
|
delta
|
Optional[bool]
|
(Optional) If true, retrieve delta since last delta call. |
None
|
Returns:
| Type | Description |
|---|---|
Generator[T_JSON_DICT, T_JSON_DICT, List[Histogram]]
|
Histograms. |
Source code in zendriver/cdp/browser.py
get_version()
Returns version information.
Returns:
| Type | Description |
|---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[str, str, str, str, str]]
|
A tuple with the following items: 0. protocolVersion - Protocol version. 1. product - Product name. 2. revision - Product revision. 3. userAgent - User-Agent. 4. jsVersion - V8 version. |
Source code in zendriver/cdp/browser.py
get_window_bounds(window_id)
Get position and size of the browser window.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window_id
|
WindowID
|
Browser window id. |
required |
Returns:
| Type | Description |
|---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Bounds]
|
Bounds information of the window. When window state is 'minimized', the restored window position and size are returned. |
Source code in zendriver/cdp/browser.py
get_window_for_target(target_id=None)
Get the browser window that contains the devtools target.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_id
|
Optional[TargetID]
|
(Optional) Devtools agent host id. If called as a part of the session, associated targetId is used. |
None
|
Returns:
| Type | Description |
|---|---|
Generator[T_JSON_DICT, T_JSON_DICT, Tuple[WindowID, Bounds]]
|
A tuple with the following items: 0. windowId - Browser window id. 1. bounds - Bounds information of the window. When window state is 'minimized', the restored window position and size are returned. |
Source code in zendriver/cdp/browser.py
grant_permissions(permissions, origin=None, browser_context_id=None)
Grant specific permissions to the given origin and reject all others. Deprecated. Use setPermission instead.
.. deprecated:: 1.3
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
permissions
|
List[PermissionType]
|
|
required |
origin
|
Optional[str]
|
(Optional) Origin the permission applies to, all origins if not specified. |
None
|
browser_context_id
|
Optional[BrowserContextID]
|
(Optional) BrowserContext to override permissions. When omitted, default browser context is used. |
None
|
Source code in zendriver/cdp/browser.py
reset_permissions(browser_context_id=None)
Reset all permission management for all origins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
browser_context_id
|
Optional[BrowserContextID]
|
(Optional) BrowserContext to reset permissions. When omitted, default browser context is used. |
None
|
Source code in zendriver/cdp/browser.py
set_contents_size(window_id, width=None, height=None)
Set size of the browser contents resizing browser window as necessary.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window_id
|
WindowID
|
Browser window id. |
required |
width
|
Optional[int]
|
(Optional) The window contents width in DIP. Assumes current width if omitted. Must be specified if 'height' is omitted. |
None
|
height
|
Optional[int]
|
(Optional) The window contents height in DIP. Assumes current height if omitted. Must be specified if 'width' is omitted. |
None
|
Source code in zendriver/cdp/browser.py
set_dock_tile(badge_label=None, image=None)
Set dock tile details, platform-specific.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
badge_label
|
Optional[str]
|
(Optional) |
None
|
image
|
Optional[str]
|
(Optional) Png encoded image. (Encoded as a base64 string when passed over JSON) |
None
|
Source code in zendriver/cdp/browser.py
set_download_behavior(behavior, browser_context_id=None, download_path=None, events_enabled=None)
Set the behavior when downloading a file.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
behavior
|
str
|
Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). |
required |
browser_context_id
|
Optional[BrowserContextID]
|
(Optional) BrowserContext to set download behavior. When omitted, default browser context is used. |
None
|
download_path
|
Optional[str]
|
(Optional) The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'. |
None
|
events_enabled
|
Optional[bool]
|
(Optional) Whether to emit download events (defaults to false). |
None
|
Source code in zendriver/cdp/browser.py
set_permission(permission, setting, origin=None, embedded_origin=None, browser_context_id=None)
Set permission settings for given embedding and embedded origins.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
permission
|
PermissionDescriptor
|
Descriptor of permission to override. |
required |
setting
|
PermissionSetting
|
Setting of the permission. |
required |
origin
|
Optional[str]
|
(Optional) Embedding origin the permission applies to, all origins if not specified. |
None
|
embedded_origin
|
Optional[str]
|
(Optional) Embedded origin the permission applies to. It is ignored unless the embedding origin is present and valid. If the embedding origin is provided but the embedded origin isn't, the embedding origin is used as the embedded origin. |
None
|
browser_context_id
|
Optional[BrowserContextID]
|
(Optional) Context to override. When omitted, default browser context is used. |
None
|
Source code in zendriver/cdp/browser.py
set_window_bounds(window_id, bounds)
Set position and/or size of the browser window.
EXPERIMENTAL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window_id
|
WindowID
|
Browser window id. |
required |
bounds
|
Bounds
|
New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged. |
required |