Package io.webfolder.cdp.command
Interface BrowserAsync
public interface BrowserAsync
The Browser domain defines methods and events for browser managing.
-
Method Summary
Modifier and TypeMethodDescriptioncancelDownload
(String guid) Cancel a download if in progresscancelDownload
(String guid, String browserContextId) Cancel a download if in progressclose()
Close browser gracefully.crash()
Crashes browser on the main thread.Crashes GPU process.executeBrowserCommand
(BrowserCommandId commandId) Invoke custom browser commands used by telemetry.Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.getHistogram
(String name) Get a Chrome histogram by name.getHistogram
(String name, Boolean delta) Get a Chrome histogram by name.Get Chrome histograms.getHistograms
(String query, Boolean delta) Get Chrome histograms.Returns version information.getWindowBounds
(Integer windowId) Get position and size of the browser window.Get the browser window that contains the devtools target.getWindowForTarget
(String targetId) Get the browser window that contains the devtools target.grantPermissions
(PermissionType permissions) Grant specific permissions to the given origin and reject all others.grantPermissions
(PermissionType permissions, String origin, String browserContextId) Grant specific permissions to the given origin and reject all others.Reset all permission management for all origins.resetPermissions
(String browserContextId) Reset all permission management for all origins.Set dock tile details, platform-specific.setDockTile
(String badgeLabel, String image) Set dock tile details, platform-specific.setDownloadBehavior
(DownloadBehavior behavior) Set the behavior when downloading a file.setDownloadBehavior
(DownloadBehavior behavior, String browserContextId, String downloadPath, Boolean eventsEnabled) Set the behavior when downloading a file.setPermission
(PermissionDescriptor permission, PermissionSetting setting) Set permission settings for given origin.setPermission
(PermissionDescriptor permission, PermissionSetting setting, String origin, String browserContextId) Set permission settings for given origin.setWindowBounds
(Integer windowId, Bounds bounds) Set position and/or size of the browser window.
-
Method Details
-
cancelDownload
Cancel a download if in progress- Parameters:
guid
- Global unique identifier of the download.
-
cancelDownload
Cancel a download if in progress- Parameters:
guid
- Global unique identifier of the download.browserContextId
- BrowserContext to perform the action in. When omitted, default browser context is used.
-
close
CompletableFuture<Void> close()Close browser gracefully. -
crash
CompletableFuture<Void> crash()Crashes browser on the main thread. -
crashGpuProcess
CompletableFuture<Void> crashGpuProcess()Crashes GPU process. -
executeBrowserCommand
Invoke custom browser commands used by telemetry. -
getBrowserCommandLine
CompletableFuture<List<String>> getBrowserCommandLine()Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.- Returns:
- Commandline parameters
-
getHistogram
Get a Chrome histogram by name.- Parameters:
name
- Requested histogram name.- Returns:
- Histogram.
-
getHistogram
Get a Chrome histogram by name.- Parameters:
name
- Requested histogram name.delta
- If true, retrieve delta since last call.- Returns:
- Histogram.
-
getHistograms
CompletableFuture<List<Histogram>> getHistograms()Get Chrome histograms.- Returns:
- Histograms.
-
getHistograms
Get Chrome histograms.- Parameters:
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.- Returns:
- Histograms.
-
getVersion
CompletableFuture<GetVersionResult> getVersion()Returns version information.- Returns:
- GetVersionResult
-
getWindowBounds
Get position and size of the browser window.- Parameters:
windowId
- Browser window id.- Returns:
- Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
-
getWindowForTarget
CompletableFuture<GetWindowForTargetResult> getWindowForTarget()Get the browser window that contains the devtools target.- Returns:
- GetWindowForTargetResult
-
getWindowForTarget
Get the browser window that contains the devtools target.- Parameters:
targetId
- Devtools agent host id. If called as a part of the session, associated targetId is used.- Returns:
- GetWindowForTargetResult
-
grantPermissions
Grant specific permissions to the given origin and reject all others. -
grantPermissions
CompletableFuture<Void> grantPermissions(PermissionType permissions, String origin, String browserContextId) Grant specific permissions to the given origin and reject all others.- Parameters:
origin
- Origin the permission applies to, all origins if not specified.browserContextId
- BrowserContext to override permissions. When omitted, default browser context is used.
-
resetPermissions
CompletableFuture<Void> resetPermissions()Reset all permission management for all origins. -
resetPermissions
Reset all permission management for all origins.- Parameters:
browserContextId
- BrowserContext to reset permissions. When omitted, default browser context is used.
-
setDockTile
CompletableFuture<Void> setDockTile()Set dock tile details, platform-specific. -
setDockTile
Set dock tile details, platform-specific.- Parameters:
image
- Png encoded image. (Encoded as a base64 string when passed over JSON)
-
setDownloadBehavior
Set the behavior when downloading a file.- Parameters:
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.
-
setDownloadBehavior
CompletableFuture<Void> setDownloadBehavior(DownloadBehavior behavior, String browserContextId, String downloadPath, Boolean eventsEnabled) Set the behavior when downloading a file.- Parameters:
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).
-
setPermission
Set permission settings for given origin.- Parameters:
permission
- Descriptor of permission to override.setting
- Setting of the permission.
-
setPermission
CompletableFuture<Void> setPermission(PermissionDescriptor permission, PermissionSetting setting, String origin, String browserContextId) Set permission settings for given origin.- Parameters:
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.
-
setWindowBounds
Set position and/or size of the browser window.- Parameters:
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.
-