public interface Browser
| Modifier and Type | Method and Description |
|---|---|
void |
cancelDownload(String guid)
Cancel a download if in progress
|
void |
cancelDownload(String guid,
String browserContextId)
Cancel a download if in progress
|
void |
close()
Close browser gracefully.
|
void |
crash()
Crashes browser on the main thread.
|
void |
crashGpuProcess()
Crashes GPU process.
|
void |
executeBrowserCommand(BrowserCommandId commandId)
Invoke custom browser commands used by telemetry.
|
List<String> |
getBrowserCommandLine()
Returns the command line switches for the browser process if, and only if --enable-automation
is on the commandline.
|
Histogram |
getHistogram(String name)
Get a Chrome histogram by name.
|
Histogram |
getHistogram(String name,
Boolean delta)
Get a Chrome histogram by name.
|
List<Histogram> |
getHistograms()
Get Chrome histograms.
|
List<Histogram> |
getHistograms(String query,
Boolean delta)
Get Chrome histograms.
|
Version |
getVersion()
Returns version information.
|
Bounds |
getWindowBounds(Integer windowId)
Get position and size of the browser window.
|
WindowForTarget |
getWindowForTarget()
Get the browser window that contains the devtools target.
|
WindowForTarget |
getWindowForTarget(String targetId)
Get the browser window that contains the devtools target.
|
void |
grantPermissions(List<PermissionType> permissions)
Grant specific permissions to the given origin and reject all others.
|
void |
grantPermissions(List<PermissionType> permissions,
String origin,
String browserContextId)
Grant specific permissions to the given origin and reject all others.
|
EventListener |
onDownloadProgress(EventHandler<DownloadProgress> eventListener)
Fired when download makes progress.
|
EventListener |
onDownloadWillBegin(EventHandler<DownloadWillBegin> eventListener)
Fired when page is about to start a download.
|
void |
resetPermissions()
Reset all permission management for all origins.
|
void |
resetPermissions(String browserContextId)
Reset all permission management for all origins.
|
void |
setDockTile()
Set dock tile details, platform-specific.
|
void |
setDockTile(String badgeLabel,
String image)
Set dock tile details, platform-specific.
|
void |
setDownloadBehavior(SetDownloadBehaviorBehavior behavior)
Set the behavior when downloading a file.
|
void |
setDownloadBehavior(SetDownloadBehaviorBehavior behavior,
String browserContextId,
String downloadPath,
Boolean eventsEnabled)
Set the behavior when downloading a file.
|
void |
setPermission(PermissionDescriptor permission,
PermissionSetting setting)
Set permission settings for given origin.
|
void |
setPermission(PermissionDescriptor permission,
PermissionSetting setting,
String origin,
String browserContextId)
Set permission settings for given origin.
|
void |
setWindowBounds(Integer windowId,
Bounds bounds)
Set position and/or size of the browser window.
|
void setPermission(PermissionDescriptor permission, PermissionSetting setting)
permission - Descriptor of permission to override.setting - Setting of the permission.void setPermission(PermissionDescriptor permission, PermissionSetting setting, String origin, String browserContextId)
permission - Descriptor of permission to override.setting - Setting of the permission.origin - Origin the permission applies to, all origins if not specified.browserContextId - Context to override. When omitted, default browser context is used.void grantPermissions(List<PermissionType> permissions)
permissions - void grantPermissions(List<PermissionType> permissions, String origin, String browserContextId)
permissions - origin - Origin the permission applies to, all origins if not specified.browserContextId - BrowserContext to override permissions. When omitted, default browser
context is used.void resetPermissions()
void resetPermissions(String browserContextId)
browserContextId - BrowserContext to reset permissions. When omitted, default browser
context is used.void setDownloadBehavior(SetDownloadBehaviorBehavior behavior)
behavior - Whether to allow all or deny all download requests, or use default Chrome
behavior if available (otherwise deny). |allowAndName| allows download and names files
according to their dowmload guids.void setDownloadBehavior(SetDownloadBehaviorBehavior behavior, String browserContextId, String downloadPath, Boolean eventsEnabled)
behavior - Whether to allow all or deny all download requests, or use default Chrome
behavior if available (otherwise deny). |allowAndName| allows download and names files
according to their dowmload guids.browserContextId - BrowserContext to set download behavior. When omitted, default browser
context is used.downloadPath - The default path to save downloaded files to. This is required if behavior
is set to 'allow' or 'allowAndName'.eventsEnabled - Whether to emit download events (defaults to false).void cancelDownload(String guid)
guid - Global unique identifier of the download.void cancelDownload(String guid, String browserContextId)
guid - Global unique identifier of the download.browserContextId - BrowserContext to perform the action in. When omitted, default browser
context is used.void close()
void crash()
void crashGpuProcess()
Version getVersion()
List<String> getBrowserCommandLine()
List<Histogram> getHistograms(String query, Boolean delta)
query - 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.delta - If true, retrieve delta since last call.Histogram getHistogram(String name)
name - Requested histogram name.Histogram getHistogram(String name, Boolean delta)
name - Requested histogram name.delta - If true, retrieve delta since last call.Bounds getWindowBounds(Integer windowId)
windowId - Browser window id.WindowForTarget getWindowForTarget()
WindowForTarget getWindowForTarget(String targetId)
targetId - Devtools agent host id. If called as a part of the session, associated targetId
is used.void setWindowBounds(Integer windowId, Bounds bounds)
windowId - Browser window id.bounds - New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be
combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.void setDockTile()
void setDockTile(String badgeLabel, String image)
badgeLabel - image - Png encoded image. (Encoded as a base64 string when passed over JSON)void executeBrowserCommand(BrowserCommandId commandId)
commandId - EventListener onDownloadWillBegin(EventHandler<DownloadWillBegin> eventListener)
EventListener onDownloadProgress(EventHandler<DownloadProgress> eventListener)
Copyright © 2021 Kenan Klisura. All rights reserved.