Package Torello.Browser
Class RunTime
- java.lang.Object
-
- Torello.Browser.RunTime
-
public class RunTime 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
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.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/RunTime.java
- Open New Browser-Tab: Torello/Browser/RunTime.java
File Size: 153,704 Bytes Line Count: 3,734 '\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
- 22 Method(s), 22 declared static
- 5 Field(s), 5 declared static, 4 declared final
- Fields excused from final modifier (with explanation):
Field 'counter' is not final. Reason: CONFIGURATION
-
-
Nested Class Summary
Type Classes: RunTime Domain Types Modifier and Type Inner-Class static class
RunTime.CallArgument
Represents function call argument.static class
RunTime.CallFrame
Stack entry for runtime errors and assertions.static class
RunTime.CustomPreview
[No Description Provided by Google]
EXPERIMENTALstatic class
RunTime.EntryPreview
[No Description Provided by Google]
EXPERIMENTALstatic class
RunTime.ExceptionDetails
Detailed information about exception (or error) that was thrown during script compilation or execution.static class
RunTime.ExecutionContextDescription
Description of an isolated world.static class
RunTime.InternalPropertyDescriptor
Object internal property descriptor.static class
RunTime.ObjectPreview
Object containing abbreviated remote object value.static class
RunTime.PrivatePropertyDescriptor
Object private field descriptor.static class
RunTime.PropertyDescriptor
Object property descriptor.static class
RunTime.PropertyPreview
[No Description Provided by Google]
EXPERIMENTALstatic class
RunTime.RemoteObject
Mirror object referencing original JavaScript object.static class
RunTime.StackTrace
Call frames for assertions or error messages.static class
RunTime.StackTraceId
IfdebuggerId
is set stack trace comes from another debugger and can be resolved there.Event Classes: RunTime Domain Events Modifier and Type Inner-Class static class
RunTime.bindingCalled
Notification is issued every time when binding is called.static class
RunTime.consoleAPICalled
Issued when console API was called.static class
RunTime.exceptionRevoked
Issued when unhandled exception was revoked.static class
RunTime.exceptionThrown
Issued when exception was thrown and unhandled.static class
RunTime.executionContextCreated
Issued when new execution context is created.static class
RunTime.executionContextDestroyed
Issued when execution context is destroyed.static class
RunTime.executionContextsCleared
Issued when all executionContexts were cleared in browser
This is Marker-Event.static class
RunTime.inspectRequested
Issued when object should be inspected (for example, as a result of inspect() command line API call).
-
Method Summary
RunTime Domain Commands Script Returns Modifier and Type Method NONE ( void
)static 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.Ret2<RunTime.RemoteObject,
RunTime.ExceptionDetails>static Script<>
awaitPromise(String promiseObjectId, Boolean returnByValue, Boolean generatePreview)
Add handler to promise with given promise object id.Ret2<RunTime.RemoteObject,
RunTime.ExceptionDetails>static 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)
Calls function with given declaration on the given object.Ret2<String,
RunTime.ExceptionDetails>static Script<>
compileScript(String expression, String sourceURL, boolean persistScript, Integer executionContextId)
Compiles expression.NONE ( void
)static Script<>
disable()
Disables reporting of execution contexts creation.NONE ( void
)static Script<>
discardConsoleEntries()
Discards collected exceptions and console API calls.NONE ( void
)static Script<>
enable()
Enables reporting of execution contexts creation by means ofexecutionContextCreated
event.Ret2<RunTime.RemoteObject,
RunTime.ExceptionDetails>static 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)
Evaluates expression on global object.Ret2<Number,
Number>static Script<>
getHeapUsage()
Returns the JavaScript heap usage.String
static Script<>
getIsolateId()
Returns the isolate id.Ret4<RunTime.PropertyDescriptor[],
RunTime.InternalPropertyDescriptor[],
RunTime.PrivatePropertyDescriptor[],
RunTime.ExceptionDetails>static 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.RemoteObject
static Script<>
queryObjects(String prototypeObjectId, String objectGroup)
[No Description Provided by Google]
NONE ( void
)static Script<>
releaseObject(String objectId)
Releases remote object with given id.NONE ( void
)static Script<>
releaseObjectGroup(String objectGroup)
Releases all remote objects that belong to a given group.NONE ( void
)static Script<>
removeBinding(String name)
This method does not remove binding function from global object but unsubscribes current runtime agent from RunTime.bindingCalled notifications.NONE ( void
)static Script<>
runIfWaitingForDebugger()
Tells inspected instance to run if it was waiting for debugger to attach.Ret2<RunTime.RemoteObject,
RunTime.ExceptionDetails>static 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.NONE ( void
)static Script<>
setAsyncCallStackDepth(int maxDepth)
Enables or disables async call stacks tracking.NONE ( void
)static Script<>
setCustomObjectFormatterEnabled(boolean enabled)
[No Description Provided by Google]
EXPERIMENTALNONE ( void
)static Script<>
setMaxCallStackSizeToCapture(int size)
[No Description Provided by Google]
EXPERIMENTALNONE ( void
)static Script<>
terminateExecution()
Terminate current or next JavaScript execution.
-
-
-
Method Detail
-
awaitPromise
public static Script<java.lang.String,JsonObject,Ret2<RunTime.RemoteObject,RunTime.ExceptionDetails>> 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
<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:
RunTime.RemoteObject
(result)
Promise result. Will contain rejected value if promise was rejected.Ret2.b:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details if stack strace is available.
-
callFunctionOn
public static Script<java.lang.String,JsonObject,Ret2<RunTime.RemoteObject,RunTime.ExceptionDetails>> 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)
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.- 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. OverridessetPauseOnException
state.
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.
OPTIONAL
EXPERIMENTALuserGesture
- Whether execution should be treated as initiated by user in the UI.
OPTIONALawaitPromise
- Whether execution shouldawait
for 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.
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:
RunTime.RemoteObject
(result)
Call result.Ret2.b:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details.
-
compileScript
public static Script<java.lang.String,JsonObject,Ret2<java.lang.String,RunTime.ExceptionDetails>> 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
<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 (scriptId)
Id of the script.Ret2.b:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details.
-
disable
public static Script<java.lang.String,JsonObject,Ret0> disable()
Disables reporting of execution contexts creation.- 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.
-
discardConsoleEntries
public static Script<java.lang.String,JsonObject,Ret0> discardConsoleEntries ()
Discards collected exceptions and console API calls.- 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 reporting of execution contexts creation by means ofexecutionContextCreated
event. When the reporting gets enabled the event will be sent immediately for each existing execution context.- 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.
-
evaluate
public static Script<java.lang.String,JsonObject,Ret2<RunTime.RemoteObject,RunTime.ExceptionDetails>> 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)
Evaluates expression on global object.- 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. OverridessetPauseOnException
state.
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.
OPTIONAL
EXPERIMENTALuserGesture
- Whether execution should be treated as initiated by user in the UI.
OPTIONALawaitPromise
- Whether execution shouldawait
for 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 impliesdisableBreaks
below.
OPTIONAL
EXPERIMENTALtimeout
- Terminate execution after timing out (number of milliseconds).
OPTIONAL
EXPERIMENTALdisableBreaks
- Disable breakpoints during execution.
OPTIONAL
EXPERIMENTALreplMode
- Setting this flag to true enableslet
re-declaration and top-levelawait
. Note thatlet
variables can only be re-declared if they originate fromreplMode
themselves.
OPTIONAL
EXPERIMENTALallowUnsafeEvalBlockedByCSP
- 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.
OPTIONAL
EXPERIMENTALuniqueContextId
- 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
.
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:
RunTime.RemoteObject
(result)
Evaluation result.Ret2.b:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details.
-
getIsolateId
public static Script<java.lang.String,JsonObject,java.lang.String> getIsolateId ()
Returns the isolate id.
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 (id
)
The isolate id.
-
getHeapUsage
public static Script<java.lang.String,JsonObject,Ret2<java.lang.Number,java.lang.Number>> 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
<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: Number (usedSize)
Used heap size in bytes.Ret2.b: Number (totalSize)
Allocated heap size in bytes.
-
getProperties
public static Script<java.lang.String,JsonObject,Ret4<RunTime.PropertyDescriptor[],RunTime.InternalPropertyDescriptor[],RunTime.PrivatePropertyDescriptor[],RunTime.ExceptionDetails>> 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.- 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.
OPTIONAL
EXPERIMENTALgeneratePreview
- Whether preview should be generated for the results.
OPTIONAL
EXPERIMENTALnonIndexedPropertiesOnly
- If true, returns non-indexed properties only.
OPTIONAL
EXPERIMENTAL- 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:
RunTime.PropertyDescriptor
[] (result)
Object properties.Ret4.b:
RunTime.InternalPropertyDescriptor
[] (internalProperties)
Internal object properties (only of the element itself).Ret4.c:
RunTime.PrivatePropertyDescriptor
[] (privateProperties)
Object private properties.Ret4.d:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details.
-
globalLexicalScopeNames
public static Script<java.lang.String,JsonObject,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,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[] (names
)
-
-
queryObjects
public static Script<java.lang.String,JsonObject,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
<String,JsonObject
,RunTime.RemoteObject
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.RunTime.RemoteObject
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)RunTime.RemoteObject
(objects
Array with objects.
-
releaseObject
public static Script<java.lang.String,JsonObject,Ret0> releaseObject (java.lang.String objectId)
Releases remote object with given id.- Parameters:
objectId
- Identifier of the object to release.- 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.
-
releaseObjectGroup
public static Script<java.lang.String,JsonObject,Ret0> 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
<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.
-
runIfWaitingForDebugger
public static Script<java.lang.String,JsonObject,Ret0> runIfWaitingForDebugger ()
Tells inspected instance to run if it was waiting for debugger to attach.- 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.
-
runScript
public static Script<java.lang.String,JsonObject,Ret2<RunTime.RemoteObject,RunTime.ExceptionDetails>> 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.- 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. OverridessetPauseOnException
state.
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 shouldawait
for resulting value and return once awaited promise is resolved.
OPTIONAL- 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:
RunTime.RemoteObject
(result)
Run result.Ret2.b:
RunTime.ExceptionDetails
(exceptionDetails)
Exception details.
-
setAsyncCallStackDepth
public static Script<java.lang.String,JsonObject,Ret0> setAsyncCallStackDepth (int maxDepth)
Enables or disables async call stacks tracking.- Parameters:
maxDepth
- Maximum depth of async call stacks. Setting to0
will effectively disable collecting async call stacks (default).- 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.
-
setCustomObjectFormatterEnabled
public static Script<java.lang.String,JsonObject,Ret0> setCustomObjectFormatterEnabled (boolean enabled)
[No Description Provided by Google]
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.
-
setMaxCallStackSizeToCapture
public static Script<java.lang.String,JsonObject,Ret0> setMaxCallStackSizeToCapture (int size)
[No Description Provided by Google]
EXPERIMENTAL- Parameters:
size
- -- 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.
-
terminateExecution
public static Script<java.lang.String,JsonObject,Ret0> terminateExecution ()
Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.
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.
-
addBinding
public static Script<java.lang.String,JsonObject,Ret0> 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.
EXPERIMENTAL- Parameters:
name
- -executionContextId
- If specified, the binding would only be exposed to the specified execution context. If omitted andexecutionContextName
is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive withexecutionContextName
. Deprecated in favor ofexecutionContextName
due to an unclear use case and bugs in implementation (crbug.com/1169639).executionContextId
will be removed in the future.
OPTIONAL
DEPRECATEDexecutionContextName
- If specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See alsoExecutionContext.name
andworldName
parameter toPage.addScriptToEvaluateOnNewDocument
. This parameter is mutually exclusive withexecutionContextId
.
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.
-
removeBinding
public static Script<java.lang.String,JsonObject,Ret0> removeBinding (java.lang.String name)
This method does not remove binding function from global object but unsubscribes current runtime agent from RunTime.bindingCalled notifications.
EXPERIMENTAL- Parameters:
name
- -- 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.
-
-