Package Torello.Browser.JavaScriptAPI
Class RunTime
- java.lang.Object
-
- Torello.Browser.JavaScriptAPI.RunTime
-
public class RunTime extends java.lang.Object
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.
These files were converted into this Java-Browser (CDP) Library. The intention is to have them function in a similar fasion to the Node.js Tool known as 'Puppeteer', Microsoft's 'Playwright' and of course the Main-Stay 'Selenium.' The Java-HTML JAR Library merely implements the Java Types & Commands defined by Google's DevTools Protocol.
🧠 View the Google CDP API:
RunTime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.
The top-level description and explanation for this class (this comment, at the top this Java-Doc Page) is repeated, verbatim, across all of the domain classes which comprise Google's CDP API.This class is intended to be used with a Browser Instance
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. Google-Corporation is the developer of this API, but any browser which accepts a Remote Debug Port Connection over Web-Sockets.
Google-Chrome was used during the development process of the classes in this particular package. Lately, it has been asserted Microsoft has switched to using the Chrome Browser-Engine for its Microsoft Edge Internal Code-Base. Therefore, there may some functionality available when running the methods in this class with Microsoft-Edge.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223. See the examples available in packageTorello.Browserto undertand how to build aPageConnandBrowserConnWeb-Socket Connection, and how to build aWebSocketSenderinstance in order to execute the methods in this class.
Web-Socket & JSON 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 Connection
- Receive BOTH that Command-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 a User-Registered, Event-Listener (Events) or a Promise Object (Command Responses / Results)
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".
Asking Chat-GPT for Help:
The LLM otherwise known as "Chat-GPT" does, indeed, have an expert level of knowledge about the "Remote DevTools Protocol". The API that theChrome DevTools Protocl (CDP)exports is extremely well understood by the LLM, and generally I have found that Chat-GPT understands (by 2 or 3 orders of magnitude) better what my Auto-Generated JSON-Wrappers can do in controlling a Web-Browser than I could ever possibly hope to understand.
Though not available today, there will soon be an automatically downloadable Token-Stream (AI Embeddings) BUTTON available on my Java-Doc Pages that should hopefully make it extremely easy to post my code-base, RAG Style, to Chat-GPT and other LLM's when 'interogating' them. Presently, because my "Get Token Stream Button" does not exist yet on any of my pages, what you can do is copy-and-paste any Method-Signature from any one of these pages and then ask Chat-GPT to explain what that Browser or Java-Script Function is actually doing. It is very likely to give you some pretty neat answers.
I have found that every single one of the Domains, Types & Events which are offered by the CDP Protocol (though not documented very well by Google), are perfectly understood by the A.I. LLM - literally to the point where it does know (much better than I ever could) what my own code base actually does!
Try it out, it's a lot of fun. Note that this package and these classes were originally developed solely to be able to execute the Java-Script that a browser executes when visiting a Web-Site. Complete HTML-Page Content can be scraped (using the HTML Data-Scraping Tools in Java-HTML) off of Web-Sites that have dynamic / Java-Script Generated Content.
Conspicuous Boxed-Types Usage:
You may notice that there are many methods that have parameters which accept, for instance, anInteger, instead of a primitiveint. Just to remind the readiner, in Java Programs aBoxed Typeis a standard Java-Primitive which has been converted into an Object-Reference. The use of Boxed-Types in this code base is an easy-and-fast-way to allow for the concept of "Optional Parameters" or "Optional Field Value."
Whenever you see a method that accepts anInteger, the reason for this Parameter-Type choice is actually to allow a user to pass 'null' to it. This is a simple way to ELIDE passing any value at all to parameters which Google-Chrome would otherwise assert are "Optional." Whenever you pass 'null' to a Boxed-Types in this class, the Json-Processor will simply eliminate that Object-Property from the command altogether; and the browser will simply not receive any value for that parameter when that command is invoked.
The Java Language Specification does not have an easy or well defined means of accepting optional method parameters; so Boxed-Types and 'null' are utilized here. Note that 'null' may be passed to any Command Method-Parameter that is listed asOptionalon the Java-Doc Page description for that parameter.
Hi-Lited Source-Code:This File's Source Code:
- View Here: Torello/Browser/JavaScriptAPI/RunTime.java
- Open New Browser-Tab: Torello/Browser/JavaScriptAPI/RunTime.java
File Size: 128,353 Bytes Line Count: 3,118 '\n' Characters Found
Helper: Command Invocation Helpers
- View Here: RunTime$$Commands.java
- Open New Browser-Tab: RunTime$$Commands.java
File Size: 8,639 Bytes Line Count: 190 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctionalAnnotation may also be called 'The Spaghetti Report'.Static-Functionalclasses are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@StatelessAnnotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 27 Method(s), 27 declared static
- 8 Field(s), 8 declared static, 8 declared final
-
-
Nested Class Summary
Type Nested Classes: Types / Classes that Are Used & Exported by this Domain Modifier and Type Class Description static classRunTime.CallArgumentRepresents function call argument.static classRunTime.CallFrameStack entry for runtime errors and assertions.static classRunTime.CustomPreview[No Description Provided by Google]static classRunTime.DeepSerializedValueRepresents deep serialized value.static classRunTime.EntryPreview[No Description Provided by Google]static classRunTime.ExceptionDetailsDetailed information about exception (or error) that was thrown during script compilation or execution.static classRunTime.ExecutionContextDescriptionDescription of an isolated world.static classRunTime.InternalPropertyDescriptorObject internal property descriptor.static classRunTime.ObjectPreviewObject containing abbreviated remote object value.static classRunTime.PrivatePropertyDescriptorObject private field descriptor.static classRunTime.PropertyDescriptorObject property descriptor.static classRunTime.PropertyPreview[No Description Provided by Google]static classRunTime.RemoteObjectMirror object referencing original JavaScript object.static classRunTime.SerializationOptionsRepresents options for serialization.static classRunTime.StackTraceCall frames for assertions or error messages.static classRunTime.StackTraceIdIfdebuggerIdis set stack trace comes from another debugger and can be resolved there.Event Nested Classes: Browser Events, as Java Inner Classes, Which are Fired by this Domain Modifier and Type Class Description static classRunTime.bindingCalledNotification is issued every time when binding is called.static classRunTime.consoleAPICalledIssued when console API was called.static classRunTime.exceptionRevokedIssued when unhandled exception was revoked.static classRunTime.exceptionThrownIssued when exception was thrown and unhandled.static classRunTime.executionContextCreatedIssued when new execution context is created.static classRunTime.executionContextDestroyedIssued when execution context is destroyed.static classRunTime.inspectRequestedIssued when object should be inspected (for example, as a result of inspect() command line API call).Command-Returns Nested Classes: Domain-Commands with Multiple Return-Values, and a Dedicated Inner-Class Modifier and Type Class Description static classRunTime.awaitPromise$$RETAdd handler to promise with given promise object id.static classRunTime.callFunctionOn$$RETCalls function with given declaration on the given object.static classRunTime.compileScript$$RETCompiles expression.static classRunTime.evaluate$$RETEvaluates expression on global object.static classRunTime.getHeapUsage$$RETReturns the JavaScript heap usage.static classRunTime.getProperties$$RETReturns properties of a given object.static classRunTime.runScript$$RETRuns script with given id in a given context.
-
Field Summary
Eliminated Types: Removed CDP Types which Have Been Re-Mapped to Basic Java String Constants Modifier and Type Field Description static StringExecutionContextIdId of an execution context.static StringRemoteObjectIdUnique object identifier.static StringScriptIdUnique script identifier.static StringTimeDeltaNumber of milliseconds.static StringTimestampNumber of milliseconds since epoch.static StringUniqueDebuggerIdUnique identifier of current debugger.static StringUnserializableValuePrimitive value which cannot be JSON-stringified.Marker Events: Events without any Fields or Properties Modifier and Type Field Description static StringexecutionContextsClearedIssued when all executionContexts were cleared in browser
-
Method Summary
RunTime Domain Commands Script Returns Modifier and Type Method Voidstatic Script<>addBinding(String name, Integer executionContextId, String executionContextName)
If executionContextId is empty, adds binding with the given name on the global objects of all inspected contexts, including those created later, bindings survive reloads.RunTime.awaitPromise$$RETstatic Script<>awaitPromise(String promiseObjectId, Boolean returnByValue, Boolean generatePreview)
Add handler to promise with given promise object id.RunTime.callFunctionOn$$RETstatic Script<>callFunctionOn(String functionDeclaration, String objectId, RunTime.CallArgument[] arguments, Boolean silent, Boolean returnByValue, Boolean generatePreview, Boolean userGesture, Boolean awaitPromise, Integer executionContextId, String objectGroup, Boolean throwOnSideEffect, String uniqueContextId, RunTime.SerializationOptions serializationOptions)
Calls function with given declaration on the given object.RunTime.compileScript$$RETstatic Script<>compileScript(String expression, String sourceURL, boolean persistScript, Integer executionContextId)
Compiles expression.Voidstatic Script<>disable()
Disables reporting of execution contexts creation.Voidstatic Script<>discardConsoleEntries()
Discards collected exceptions and console API calls.Voidstatic Script<>enable()
Enables reporting of execution contexts creation by means ofexecutionContextCreatedevent.RunTime.evaluate$$RETstatic Script<>evaluate(String expression, String objectGroup, Boolean includeCommandLineAPI, Boolean silent, Integer contextId, Boolean returnByValue, Boolean generatePreview, Boolean userGesture, Boolean awaitPromise, Boolean throwOnSideEffect, Number timeout, Boolean disableBreaks, Boolean replMode, Boolean allowUnsafeEvalBlockedByCSP, String uniqueContextId, RunTime.SerializationOptions serializationOptions)
Evaluates expression on global object.RunTime.ExceptionDetailsstatic Script<>getExceptionDetails(String errorObjectId)
This method tries to lookup and populate exception details for a JavaScript Error object.RunTime.getHeapUsage$$RETstatic Script<>getHeapUsage()
Returns the JavaScript heap usage.Stringstatic Script<>getIsolateId()
Returns the isolate id.RunTime.getProperties$$RETstatic Script<>getProperties(String objectId, Boolean ownProperties, Boolean accessorPropertiesOnly, Boolean generatePreview, Boolean nonIndexedPropertiesOnly)
Returns properties of a given object.String[]static Script<>globalLexicalScopeNames(Integer executionContextId)
Returns all let, const and class variables from global scope.RunTime.RemoteObjectstatic Script<>queryObjects(String prototypeObjectId, String objectGroup)
[No Description Provided by Google]Voidstatic Script<>releaseObject(String objectId)
Releases remote object with given id.Voidstatic Script<>releaseObjectGroup(String objectGroup)
Releases all remote objects that belong to a given group.Voidstatic Script<>removeBinding(String name)
This method does not remove binding function from global object but unsubscribes current runtime agent from RunTime.bindingCalled notifications.Voidstatic Script<>runIfWaitingForDebugger()
Tells inspected instance to run if it was waiting for debugger to attach.RunTime.runScript$$RETstatic Script<>runScript(String scriptId, Integer executionContextId, String objectGroup, Boolean silent, Boolean includeCommandLineAPI, Boolean returnByValue, Boolean generatePreview, Boolean awaitPromise)
Runs script with given id in a given context.Voidstatic Script<>setAsyncCallStackDepth(int maxDepth)
Enables or disables async call stacks tracking.Voidstatic Script<>setCustomObjectFormatterEnabled(boolean enabled)
[No Description Provided by Google]Voidstatic Script<>setMaxCallStackSizeToCapture(int size)
[No Description Provided by Google]Voidstatic Script<>terminateExecution()
Terminate current or next JavaScript execution.RunTime Domain CommandBuilder Methods Modifier and Type Method Description static CommandBuilder
<RunTime.callFunctionOn$$RET>callFunctionOn()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<RunTime.evaluate$$RET>evaluate()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<RunTime.getProperties$$RET>getProperties()Creates a buider for conveniently assigning parameters to this method.static CommandBuilder
<RunTime.runScript$$RET>runScript()Creates a buider for conveniently assigning parameters to this method.
-
-
-
Field Detail
-
ExecutionContextId
public static final java.lang.String ExecutionContextId
Id of an execution context.
The TypeExecutionContextIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:int
Eliminated Type- See Also:
- Constant Field Values
-
RemoteObjectId
public static final java.lang.String RemoteObjectId
Unique object identifier.
The TypeRemoteObjectIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:String
Eliminated Type- See Also:
- Constant Field Values
-
ScriptId
public static final java.lang.String ScriptId
Unique script identifier.
The TypeScriptIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:String
Eliminated Type- See Also:
- Constant Field Values
-
TimeDelta
public static final java.lang.String TimeDelta
Number of milliseconds.
The TypeTimeDeltahas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:Number
Eliminated Type- See Also:
- Constant Field Values
-
Timestamp
public static final java.lang.String Timestamp
Number of milliseconds since epoch.
The TypeTimestamphas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:Number
Eliminated Type- See Also:
- Constant Field Values
-
UniqueDebuggerId
public static final java.lang.String UniqueDebuggerId
Unique identifier of current debugger.
EXPERIMENTAL
The TypeUniqueDebuggerIdhas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:String
Eliminated Type- See Also:
- Constant Field Values
-
UnserializableValue
public static final java.lang.String UnserializableValue
Primitive value which cannot be JSON-stringified. Includes values-0,NaN,Infinity,-Infinity, and bigint literals.
The TypeUnserializableValuehas been eliminated, because it is a direct mapping to a basic Java-Type; it has no additional fields, or other distinguishing properties. Instead, this CDP defined type has been relegated to a simpleStringConstant, for documentation & reference purposes only.
The code which is generated which employs this type replaces its use with the Standard Java-Type:String
Eliminated Type- See Also:
- Constant Field Values
-
executionContextsCleared
public static final java.lang.String executionContextsCleared
Issued when all executionContexts were cleared in browser
This is Marker-Event. Marker-Event's are events that do not possess any data or fields at all. When such events are fired by the browser, the Web-Socket sends nothing more than the name of the event in the packet. The Java-HTML CDP Implementation (this library) has not actually created a dedicated Java Event-Type for this Browser Event.
This specificstaticfield is actually just declared aString.executionContextsClearedhas not been 'reified' into an actual nested / inner class of its own, at all.
Eliminated Event Type- See Also:
- Constant Field Values
-
-
Method Detail
-
addBinding
public static Script<java.lang.Void> addBinding (java.lang.String name, java.lang.Integer executionContextId, java.lang.String executionContextName)
If executionContextId is empty, adds binding with the given name on the global objects of all inspected contexts, including those created later, bindings survive reloads. Binding function takes exactly one argument, this argument should be string, in case of any other input, function throws an exception. Each binding function call produces RunTime.bindingCalled notification.- Parameters:
name- -executionContextId- If specified, the binding would only be exposed to the specified execution context. If omitted andexecutionContextNameis not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive withexecutionContextName. Deprecated in favor ofexecutionContextNamedue to an unclear use case and bugs in implementation (crbug.com/1169639).executionContextIdwill be removed in the future.
OPTIONALEXPERIMENTALDEPRECATEDexecutionContextName- If specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See alsoExecutionContext.nameandworldNameparameter toPage.addScriptToEvaluateOnNewDocument. This parameter is mutually exclusive withexecutionContextId.
OPTIONAL- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
awaitPromise
public static Script<RunTime.awaitPromise$$RET> awaitPromise (java.lang.String promiseObjectId, java.lang.Boolean returnByValue, java.lang.Boolean generatePreview)
Add handler to promise with given promise object id.- Parameters:
promiseObjectId- Identifier of the promise.returnByValue- Whether the result is expected to be a JSON object that should be sent by value.
OPTIONALgeneratePreview- Whether preview should be generated for the result.
OPTIONAL- Returns:
- An instance of
Script<RunTime.awaitPromise$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.awaitPromise$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.awaitPromise$$RETA dedicated return type implies that the browser may return more than 1 datum
-
callFunctionOn
public static Script<RunTime.callFunctionOn$$RET> callFunctionOn (java.lang.String functionDeclaration, java.lang.String objectId, RunTime.CallArgument[] arguments, java.lang.Boolean silent, java.lang.Boolean returnByValue, java.lang.Boolean generatePreview, java.lang.Boolean userGesture, java.lang.Boolean awaitPromise, java.lang.Integer executionContextId, java.lang.String objectGroup, java.lang.Boolean throwOnSideEffect, java.lang.String uniqueContextId, RunTime.SerializationOptions serializationOptions)
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:callFunctionOn()- Parameters:
functionDeclaration- Declaration of the function to call.objectId- Identifier of the object to call function on. Either objectId or executionContextId should be specified.
OPTIONALarguments- Call arguments. All call arguments must belong to the same JavaScript world as the target object.
OPTIONALsilent- In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnExceptionstate.
OPTIONALreturnByValue- Whether the result is expected to be a JSON object which should be sent by value. Can be overriden byserializationOptions.
OPTIONALgeneratePreview- Whether preview should be generated for the result.
OPTIONALEXPERIMENTALuserGesture- Whether execution should be treated as initiated by user in the UI.
OPTIONALawaitPromise- Whether execution shouldawaitfor resulting value and return once awaited promise is resolved.
OPTIONALexecutionContextId- Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
OPTIONALobjectGroup- Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
OPTIONALthrowOnSideEffect- Whether to throw an exception if side effect cannot be ruled out during evaluation.
OPTIONALEXPERIMENTALuniqueContextId- An alternative way to specify the execution context to call function on. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental function call in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive withexecutionContextId.
OPTIONALEXPERIMENTALserializationOptions- Specifies the result serialization. If provided, overridesgeneratePreviewandreturnByValue.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<RunTime.callFunctionOn$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.callFunctionOn$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.callFunctionOn$$RETA dedicated return type implies that the browser may return more than 1 datum
-
compileScript
public static Script<RunTime.compileScript$$RET> compileScript (java.lang.String expression, java.lang.String sourceURL, boolean persistScript, java.lang.Integer executionContextId)
Compiles expression.- Parameters:
expression- Expression to compile.sourceURL- Source url to be set for the script.persistScript- Specifies whether the compiled script should be persisted.executionContextId- Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
OPTIONAL- Returns:
- An instance of
Script<RunTime.compileScript$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.compileScript$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.compileScript$$RETA dedicated return type implies that the browser may return more than 1 datum
-
disable
-
discardConsoleEntries
public static Script<java.lang.Void> discardConsoleEntries()
Discards collected exceptions and console API calls.
-
enable
-
evaluate
public static Script<RunTime.evaluate$$RET> evaluate (java.lang.String expression, java.lang.String objectGroup, java.lang.Boolean includeCommandLineAPI, java.lang.Boolean silent, java.lang.Integer contextId, java.lang.Boolean returnByValue, java.lang.Boolean generatePreview, java.lang.Boolean userGesture, java.lang.Boolean awaitPromise, java.lang.Boolean throwOnSideEffect, java.lang.Number timeout, java.lang.Boolean disableBreaks, java.lang.Boolean replMode, java.lang.Boolean allowUnsafeEvalBlockedByCSP, java.lang.String uniqueContextId, RunTime.SerializationOptions serializationOptions)
Evaluates expression on global object.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:evaluate()- Parameters:
expression- Expression to evaluate.objectGroup- Symbolic group name that can be used to release multiple objects.
OPTIONALincludeCommandLineAPI- Determines whether Command Line API should be available during the evaluation.
OPTIONALsilent- In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnExceptionstate.
OPTIONALcontextId- Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. This is mutually exclusive withuniqueContextId, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.
OPTIONALreturnByValue- Whether the result is expected to be a JSON object that should be sent by value.
OPTIONALgeneratePreview- Whether preview should be generated for the result.
OPTIONALEXPERIMENTALuserGesture- Whether execution should be treated as initiated by user in the UI.
OPTIONALawaitPromise- Whether execution shouldawaitfor resulting value and return once awaited promise is resolved.
OPTIONALthrowOnSideEffect- Whether to throw an exception if side effect cannot be ruled out during evaluation. This impliesdisableBreaksbelow.
OPTIONALEXPERIMENTALtimeout- Terminate execution after timing out (number of milliseconds).
OPTIONALEXPERIMENTALdisableBreaks- Disable breakpoints during execution.
OPTIONALEXPERIMENTALreplMode- Setting this flag to true enablesletre-declaration and top-levelawait. Note thatletvariables can only be re-declared if they originate fromreplModethemselves.
OPTIONALEXPERIMENTALallowUnsafeEvalBlockedByCSP- The Content Security Policy (CSP) for the target might block 'unsafe-eval' which includes eval(), Function(), setTimeout() and setInterval() when called with non-callable arguments. This flag bypasses CSP for this evaluation and allows unsafe-eval. Defaults to true.
OPTIONALEXPERIMENTALuniqueContextId- An alternative way to specify the execution context to evaluate in. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental evaluation of the expression in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive withcontextId.
OPTIONALEXPERIMENTALserializationOptions- Specifies the result serialization. If provided, overridesgeneratePreviewandreturnByValue.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<RunTime.evaluate$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.evaluate$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.evaluate$$RETA dedicated return type implies that the browser may return more than 1 datum
-
getExceptionDetails
public static Script<RunTime.ExceptionDetails> getExceptionDetails (java.lang.String errorObjectId)
This method tries to lookup and populate exception details for a JavaScript Error object. Note that the stackTrace portion of the resulting exceptionDetails will only be populated if the RunTime domain was enabled at the time when the Error was thrown.
EXPERIMENTAL- Parameters:
errorObjectId- The error object for which to resolve the exception details.- Returns:
- An instance of
Script<RunTime.ExceptionDetails>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.ExceptionDetails>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.ExceptionDetails(exceptionDetails)
-
getHeapUsage
public static Script<RunTime.getHeapUsage$$RET> getHeapUsage()
Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular RunTime.
EXPERIMENTAL- Returns:
- An instance of
Script<RunTime.getHeapUsage$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.getHeapUsage$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.getHeapUsage$$RETA dedicated return type implies that the browser may return more than 1 datum
-
getIsolateId
public static Script<java.lang.String> getIsolateId()
Returns the isolate id.
EXPERIMENTAL- Returns:
- An instance of
Script<String>
This script may be executed, usingScript.exec, and afterwards, aPromise<String>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String (id)
The isolate id.
-
getProperties
public static Script<RunTime.getProperties$$RET> getProperties (java.lang.String objectId, java.lang.Boolean ownProperties, java.lang.Boolean accessorPropertiesOnly, java.lang.Boolean generatePreview, java.lang.Boolean nonIndexedPropertiesOnly)
Returns properties of a given object. Object group of the result is inherited from the target object.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:getProperties()- Parameters:
objectId- Identifier of the object to return properties for.ownProperties- If true, returns properties belonging only to the element itself, not to its prototype chain.
OPTIONALaccessorPropertiesOnly- If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
OPTIONALEXPERIMENTALgeneratePreview- Whether preview should be generated for the results.
OPTIONALEXPERIMENTALnonIndexedPropertiesOnly- If true, returns non-indexed properties only.
OPTIONALEXPERIMENTAL- Returns:
- An instance of
Script<RunTime.getProperties$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.getProperties$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.getProperties$$RETA dedicated return type implies that the browser may return more than 1 datum
-
globalLexicalScopeNames
public static Script<java.lang.String[]> globalLexicalScopeNames (java.lang.Integer executionContextId)
Returns all let, const and class variables from global scope.- Parameters:
executionContextId- Specifies in which execution context to lookup global scope variables.
OPTIONAL- Returns:
- An instance of
Script<String[]>
This script may be executed, usingScript.exec, and afterwards, aPromise<String[]>will be returned
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:String[] (names)
-
queryObjects
public static Script<RunTime.RemoteObject> queryObjects (java.lang.String prototypeObjectId, java.lang.String objectGroup)
[No Description Provided by Google]- Parameters:
prototypeObjectId- Identifier of the prototype to return objects for.objectGroup- Symbolic group name that can be used to release the results.
OPTIONAL- Returns:
- An instance of
Script<RunTime.RemoteObject>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.RemoteObject>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.
-
releaseObject
public static Script<java.lang.Void> releaseObject (java.lang.String objectId)
Releases remote object with given id.- Parameters:
objectId- Identifier of the object to release.- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
releaseObjectGroup
public static Script<java.lang.Void> releaseObjectGroup (java.lang.String objectGroup)
Releases all remote objects that belong to a given group.- Parameters:
objectGroup- Symbolic object group name.- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
removeBinding
public static Script<java.lang.Void> removeBinding(java.lang.String name)
This method does not remove binding function from global object but unsubscribes current runtime agent from RunTime.bindingCalled notifications.- Parameters:
name- -- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
runIfWaitingForDebugger
public static Script<java.lang.Void> runIfWaitingForDebugger()
Tells inspected instance to run if it was waiting for debugger to attach.
-
runScript
public static Script<RunTime.runScript$$RET> runScript (java.lang.String scriptId, java.lang.Integer executionContextId, java.lang.String objectGroup, java.lang.Boolean silent, java.lang.Boolean includeCommandLineAPI, java.lang.Boolean returnByValue, java.lang.Boolean generatePreview, java.lang.Boolean awaitPromise)
Runs script with given id in a given context.👍 Because of the sheer number of input parameters to this method, there is a aCommandBuildervariant to this method which may be invoked instead.
Please View:runScript()- Parameters:
scriptId- Id of the script to run.executionContextId- Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
OPTIONALobjectGroup- Symbolic group name that can be used to release multiple objects.
OPTIONALsilent- In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnExceptionstate.
OPTIONALincludeCommandLineAPI- Determines whether Command Line API should be available during the evaluation.
OPTIONALreturnByValue- Whether the result is expected to be a JSON object which should be sent by value.
OPTIONALgeneratePreview- Whether preview should be generated for the result.
OPTIONALawaitPromise- Whether execution shouldawaitfor resulting value and return once awaited promise is resolved.
OPTIONAL- Returns:
- An instance of
Script<RunTime.runScript$$RET>
This script may be executed, usingScript.exec, and afterwards, aPromise<will be returnedRunTime.runScript$$RET>
Finally, thePromisemay be awaited, usingPromise.await(), and the returned result of this Browser Function may be retrieved.This Browser Function'sPromisereturns:RunTime.runScript$$RETA dedicated return type implies that the browser may return more than 1 datum
-
setAsyncCallStackDepth
public static Script<java.lang.Void> setAsyncCallStackDepth(int maxDepth)
Enables or disables async call stacks tracking.- Parameters:
maxDepth- Maximum depth of async call stacks. Setting to0will effectively disable collecting async call stacks (default).- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setCustomObjectFormatterEnabled
public static Script<java.lang.Void> setCustomObjectFormatterEnabled (boolean enabled)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
enabled- -- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
setMaxCallStackSizeToCapture
public static Script<java.lang.Void> setMaxCallStackSizeToCapture (int size)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
size- -- Returns:
- An instance of
Script<Void>
ThisScriptinstance 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<Void>to ensure that the Browser Function has run to completion.
-
terminateExecution
public static Script<java.lang.Void> terminateExecution()
Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.
EXPERIMENTAL
-
callFunctionOn
public static CommandBuilder<RunTime.callFunctionOn$$RET> callFunctionOn()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 13 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
callFunctionOn(java.lang.String, java.lang.String, Torello.Browser.JavaScriptAPI.RunTime.CallArgument[], java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Integer, java.lang.String, java.lang.Boolean, java.lang.String, Torello.Browser.JavaScriptAPI.RunTime.SerializationOptions)
-
evaluate
public static CommandBuilder<RunTime.evaluate$$RET> evaluate()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 16 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
evaluate(java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.Integer, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Number, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.String, Torello.Browser.JavaScriptAPI.RunTime.SerializationOptions)
-
getProperties
public static CommandBuilder<RunTime.getProperties$$RET> getProperties()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 5 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
getProperties(java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean)
-
runScript
public static CommandBuilder<RunTime.runScript$$RET> runScript()
Creates a buider for conveniently assigning parameters to this method.Note that the original method expects 8 parameters, and can be cumbersome.- Returns:
CommandBuilderinstance, for assigning parameter values, one by one.- See Also:
runScript(java.lang.String, java.lang.Integer, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean)
-
-