Package Torello.Browser
Class Page
- java.lang.Object
-
- Torello.Browser.Page
-
public class Page extends java.lang.Object
Class created byAutomatic Code-Generator
.
This class was built using the Chrome Remote Dev-Tools A.P.I., which is specified by two JSON-RPC Files. These files were obtained from the Chrome Dev Tools Protocol Git Hub Page, which has a "Tip of Tree" (the latest) API-Specification Page Here: JSON-RPC Protocol Specification.
JSON-Viewable Google-API:
These files may be viewed here: browser_protocol.json and js_protocol.json.
These files were converted into this Java-Browser (CDT) Library; they are a Java-Alternative to the Node.js implementation.
HTML-Viewable API:
In addition to this Class-Library, these files were also converted to a simple HTML Page, which may be browsed here: Browser API Web-PageNode.js
RDP-API Implementation:
You may read about theNode.js Chrome Remote Interface
on the Node.js Package Manager Web-Site: NPM
Actions and events related to the inspected page belong to the page domain.This class is intended to be used with a Headless Browser
These methods have been tested, to some degree, using Google Chrome. In order to use this class you must start a web-browser instance and make a connection to the browser using aRemote Debugging Port
. The initializations may be accomplished using classBRDPC
(Browser Remote Debug Protocol Connection).
Google-Chrome was used during the development process of the classes in this particular package. Note that, lately, it has been asserted Microsoft has switched to using the Chrome-Engine for its Microsoft Edge Browser Internal Code-Base. Therefore, there may limited support / functionality when running the methods in this class with Microsoft-Edge. There is the possibility these will work with Opera & Safari.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223
.
Foreign Function API:
Every one of the methods that reside in this class are designed to do nothing more than:- Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
- Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket RDP Connection
- Receive BOTH that Method's Results AND any Browser Event-Firings from the Web-Socket
- Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
- Report these Method-Results and Browser-Events to the User via an User-Registered Event-Listener or a Promise Object
Java-HTML Difference:
Unlike the bulk of the Java HTML JAR Library, there is very little native Java-Code, and very little testing that may be done on any of the classes & methods in this package. The code inside these classes does nothing more than marshall-and-unmarshall Java-Types into Json-Requests (and vice-versa). The Java-Script & Browser modules inside of a Google-Chrome instance are, theoretically, handling these requests, and returning their results (or events) over the Web-Socket Connection.
It has been asserted (by Google Chrome Developers) that some of these methods are only "partially working" or "experimental".
Hi-Lited Source-Code:- View Here: Torello/Browser/Page.java
- Open New Browser-Tab: Torello/Browser/Page.java
File Size: 305,312 Bytes Line Count: 7,615 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctional
Annotation may also be called 'The Spaghetti Report'.Static-Functional
classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@Stateless
Annotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 57 Method(s), 57 declared static
- 23 Field(s), 23 declared static, 22 declared final
- Fields excused from final modifier (with explanation):
Field 'counter' is not final. Reason: CONFIGURATION
-
-
Nested Class Summary
Type Classes: Page Domain Types Modifier and Type Inner-Class static class
Page.AdFrameStatus
Indicates whether a frame has been identified as an ad and why.static class
Page.AppManifestError
Error while paring app manifest.static class
Page.AppManifestParsedProperties
Parsed app manifest properties.static class
Page.BackForwardCacheNotRestoredExplanation
[No Description Provided by Google]
EXPERIMENTALstatic class
Page.CompilationCacheParams
Per-script compilation cache parameters forPage.produceCompilationCache
EXPERIMENTALstatic class
Page.FontFamilies
Generic font families collection.static class
Page.FontSizes
Default font sizes.static class
Page.Frame
Information about the Frame on the page.static class
Page.FrameResource
Information about the Resource on the page.static class
Page.FrameResourceTree
Information about the Frame hierarchy along with their cached resources.static class
Page.FrameTree
Information about the Frame hierarchy.static class
Page.InstallabilityError
The installability error
EXPERIMENTALstatic class
Page.InstallabilityErrorArgument
[No Description Provided by Google]
EXPERIMENTALstatic class
Page.LayoutViewport
Layout viewport position and dimensions.static class
Page.NavigationEntry
Navigation history entry.static class
Page.OriginTrial
[No Description Provided by Google]
EXPERIMENTALstatic class
Page.OriginTrialToken
[No Description Provided by Google]
EXPERIMENTALstatic class
Page.OriginTrialTokenWithStatus
[No Description Provided by Google]
EXPERIMENTALstatic class
Page.PermissionsPolicyBlockLocator
[No Description Provided by Google]
EXPERIMENTALstatic class
Page.PermissionsPolicyFeatureState
[No Description Provided by Google]
EXPERIMENTALstatic class
Page.ScreencastFrameMetadata
Screencast frame metadata.static class
Page.Viewport
Viewport for capturing screenshot.static class
Page.VisualViewport
Visual viewport position, dimensions, and scale.Event Classes: Page Domain Events Modifier and Type Inner-Class static class
Page.backForwardCacheNotUsed
Fired for failed bfcache history navigations if BackForwardCache feature is enabled.static class
Page.compilationCacheProduced
Issued for every compilation cache generated.static class
Page.documentOpened
Fired when opening document to write to.static class
Page.domContentEventFired
[No Description Provided by Google]
static class
Page.downloadProgress
Fired when download makes progress.static class
Page.downloadWillBegin
Fired when page is about to start a download.static class
Page.fileChooserOpened
Emitted only whenpage.interceptFileChooser
is enabled.static class
Page.frameAttached
Fired when frame has been attached to its parent.static class
Page.frameClearedScheduledNavigation
Fired when frame no longer has a scheduled navigation.static class
Page.frameDetached
Fired when frame has been detached from its parent.static class
Page.frameNavigated
Fired once navigation of the frame has completed.static class
Page.frameRequestedNavigation
Fired when a renderer-initiated navigation is requested.static class
Page.frameResized
EXPERIMENTAL
This is Marker-Event.static class
Page.frameScheduledNavigation
Fired when frame schedules a potential navigation.static class
Page.frameStartedLoading
Fired when frame has started loading.static class
Page.frameStoppedLoading
Fired when frame has stopped loading.static class
Page.interstitialHidden
Fired when interstitial page was hidden
This is Marker-Event.static class
Page.interstitialShown
Fired when interstitial page was shown
This is Marker-Event.static class
Page.javascriptDialogClosed
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.static class
Page.javascriptDialogOpening
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.static class
Page.lifecycleEvent
Fired for top level page lifecycle events such as navigation, load, paint, etc.static class
Page.loadEventFired
[No Description Provided by Google]
static class
Page.navigatedWithinDocument
Fired when same-document navigation happens, e.g.static class
Page.screencastFrame
Compressed image data requested by thestartScreencast
.static class
Page.screencastVisibilityChanged
Fired when the page with currently enabled screencast was shown or hidden.static class
Page.windowOpen
Fired when a new window is going to be opened, via window.open(), link click, form submission, etc.
-
Field Summary
Page Domain Enumerated String Types Modifier and Type Field static String[]
AdFrameExplanation
[No Description Provided by Google]
EXPERIMENTALstatic String[]
AdFrameType
Indicates whether a frame has been identified as an ad.static String[]
BackForwardCacheNotRestoredReason
List of not restored reasons for back-forward cache.static String[]
BackForwardCacheNotRestoredReasonType
Types of not restored reasons for back-forward cache.static String[]
ClientNavigationDisposition
[No Description Provided by Google]
EXPERIMENTALstatic String[]
ClientNavigationReason
[No Description Provided by Google]
EXPERIMENTALstatic String[]
CrossOriginIsolatedContextType
Indicates whether the frame is cross-origin isolated and why it is the case.static String[]
DialogType
Javascript dialog type.static String[]
GatedAPIFeatures
[No Description Provided by Google]
EXPERIMENTALstatic String[]
NavigationType
The type of a frameNavigated event.static String[]
OriginTrialStatus
Status for an Origin Trial.static String[]
OriginTrialTokenStatus
Origin Trial(https://www.chromium.org/blink/origin-trials) support.static String[]
OriginTrialUsageRestriction
[No Description Provided by Google]
EXPERIMENTALstatic String[]
PermissionsPolicyBlockReason
Reason for a permissions policy feature to be disabled.static String[]
PermissionsPolicyFeature
All Permissions Policy features.static String[]
ReferrerPolicy
The referring-policy used for the navigation.static String[]
SecureContextType
Indicates whether the frame is a secure context and why it is the case.static String[]
TransitionType
Transition type.
-
Method Summary
Page Domain Commands Script Returns Modifier and Type Method NONE ( void
)static Script<>
addCompilationCache(String url, String data)
Seeds compilation cache for given url.String
static Script<>
addScriptToEvaluateOnLoad(String scriptSource)
Deprecated, please use addScriptToEvaluateOnNewDocument instead.String
static Script<>
addScriptToEvaluateOnNewDocument(String source, String worldName, Boolean includeCommandLineAPI)
Evaluates given script in every frame upon creation (before loading frame's scripts).NONE ( void
)static Script<>
bringToFront()
Brings page to front (activates tab).String
static Script<>
captureScreenshot(String format, Integer quality, Page.Viewport clip, Boolean fromSurface, Boolean captureBeyondViewport)
Capture page screenshot.String
static Script<>
captureSnapshot(String format)
Returns a snapshot of the page as a string.NONE ( void
)static Script<>
clearCompilationCache()
Clears seeded compilation cache.NONE ( void
)static Script<>
clearDeviceMetricsOverride()
Clears the overridden device metrics.NONE ( void
)static Script<>
clearDeviceOrientationOverride()
Clears the overridden Device Orientation.NONE ( void
)static Script<>
clearGeolocationOverride()
Clears the overridden Geolocation Position and Error.NONE ( void
)static Script<>
close()
Tries to close page, running its beforeunload hooks, if any.NONE ( void
)static Script<>
crash()
Crashes renderer on the IO thread, generates minidumps.Integer
static Script<>
createIsolatedWorld(String frameId, String worldName, Boolean grantUniveralAccess)
Creates an isolated world for the given frame.NONE ( void
)static Script<>
deleteCookie(String cookieName, String url)
Deletes browser cookie with given name, domain and path.NONE ( void
)static Script<>
disable()
Disables page domain notifications.NONE ( void
)static Script<>
enable()
Enables page domain notifications.NONE ( void
)static Script<>
generateTestReport(String message, String group)
Generates a report for testing.Ret2<String,
String>static Script<>
getAppId()
Returns the unique (PWA) app id.Ret4<String,
Page.AppManifestError[],
String,
Page.AppManifestParsedProperties>static Script<>
getAppManifest()
[No Description Provided by Google]
Network.Cookie[]
static Script<>
getCookies()
Returns all browser cookies.Page.FrameTree
static Script<>
getFrameTree()
Returns present frame tree structure.Page.InstallabilityError[]
static Script<>
getInstallabilityErrors()
[No Description Provided by Google]
EXPERIMENTALRet6<Page.LayoutViewport,
Page.VisualViewport,
DOM.Rect,
Page.LayoutViewport,
Page.VisualViewport,
DOM.Rect>static Script<>
getLayoutMetrics()
Returns metrics relating to the layouting of the page, such as viewport bounds/scale.String
static Script<>
getManifestIcons()
[No Description Provided by Google]
EXPERIMENTALRet2<Integer,
Page.NavigationEntry[]>static Script<>
getNavigationHistory()
Returns navigation history for the current page.Page.OriginTrial[]
static Script<>
getOriginTrials(String frameId)
Get Origin Trials on given frame.Page.PermissionsPolicyFeatureState[]
static Script<>
getPermissionsPolicyState(String frameId)
Get Permissions Policy state on given frame.Ret2<String,
Boolean>static Script<>
getResourceContent(String frameId, String url)
Returns content of the given resource.Page.FrameResourceTree
static Script<>
getResourceTree()
Returns present frame / resource tree structure.NONE ( void
)static Script<>
handleJavaScriptDialog(boolean accept, String promptText)
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).Ret3<String,
String,
String>static Script<>
navigate(String url, String referrer, String transitionType, String frameId, String referrerPolicy)
Navigates current page to the given URL.NONE ( void
)static Script<>
navigateToHistoryEntry(int entryId)
Navigates current page to the given history entry.Ret2<String,
String>static Script<>
printToPDF(Boolean landscape, Boolean displayHeaderFooter, Boolean printBackground, Number scale, Number paperWidth, Number paperHeight, Number marginTop, Number marginBottom, Number marginLeft, Number marginRight, String pageRanges, Boolean ignoreInvalidPageRanges, String headerTemplate, String footerTemplate, Boolean preferCSSPageSize, String transferMode)
Print page as PDF.NONE ( void
)static Script<>
produceCompilationCache(Page.CompilationCacheParams[] scripts)
Requests backend to produce compilation cache for the specified scripts.NONE ( void
)static Script<>
reload(Boolean ignoreCache, String scriptToEvaluateOnLoad)
Reloads given page optionally ignoring the cache.NONE ( void
)static Script<>
removeScriptToEvaluateOnLoad(String identifier)
Deprecated, please use removeScriptToEvaluateOnNewDocument instead.NONE ( void
)static Script<>
removeScriptToEvaluateOnNewDocument(String identifier)
Removes given script from the list.NONE ( void
)static Script<>
resetNavigationHistory()
Resets navigation history for the current page.NONE ( void
)static Script<>
screencastFrameAck(int sessionId)
Acknowledges that a screencast frame has been received by the frontend.Debugger.SearchMatch[]
static Script<>
searchInResource(String frameId, String url, String query, Boolean caseSensitive, Boolean isRegex)
Searches for given string in resource content.NONE ( void
)static Script<>
setAdBlockingEnabled(boolean enabled)
Enable Chrome's experimental ad filter on all sites.NONE ( void
)static Script<>
setBypassCSP(boolean enabled)
Enable page Content Security Policy by-passing.NONE ( void
)static Script<>
setDeviceMetricsOverride(int width, int height, Number deviceScaleFactor, boolean mobile, Number scale, Integer screenWidth, Integer screenHeight, Integer positionX, Integer positionY, Boolean dontSetVisibleSize, Emulation.ScreenOrientation screenOrientation, Page.Viewport viewport)
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).NONE ( void
)static Script<>
setDeviceOrientationOverride(Number alpha, Number beta, Number gamma)
Overrides the Device Orientation.NONE ( void
)static Script<>
setDocumentContent(String frameId, String html)
Sets given markup as the document's HTML.NONE ( void
)static Script<>
setDownloadBehavior(String behavior, String downloadPath)
Set the behavior when downloading a file.NONE ( void
)static Script<>
setFontFamilies(Page.FontFamilies fontFamilies)
Set generic font families.NONE ( void
)static Script<>
setFontSizes(Page.FontSizes fontSizes)
Set default font sizes.NONE ( void
)static Script<>
setGeolocationOverride(Number latitude, Number longitude, Number accuracy)
Overrides the Geolocation Position or Error.NONE ( void
)static Script<>
setInterceptFileChooserDialog(boolean enabled)
Intercept file chooser requests and transfer control to protocol clients.NONE ( void
)static Script<>
setLifecycleEventsEnabled(boolean enabled)
Controls whether page will emit lifecycle events.NONE ( void
)static Script<>
setTouchEmulationEnabled(boolean enabled, String configuration)
Toggles mouse event-based touch event emulation.NONE ( void
)static Script<>
setWebLifecycleState(String state)
Tries to update the web lifecycle state of the page.NONE ( void
)static Script<>
startScreencast(String format, Integer quality, Integer maxWidth, Integer maxHeight, Integer everyNthFrame)
Starts sending each frame using thescreencastFrame
event.NONE ( void
)static Script<>
stopLoading()
Force the page stop all navigations and pending resource fetches.NONE ( void
)static Script<>
stopScreencast()
Stops sending each frame in thescreencastFrame
.NONE ( void
)static Script<>
waitForDebugger()
Pauses page execution.
-
-
-
Field Detail
-
AdFrameType
public static final java.lang.String[] AdFrameType
Indicates whether a frame has been identified as an ad.
EXPERIMENTAL
-
AdFrameExplanation
public static final java.lang.String[] AdFrameExplanation
[No Description Provided by Google]
EXPERIMENTAL
-
SecureContextType
public static final java.lang.String[] SecureContextType
Indicates whether the frame is a secure context and why it is the case.
EXPERIMENTAL
-
CrossOriginIsolatedContextType
public static final java.lang.String[] CrossOriginIsolatedContextType
Indicates whether the frame is cross-origin isolated and why it is the case.
EXPERIMENTAL
-
GatedAPIFeatures
public static final java.lang.String[] GatedAPIFeatures
[No Description Provided by Google]
EXPERIMENTAL
-
PermissionsPolicyFeature
public static final java.lang.String[] PermissionsPolicyFeature
All Permissions Policy features. This enum should match the one defined in third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5.
EXPERIMENTAL
-
PermissionsPolicyBlockReason
public static final java.lang.String[] PermissionsPolicyBlockReason
Reason for a permissions policy feature to be disabled.
EXPERIMENTAL
-
OriginTrialTokenStatus
public static final java.lang.String[] OriginTrialTokenStatus
Origin Trial(https://www.chromium.org/blink/origin-trials) support. Status for an Origin Trial token.
EXPERIMENTAL
-
OriginTrialStatus
public static final java.lang.String[] OriginTrialStatus
Status for an Origin Trial.
EXPERIMENTAL
-
OriginTrialUsageRestriction
public static final java.lang.String[] OriginTrialUsageRestriction
[No Description Provided by Google]
EXPERIMENTAL
-
TransitionType
public static final java.lang.String[] TransitionType
Transition type.
-
DialogType
public static final java.lang.String[] DialogType
Javascript dialog type.
-
ClientNavigationReason
public static final java.lang.String[] ClientNavigationReason
[No Description Provided by Google]
EXPERIMENTAL
-
ClientNavigationDisposition
public static final java.lang.String[] ClientNavigationDisposition
[No Description Provided by Google]
EXPERIMENTAL
-
ReferrerPolicy
public static final java.lang.String[] ReferrerPolicy
The referring-policy used for the navigation.
EXPERIMENTAL
-
NavigationType
public static final java.lang.String[] NavigationType
The type of a frameNavigated event.
EXPERIMENTAL
-
BackForwardCacheNotRestoredReason
public static final java.lang.String[] BackForwardCacheNotRestoredReason
List of not restored reasons for back-forward cache.
EXPERIMENTAL
-
BackForwardCacheNotRestoredReasonType
public static final java.lang.String[] BackForwardCacheNotRestoredReasonType
Types of not restored reasons for back-forward cache.
EXPERIMENTAL
-
-
Method Detail
-
addScriptToEvaluateOnLoad
public static Script<java.lang.String,JsonObject,java.lang.String> addScriptToEvaluateOnLoad (java.lang.String scriptSource)
Deprecated, please use addScriptToEvaluateOnNewDocument instead.
EXPERIMENTAL
DEPRECATED- Parameters:
scriptSource
- -- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (identifier
)
Identifier of the added script.
-
addScriptToEvaluateOnNewDocument
public static Script<java.lang.String,JsonObject,java.lang.String> addScriptToEvaluateOnNewDocument (java.lang.String source, java.lang.String worldName, java.lang.Boolean includeCommandLineAPI)
Evaluates given script in every frame upon creation (before loading frame's scripts).- Parameters:
source
- -worldName
- 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.
OPTIONAL
EXPERIMENTALincludeCommandLineAPI
- Specifies whether command line API should be available to the script, defaults to false.
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (identifier
)
Identifier of the added script.
-
bringToFront
public static Script<java.lang.String,JsonObject,Ret0> bringToFront()
Brings page to front (activates tab).- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
captureScreenshot
public static Script<java.lang.String,JsonObject,java.lang.String> captureScreenshot (java.lang.String format, java.lang.Integer quality, Page.Viewport clip, java.lang.Boolean fromSurface, java.lang.Boolean captureBeyondViewport)
Capture page screenshot.- Parameters:
format
- Image compression format (defaults to png).
Acceptable Values: ["jpeg", "png", "webp"]
OPTIONALquality
- Compression quality from range [0..100] (jpeg only).
OPTIONALclip
- Capture the screenshot of a given region only.
OPTIONALfromSurface
- Capture the screenshot from the surface, rather than the view. Defaults to true.
OPTIONAL
EXPERIMENTALcaptureBeyondViewport
- Capture the screenshot beyond the viewport. Defaults to false.
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (data
)
Base64-encoded image data. (Encoded as a base64 string when passed over JSON)
-
captureSnapshot
public static Script<java.lang.String,JsonObject,java.lang.String> captureSnapshot (java.lang.String format)
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- Parameters:
format
- Format (defaults to mhtml).
Acceptable Values: ["mhtml"]
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (data
)
Serialized page data.
-
clearDeviceMetricsOverride
public static Script<java.lang.String,JsonObject,Ret0> clearDeviceMetricsOverride ()
Clears the overridden device metrics.
EXPERIMENTAL
DEPRECATED- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
clearDeviceOrientationOverride
public static Script<java.lang.String,JsonObject,Ret0> clearDeviceOrientationOverride ()
Clears the overridden Device Orientation.
EXPERIMENTAL
DEPRECATED- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
clearGeolocationOverride
public static Script<java.lang.String,JsonObject,Ret0> clearGeolocationOverride ()
Clears the overridden Geolocation Position and Error.
DEPRECATED- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
createIsolatedWorld
public static Script<java.lang.String,JsonObject,java.lang.Integer> createIsolatedWorld (java.lang.String frameId, java.lang.String worldName, java.lang.Boolean grantUniveralAccess)
Creates an isolated world for the given frame.- Parameters:
frameId
- Id of the frame in which the isolated world should be created.worldName
- An optional name which is reported in the Execution Context.
OPTIONALgrantUniveralAccess
- Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
, Integer>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, Integer>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsInteger (executionContextId
)
Execution context of the isolated world.
-
deleteCookie
public static Script<java.lang.String,JsonObject,Ret0> deleteCookie (java.lang.String cookieName, java.lang.String url)
Deletes browser cookie with given name, domain and path.
EXPERIMENTAL
DEPRECATED- Parameters:
cookieName
- Name of the cookie to remove.url
- URL to match cooke domain and path.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
disable
public static Script<java.lang.String,JsonObject,Ret0> disable()
Disables page domain notifications.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
enable
public static Script<java.lang.String,JsonObject,Ret0> enable()
Enables page domain notifications.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
getAppManifest
public static Script<java.lang.String,JsonObject,Ret4<java.lang.String,Page.AppManifestError[],java.lang.String,Page.AppManifestParsedProperties>> getAppManifest ()
[No Description Provided by Google]
- Returns:
- An instance of
Script
<String,JsonObject
,Ret4
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet4
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet4
Ret4.a: String (url)
Manifest location.Ret4.b:
Page.AppManifestError
[] (errors)
-Ret4.c: String (data)
Manifest content.Ret4.d:
Page.AppManifestParsedProperties
(parsed)
Parsed manifest properties
-
getInstallabilityErrors
public static Script<java.lang.String,JsonObject,Page.InstallabilityError[]> getInstallabilityErrors ()
[No Description Provided by Google]
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Page.InstallabilityError
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Page.InstallabilityError
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Page.InstallabilityError
[] (installabilityErrors
-
-
getManifestIcons
public static Script<java.lang.String,JsonObject,java.lang.String> getManifestIcons ()
[No Description Provided by Google]
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (primaryIcon
)
-
-
getAppId
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,java.lang.String>> getAppId ()
Returns the unique (PWA) app id. Only returns values if the feature flag 'WebAppEnableManifestId' is enabled
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (appId)
App id, either from manifest's id attribute or computed from start_urlRet2.b: String (recommendedId)
Recommendation for manifest's id attribute to match current id computed from start_url
-
getCookies
public static Script<java.lang.String,JsonObject,Network.Cookie[]> getCookies ()
Returns all browser cookies. Depending on the backend support, will return detailed cookie information in thecookies
field.
EXPERIMENTAL
DEPRECATED- Returns:
- An instance of
Script
<String,JsonObject
,Network.Cookie
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Network.Cookie
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Network.Cookie
[] (cookies
Array of cookie objects.
-
getFrameTree
public static Script<java.lang.String,JsonObject,Page.FrameTree> getFrameTree ()
Returns present frame tree structure.- Returns:
- An instance of
Script
<String,JsonObject
,Page.FrameTree
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Page.FrameTree
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Page.FrameTree
(frameTree
Present frame tree structure.
-
getLayoutMetrics
public static Script<java.lang.String,JsonObject,Ret6<Page.LayoutViewport,Page.VisualViewport,DOM.Rect,Page.LayoutViewport,Page.VisualViewport,DOM.Rect>> getLayoutMetrics ()
Returns metrics relating to the layouting of the page, such as viewport bounds/scale.- Returns:
- An instance of
Script
<String,JsonObject
,Ret6
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet6
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet6
Ret6.a1:
Page.LayoutViewport
(layoutViewport)
Deprecated metrics relating to the layout viewport. Can be in DP or in CSS pixels depending on theenable-use-zoom-for-dsf
flag. UsecssLayoutViewport
instead.Ret6.b2:
Page.VisualViewport
(visualViewport)
Deprecated metrics relating to the visual viewport. Can be in DP or in CSS pixels depending on theenable-use-zoom-for-dsf
flag. UsecssVisualViewport
instead.Ret6.c3:
DOM.Rect
(contentSize)
Deprecated size of scrollable area. Can be in DP or in CSS pixels depending on theenable-use-zoom-for-dsf
flag. UsecssContentSize
instead.Ret6.d4:
Page.LayoutViewport
(cssLayoutViewport)
Metrics relating to the layout viewport in CSS pixels.Ret6.e5:
Page.VisualViewport
(cssVisualViewport)
Metrics relating to the visual viewport in CSS pixels.Ret6.f6:
DOM.Rect
(cssContentSize)
Size of scrollable area in CSS pixels.
-
getNavigationHistory
public static Script<java.lang.String,JsonObject,Ret2<java.lang.Integer,Page.NavigationEntry[]>> getNavigationHistory ()
Returns navigation history for the current page.- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: Integer (currentIndex)
Index of the current navigation history entry.Ret2.b:
Page.NavigationEntry
[] (entries)
Array of navigation history entries.
-
resetNavigationHistory
public static Script<java.lang.String,JsonObject,Ret0> resetNavigationHistory ()
Resets navigation history for the current page.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
getResourceContent
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,java.lang.Boolean>> getResourceContent (java.lang.String frameId, java.lang.String url)
Returns content of the given resource.
EXPERIMENTAL- Parameters:
frameId
- Frame id to get resource for.url
- URL of the resource to get content for.- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (content)
Resource content.Ret2.b: Boolean (base64Encoded)
True, if content was served as base64.
-
getResourceTree
public static Script<java.lang.String,JsonObject,Page.FrameResourceTree> getResourceTree ()
Returns present frame / resource tree structure.
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Page.FrameResourceTree
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Page.FrameResourceTree
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Page.FrameResourceTree
(frameTree
Present frame / resource tree structure.
-
handleJavaScriptDialog
public static Script<java.lang.String,JsonObject,Ret0> handleJavaScriptDialog (boolean accept, java.lang.String promptText)
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).- Parameters:
accept
- Whether to accept or dismiss the dialog.promptText
- The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
navigate
public static Script<java.lang.String,JsonObject,Ret3<java.lang.String,java.lang.String,java.lang.String>> navigate (java.lang.String url, java.lang.String referrer, java.lang.String transitionType, java.lang.String frameId, java.lang.String referrerPolicy)
Navigates current page to the given URL.- Parameters:
url
- URL to navigate the page to.referrer
- Referrer URL.
OPTIONALtransitionType
- Intended transition type.
OPTIONALframeId
- Frame id to navigate, if not specified navigates the top frame.
OPTIONALreferrerPolicy
- Referrer-policy used for the navigation.
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret3
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet3
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet3
Ret3.a: String (frameId)
Frame id that has navigated (or failed to navigate)Ret3.b: String (loaderId)
Loader identifier.Ret3.c: String (errorText)
User friendly error message, present if and only if navigation has failed.
-
navigateToHistoryEntry
public static Script<java.lang.String,JsonObject,Ret0> navigateToHistoryEntry (int entryId)
Navigates current page to the given history entry.- Parameters:
entryId
- Unique id of the entry to navigate to.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
printToPDF
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,java.lang.String>> printToPDF (java.lang.Boolean landscape, java.lang.Boolean displayHeaderFooter, java.lang.Boolean printBackground, java.lang.Number scale, java.lang.Number paperWidth, java.lang.Number paperHeight, java.lang.Number marginTop, java.lang.Number marginBottom, java.lang.Number marginLeft, java.lang.Number marginRight, java.lang.String pageRanges, java.lang.Boolean ignoreInvalidPageRanges, java.lang.String headerTemplate, java.lang.String footerTemplate, java.lang.Boolean preferCSSPageSize, java.lang.String transferMode)
Print page as PDF.- Parameters:
landscape
- Paper orientation. Defaults to false.
OPTIONALdisplayHeaderFooter
- Display header and footer. Defaults to false.
OPTIONALprintBackground
- Print background graphics. Defaults to false.
OPTIONALscale
- Scale of the webpage rendering. Defaults to 1.
OPTIONALpaperWidth
- Paper width in inches. Defaults to 8.5 inches.
OPTIONALpaperHeight
- Paper height in inches. Defaults to 11 inches.
OPTIONALmarginTop
- Top margin in inches. Defaults to 1cm (~0.4 inches).
OPTIONALmarginBottom
- Bottom margin in inches. Defaults to 1cm (~0.4 inches).
OPTIONALmarginLeft
- Left margin in inches. Defaults to 1cm (~0.4 inches).
OPTIONALmarginRight
- Right margin in inches. Defaults to 1cm (~0.4 inches).
OPTIONALpageRanges
- Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
OPTIONALignoreInvalidPageRanges
- Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.
OPTIONALheaderTemplate
- 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,would generate span containing the title.
OPTIONALfooterTemplate
- HTML template for the print footer. Should use the same format as theheaderTemplate
.
OPTIONALpreferCSSPageSize
- 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.
OPTIONALtransferMode
- return as stream
Acceptable Values: ["ReturnAsBase64", "ReturnAsStream"]
OPTIONAL
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a: String (data)
Base64-encoded pdf data. Empty if |returnAsStream| is specified. (Encoded as a base64 string when passed over JSON)Ret2.b: String (stream)
A handle of the stream that holds resulting PDF data.
-
reload
public static Script<java.lang.String,JsonObject,Ret0> reload (java.lang.Boolean ignoreCache, java.lang.String scriptToEvaluateOnLoad)
Reloads given page optionally ignoring the cache.- Parameters:
ignoreCache
- If true, browser cache is ignored (as if the user pressed Shift+refresh).
OPTIONALscriptToEvaluateOnLoad
- If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
removeScriptToEvaluateOnLoad
public static Script<java.lang.String,JsonObject,Ret0> removeScriptToEvaluateOnLoad (java.lang.String identifier)
Deprecated, please use removeScriptToEvaluateOnNewDocument instead.
EXPERIMENTAL
DEPRECATED- Parameters:
identifier
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
removeScriptToEvaluateOnNewDocument
public static Script<java.lang.String,JsonObject,Ret0> removeScriptToEvaluateOnNewDocument (java.lang.String identifier)
Removes given script from the list.- Parameters:
identifier
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
screencastFrameAck
public static Script<java.lang.String,JsonObject,Ret0> screencastFrameAck (int sessionId)
Acknowledges that a screencast frame has been received by the frontend.
EXPERIMENTAL- Parameters:
sessionId
- Frame number.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
searchInResource
public static Script<java.lang.String,JsonObject,Debugger.SearchMatch[]> searchInResource (java.lang.String frameId, java.lang.String url, java.lang.String query, java.lang.Boolean caseSensitive, java.lang.Boolean isRegex)
Searches for given string in resource content.
EXPERIMENTAL- Parameters:
frameId
- Frame id for resource to search in.url
- URL of the resource to search in.query
- String to search for.caseSensitive
- If true, search is case sensitive.
OPTIONALisRegex
- If true, treats string parameter as regex.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Debugger.SearchMatch
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Debugger.SearchMatch
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Debugger.SearchMatch
[] (result
List of search matches.
-
setAdBlockingEnabled
public static Script<java.lang.String,JsonObject,Ret0> setAdBlockingEnabled (boolean enabled)
Enable Chrome's experimental ad filter on all sites.
EXPERIMENTAL- Parameters:
enabled
- Whether to block ads.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setBypassCSP
public static Script<java.lang.String,JsonObject,Ret0> setBypassCSP (boolean enabled)
Enable page Content Security Policy by-passing.
EXPERIMENTAL- Parameters:
enabled
- Whether to bypass page CSP.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
getPermissionsPolicyState
public static Script<java.lang.String,JsonObject,Page.PermissionsPolicyFeatureState[]> getPermissionsPolicyState (java.lang.String frameId)
Get Permissions Policy state on given frame.
EXPERIMENTAL- Parameters:
frameId
- -- Returns:
- An instance of
Script
<String,JsonObject
,Page.PermissionsPolicyFeatureState
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Page.PermissionsPolicyFeatureState
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Page.PermissionsPolicyFeatureState
[] (states
-
-
getOriginTrials
public static Script<java.lang.String,JsonObject,Page.OriginTrial[]> getOriginTrials (java.lang.String frameId)
Get Origin Trials on given frame.
EXPERIMENTAL- Parameters:
frameId
- -- Returns:
- An instance of
Script
<String,JsonObject
,Page.OriginTrial
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.Page.OriginTrial
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)Page.OriginTrial
[] (originTrials
-
-
setDeviceMetricsOverride
public static Script<java.lang.String,JsonObject,Ret0> setDeviceMetricsOverride (int width, int height, java.lang.Number deviceScaleFactor, boolean mobile, java.lang.Number scale, java.lang.Integer screenWidth, java.lang.Integer screenHeight, java.lang.Integer positionX, java.lang.Integer positionY, java.lang.Boolean dontSetVisibleSize, Emulation.ScreenOrientation screenOrientation, Page.Viewport viewport)
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).
EXPERIMENTAL
DEPRECATED- Parameters:
width
- Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.height
- Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.deviceScaleFactor
- Overriding device scale factor value. 0 disables the override.mobile
- Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.scale
- Scale to apply to resulting view image.
OPTIONALscreenWidth
- Overriding screen width value in pixels (minimum 0, maximum 10000000).
OPTIONALscreenHeight
- Overriding screen height value in pixels (minimum 0, maximum 10000000).
OPTIONALpositionX
- Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
OPTIONALpositionY
- Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
OPTIONALdontSetVisibleSize
- Do not set visible view size, rely upon explicit setVisibleSize call.
OPTIONALscreenOrientation
- Screen orientation override.
OPTIONALviewport
- The viewport dimensions and scale. If not set, the override is cleared.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setDeviceOrientationOverride
public static Script<java.lang.String,JsonObject,Ret0> setDeviceOrientationOverride (java.lang.Number alpha, java.lang.Number beta, java.lang.Number gamma)
Overrides the Device Orientation.
EXPERIMENTAL
DEPRECATED- Parameters:
alpha
- Mock alphabeta
- Mock betagamma
- Mock gamma- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setFontFamilies
public static Script<java.lang.String,JsonObject,Ret0> setFontFamilies (Page.FontFamilies fontFamilies)
Set generic font families.
EXPERIMENTAL- Parameters:
fontFamilies
- Specifies font families to set. If a font family is not specified, it won't be changed.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setFontSizes
public static Script<java.lang.String,JsonObject,Ret0> setFontSizes (Page.FontSizes fontSizes)
Set default font sizes.
EXPERIMENTAL- Parameters:
fontSizes
- Specifies font sizes to set. If a font size is not specified, it won't be changed.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setDocumentContent
public static Script<java.lang.String,JsonObject,Ret0> setDocumentContent (java.lang.String frameId, java.lang.String html)
Sets given markup as the document's HTML.- Parameters:
frameId
- Frame id to set HTML for.html
- HTML content to set.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setDownloadBehavior
public static Script<java.lang.String,JsonObject,Ret0> setDownloadBehavior (java.lang.String behavior, java.lang.String downloadPath)
Set the behavior when downloading a file.
EXPERIMENTAL
DEPRECATED- Parameters:
behavior
- Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
Acceptable Values: ["deny", "allow", "default"]downloadPath
- The default path to save downloaded files to. This is required if behavior is set to 'allow'
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setGeolocationOverride
public static Script<java.lang.String,JsonObject,Ret0> setGeolocationOverride (java.lang.Number latitude, java.lang.Number longitude, java.lang.Number accuracy)
Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
DEPRECATED- Parameters:
latitude
- Mock latitude
OPTIONALlongitude
- Mock longitude
OPTIONALaccuracy
- Mock accuracy
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setLifecycleEventsEnabled
public static Script<java.lang.String,JsonObject,Ret0> setLifecycleEventsEnabled (boolean enabled)
Controls whether page will emit lifecycle events.
EXPERIMENTAL- Parameters:
enabled
- If true, starts emitting lifecycle events.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setTouchEmulationEnabled
public static Script<java.lang.String,JsonObject,Ret0> setTouchEmulationEnabled (boolean enabled, java.lang.String configuration)
Toggles mouse event-based touch event emulation.
EXPERIMENTAL
DEPRECATED- Parameters:
enabled
- Whether the touch event emulation should be enabled.configuration
- Touch/gesture events configuration. Default: current platform.
Acceptable Values: ["mobile", "desktop"]
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
startScreencast
public static Script<java.lang.String,JsonObject,Ret0> startScreencast (java.lang.String format, java.lang.Integer quality, java.lang.Integer maxWidth, java.lang.Integer maxHeight, java.lang.Integer everyNthFrame)
Starts sending each frame using thescreencastFrame
event.
EXPERIMENTAL- Parameters:
format
- Image compression format.
Acceptable Values: ["jpeg", "png"]
OPTIONALquality
- Compression quality from range [0..100].
OPTIONALmaxWidth
- Maximum screenshot width.
OPTIONALmaxHeight
- Maximum screenshot height.
OPTIONALeveryNthFrame
- Send every n-th frame.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
stopLoading
public static Script<java.lang.String,JsonObject,Ret0> stopLoading()
Force the page stop all navigations and pending resource fetches.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
crash
public static Script<java.lang.String,JsonObject,Ret0> crash()
Crashes renderer on the IO thread, generates minidumps.
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
close
public static Script<java.lang.String,JsonObject,Ret0> close()
Tries to close page, running its beforeunload hooks, if any.
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setWebLifecycleState
public static Script<java.lang.String,JsonObject,Ret0> setWebLifecycleState (java.lang.String state)
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- Parameters:
state
- Target lifecycle state
Acceptable Values: ["frozen", "active"]- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
stopScreencast
public static Script<java.lang.String,JsonObject,Ret0> stopScreencast()
Stops sending each frame in thescreencastFrame
.
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
produceCompilationCache
public static Script<java.lang.String,JsonObject,Ret0> produceCompilationCache (Page.CompilationCacheParams[] scripts)
Requests backend to produce compilation cache for the specified scripts.scripts
are appeneded 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- Parameters:
scripts
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
addCompilationCache
public static Script<java.lang.String,JsonObject,Ret0> addCompilationCache (java.lang.String url, java.lang.String data)
Seeds compilation cache for given url. Compilation cache does not survive cross-process navigation.
EXPERIMENTAL- Parameters:
url
- -data
- Base64-encoded data (Encoded as a base64 string when passed over JSON)- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
clearCompilationCache
public static Script<java.lang.String,JsonObject,Ret0> clearCompilationCache ()
Clears seeded compilation cache.
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
generateTestReport
public static Script<java.lang.String,JsonObject,Ret0> generateTestReport (java.lang.String message, java.lang.String group)
Generates a report for testing.
EXPERIMENTAL- Parameters:
message
- Message to be displayed in the report.group
- Specifies the endpoint group to deliver the report to.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
waitForDebugger
public static Script<java.lang.String,JsonObject,Ret0> waitForDebugger()
Pauses page execution. Can be resumed using generic RunTime.runIfWaitingForDebugger.
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setInterceptFileChooserDialog
public static Script<java.lang.String,JsonObject,Ret0> setInterceptFileChooserDialog (boolean enabled)
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 eventPage.fileChooserOpened
is emitted.
EXPERIMENTAL- Parameters:
enabled
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
-