Package Torello.Browser
Class Emulation
- java.lang.Object
-
- Torello.Browser.Emulation
-
public class Emulation 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
This domain emulates different environments for the page.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/Emulation.java
- Open New Browser-Tab: Torello/Browser/Emulation.java
File Size: 76,511 Bytes Line Count: 1,851 '\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
- 27 Method(s), 27 declared static
- 7 Field(s), 7 declared static, 6 declared final
- Fields excused from final modifier (with explanation):
Field 'counter' is not final. Reason: CONFIGURATION
-
-
Nested Class Summary
Type Classes: Emulation Domain Types Modifier and Type Inner-Class static class
Emulation.DisplayFeature
[No Description Provided by Google]
static class
Emulation.MediaFeature
[No Description Provided by Google]
static class
Emulation.ScreenOrientation
Screen orientation.static class
Emulation.UserAgentBrandVersion
Used to specify User Agent Cient Hints to emulate.static class
Emulation.UserAgentMetadata
Used to specify User Agent Cient Hints to emulate.Event Classes: Emulation Domain Events Modifier and Type Inner-Class static class
Emulation.virtualTimeBudgetExpired
Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
-
Field Summary
Emulation Domain Enumerated String Types Modifier and Type Field static String[]
DisabledImageType
Enum of image types that can be disabled.static String[]
VirtualTimePolicy
advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending resource fetches.
-
Method Summary
Emulation Domain Commands Script Returns Modifier and Type Method Boolean
static Script<>
canEmulate()
Tells whether emulation is supported.NONE ( void
)static Script<>
clearDeviceMetricsOverride()
Clears the overridden device metrics.NONE ( void
)static Script<>
clearGeolocationOverride()
Clears the overridden Geolocation Position and Error.NONE ( void
)static Script<>
clearIdleOverride()
Clears Idle state overrides.NONE ( void
)static Script<>
resetPageScaleFactor()
Requests that page scale factor is reset to initial values.NONE ( void
)static Script<>
setAutoDarkModeOverride(Boolean enabled)
Automatically render all web contents using a dark theme.NONE ( void
)static Script<>
setCPUThrottlingRate(Number rate)
Enables CPU throttling to emulate slow CPUs.NONE ( void
)static Script<>
setDefaultBackgroundColorOverride(DOM.RGBA color)
Sets or clears an override of the default background color of the frame.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, Emulation.DisplayFeature displayFeature)
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<>
setDisabledImageTypes(String[] imageTypes)
[No Description Provided by Google]
EXPERIMENTALNONE ( void
)static Script<>
setDocumentCookieDisabled(boolean disabled)
[No Description Provided by Google]
EXPERIMENTALNONE ( void
)static Script<>
setEmitTouchEventsForMouse(boolean enabled, String configuration)
[No Description Provided by Google]
EXPERIMENTALNONE ( void
)static Script<>
setEmulatedMedia(String media, Emulation.MediaFeature[] features)
Emulates the given media type or media feature for CSS media queries.NONE ( void
)static Script<>
setEmulatedVisionDeficiency(String type)
Emulates the given vision deficiency.NONE ( void
)static Script<>
setFocusEmulationEnabled(boolean enabled)
Enables or disables simulating a focused and active page.NONE ( void
)static Script<>
setGeolocationOverride(Number latitude, Number longitude, Number accuracy)
Overrides the Geolocation Position or Error.NONE ( void
)static Script<>
setIdleOverride(boolean isUserActive, boolean isScreenUnlocked)
Overrides the Idle state.NONE ( void
)static Script<>
setLocaleOverride(String locale)
Overrides default host system locale with the specified one.NONE ( void
)static Script<>
setNavigatorOverrides(String platform)
Overrides value returned by the javascript navigator object.NONE ( void
)static Script<>
setPageScaleFactor(Number pageScaleFactor)
Sets a specified page scale factor.NONE ( void
)static Script<>
setScriptExecutionDisabled(boolean value)
Switches script execution in the page.NONE ( void
)static Script<>
setScrollbarsHidden(boolean hidden)
[No Description Provided by Google]
EXPERIMENTALNONE ( void
)static Script<>
setTimezoneOverride(String timezoneId)
Overrides default host system timezone with the specified one.NONE ( void
)static Script<>
setTouchEmulationEnabled(boolean enabled, Integer maxTouchPoints)
Enables touch on platforms which do not support them.NONE ( void
)static Script<>
setUserAgentOverride(String userAgent, String acceptLanguage, String platform, Emulation.UserAgentMetadata userAgentMetadata)
Allows overriding user agent with the given string.Number
static Script<>
setVirtualTimePolicy(String policy, Number budget, Integer maxVirtualTimeTaskStarvationCount, Boolean waitForNavigation, Number initialVirtualTime)
Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy.NONE ( void
)static Script<>
setVisibleSize(int width, int height)
Resizes the frame/viewport of the page.
-
-
-
Field Detail
-
VirtualTimePolicy
public static final java.lang.String[] VirtualTimePolicy
advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending resource fetches.
EXPERIMENTAL
-
DisabledImageType
public static final java.lang.String[] DisabledImageType
Enum of image types that can be disabled.
EXPERIMENTAL
-
-
Method Detail
-
canEmulate
public static Script<java.lang.String,JsonObject,java.lang.Boolean> canEmulate ()
Tells whether emulation is supported.- Returns:
- An instance of
Script
<String,JsonObject
, Boolean>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, Boolean>
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 returnsBoolean (result
)
True if emulation is supported.
-
clearDeviceMetricsOverride
public static Script<java.lang.String,JsonObject,Ret0> clearDeviceMetricsOverride ()
Clears the overridden device metrics.- 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.- 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.
-
resetPageScaleFactor
public static Script<java.lang.String,JsonObject,Ret0> resetPageScaleFactor ()
Requests that page scale factor is reset to initial values.
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.
-
setFocusEmulationEnabled
public static Script<java.lang.String,JsonObject,Ret0> setFocusEmulationEnabled (boolean enabled)
Enables or disables simulating a focused and active page.
EXPERIMENTAL- Parameters:
enabled
- Whether to enable to disable focus emulation.- 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.
-
setAutoDarkModeOverride
public static Script<java.lang.String,JsonObject,Ret0> setAutoDarkModeOverride (java.lang.Boolean enabled)
Automatically render all web contents using a dark theme.
EXPERIMENTAL- Parameters:
enabled
- Whether to enable or disable automatic dark mode. If not specified, any existing override will be 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.
-
setCPUThrottlingRate
public static Script<java.lang.String,JsonObject,Ret0> setCPUThrottlingRate (java.lang.Number rate)
Enables CPU throttling to emulate slow CPUs.
EXPERIMENTAL- Parameters:
rate
- Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).- 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.
-
setDefaultBackgroundColorOverride
public static Script<java.lang.String,JsonObject,Ret0> setDefaultBackgroundColorOverride (DOM.RGBA color)
Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.- Parameters:
color
- RGBA of the default background color. If not specified, any existing override will be 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.
-
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, Emulation.DisplayFeature displayFeature)
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).- 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.
OPTIONAL
EXPERIMENTALscreenWidth
- Overriding screen width value in pixels (minimum 0, maximum 10000000).
OPTIONAL
EXPERIMENTALscreenHeight
- Overriding screen height value in pixels (minimum 0, maximum 10000000).
OPTIONAL
EXPERIMENTALpositionX
- Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
OPTIONAL
EXPERIMENTALpositionY
- Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
OPTIONAL
EXPERIMENTALdontSetVisibleSize
- Do not set visible view size, rely upon explicit setVisibleSize call.
OPTIONAL
EXPERIMENTALscreenOrientation
- Screen orientation override.
OPTIONALviewport
- If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
OPTIONAL
EXPERIMENTALdisplayFeature
- If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off.
OPTIONAL
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.
-
setScrollbarsHidden
public static Script<java.lang.String,JsonObject,Ret0> setScrollbarsHidden (boolean hidden)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
hidden
- Whether scrollbars should be always hidden.- 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.
-
setDocumentCookieDisabled
public static Script<java.lang.String,JsonObject,Ret0> setDocumentCookieDisabled (boolean disabled)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
disabled
- Whether document.coookie API should be disabled.- 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.
-
setEmitTouchEventsForMouse
public static Script<java.lang.String,JsonObject,Ret0> setEmitTouchEventsForMouse (boolean enabled, java.lang.String configuration)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
enabled
- Whether touch emulation based on mouse input 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.
-
setEmulatedMedia
public static Script<java.lang.String,JsonObject,Ret0> setEmulatedMedia (java.lang.String media, Emulation.MediaFeature[] features)
Emulates the given media type or media feature for CSS media queries.- Parameters:
media
- Media type to emulate. Empty string disables the override.
OPTIONALfeatures
- Media features to emulate.
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.
-
setEmulatedVisionDeficiency
public static Script<java.lang.String,JsonObject,Ret0> setEmulatedVisionDeficiency (java.lang.String type)
Emulates the given vision deficiency.
EXPERIMENTAL- Parameters:
type
- Vision deficiency to emulate.
Acceptable Values: ["none", "achromatopsia", "blurredVision", "deuteranopia", "protanopia", "tritanopia"]- 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.- 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.
-
setIdleOverride
public static Script<java.lang.String,JsonObject,Ret0> setIdleOverride (boolean isUserActive, boolean isScreenUnlocked)
Overrides the Idle state.
EXPERIMENTAL- Parameters:
isUserActive
- Mock isUserActiveisScreenUnlocked
- Mock isScreenUnlocked- 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.
-
clearIdleOverride
public static Script<java.lang.String,JsonObject,Ret0> clearIdleOverride ()
Clears Idle state overrides.
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.
-
setNavigatorOverrides
public static Script<java.lang.String,JsonObject,Ret0> setNavigatorOverrides (java.lang.String platform)
Overrides value returned by the javascript navigator object.
EXPERIMENTAL
DEPRECATED- Parameters:
platform
- The platform navigator.platform should return.- 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.
-
setPageScaleFactor
public static Script<java.lang.String,JsonObject,Ret0> setPageScaleFactor (java.lang.Number pageScaleFactor)
Sets a specified page scale factor.
EXPERIMENTAL- Parameters:
pageScaleFactor
- Page scale factor.- 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.
-
setScriptExecutionDisabled
public static Script<java.lang.String,JsonObject,Ret0> setScriptExecutionDisabled (boolean value)
Switches script execution in the page.- Parameters:
value
- Whether script execution should be disabled in the 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.
-
setTouchEmulationEnabled
public static Script<java.lang.String,JsonObject,Ret0> setTouchEmulationEnabled (boolean enabled, java.lang.Integer maxTouchPoints)
Enables touch on platforms which do not support them.- Parameters:
enabled
- Whether the touch event emulation should be enabled.maxTouchPoints
- Maximum touch points supported. Defaults to one.
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.
-
setVirtualTimePolicy
public static Script<java.lang.String,JsonObject,java.lang.Number> setVirtualTimePolicy (java.lang.String policy, java.lang.Number budget, java.lang.Integer maxVirtualTimeTaskStarvationCount, java.lang.Boolean waitForNavigation, java.lang.Number initialVirtualTime)
Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy. Note this supersedes any previous time budget.
EXPERIMENTAL- Parameters:
policy
- -budget
- If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
OPTIONALmaxVirtualTimeTaskStarvationCount
- If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
OPTIONALwaitForNavigation
- If set the virtual time policy change should be deferred until any frame starts navigating. Note any previous deferred policy change is superseded.
OPTIONALinitialVirtualTime
- If set, base::Time::Now will be overridden to initially return this value.
OPTIONAL- Returns:
- An instance of
Script
<String,JsonObject
, Number>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, Number>
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 returnsNumber (virtualTimeTicksBase
)
Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
-
setLocaleOverride
public static Script<java.lang.String,JsonObject,Ret0> setLocaleOverride (java.lang.String locale)
Overrides default host system locale with the specified one.
EXPERIMENTAL- Parameters:
locale
- ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
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.
-
setTimezoneOverride
public static Script<java.lang.String,JsonObject,Ret0> setTimezoneOverride (java.lang.String timezoneId)
Overrides default host system timezone with the specified one.
EXPERIMENTAL- Parameters:
timezoneId
- The timezone identifier. If empty, disables the override and restores default host system timezone.- 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.
-
setVisibleSize
public static Script<java.lang.String,JsonObject,Ret0> setVisibleSize (int width, int height)
Resizes the frame/viewport of the page. Note that this does not affect the frame's container (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported on Android.
EXPERIMENTAL
DEPRECATED- Parameters:
width
- Frame width (DIP).height
- Frame height (DIP).- 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.
-
setDisabledImageTypes
public static Script<java.lang.String,JsonObject,Ret0> setDisabledImageTypes (java.lang.String[] imageTypes)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
imageTypes
- Image types to disable.- 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.
-
setUserAgentOverride
public static Script<java.lang.String,JsonObject,Ret0> setUserAgentOverride (java.lang.String userAgent, java.lang.String acceptLanguage, java.lang.String platform, Emulation.UserAgentMetadata userAgentMetadata)
Allows overriding user agent with the given string.- Parameters:
userAgent
- User agent to use.acceptLanguage
- Browser langugage to emulate.
OPTIONALplatform
- The platform navigator.platform should return.
OPTIONALuserAgentMetadata
- To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
OPTIONAL
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.
-
-