Class Runtime
- java.lang.Object
-
- org.openqa.selenium.devtools.runtime.Runtime
-
public class Runtime extends java.lang.Object
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Runtime.AwaitPromiseResponse
static class
Runtime.CallFunctionOnResponse
static class
Runtime.CompileScriptResponse
static class
Runtime.EvaluateResponse
static class
Runtime.GetHeapUsageResponse
static class
Runtime.GetPropertiesResponse
static class
Runtime.RunScriptResponse
-
Constructor Summary
Constructors Constructor Description Runtime()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Command<java.lang.Void>
addBinding(java.lang.String name, java.util.Optional<ExecutionContextId> executionContextId)
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.static Command<Runtime.AwaitPromiseResponse>
awaitPromise(RemoteObjectId promiseObjectId, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview)
Add handler to promise with given promise object id.static Event<BindingCalled>
bindingCalled()
static Command<Runtime.CallFunctionOnResponse>
callFunctionOn(java.lang.String functionDeclaration, java.util.Optional<RemoteObjectId> objectId, java.util.Optional<java.util.List<CallArgument>> arguments, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> userGesture, java.util.Optional<java.lang.Boolean> awaitPromise, java.util.Optional<ExecutionContextId> executionContextId, java.util.Optional<java.lang.String> objectGroup)
Calls function with given declaration on the given object.static Command<Runtime.CompileScriptResponse>
compileScript(java.lang.String expression, java.lang.String sourceURL, java.lang.Boolean persistScript, java.util.Optional<ExecutionContextId> executionContextId)
Compiles expression.static Event<ConsoleAPICalled>
consoleAPICalled()
static Command<java.lang.Void>
disable()
Disables reporting of execution contexts creation.static Command<java.lang.Void>
discardConsoleEntries()
Discards collected exceptions and console API calls.static Command<java.lang.Void>
enable()
Enables reporting of execution contexts creation by means of `executionContextCreated` event.static Command<Runtime.EvaluateResponse>
evaluate(java.lang.String expression, java.util.Optional<java.lang.String> objectGroup, java.util.Optional<java.lang.Boolean> includeCommandLineAPI, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<ExecutionContextId> contextId, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> userGesture, java.util.Optional<java.lang.Boolean> awaitPromise, java.util.Optional<java.lang.Boolean> throwOnSideEffect, java.util.Optional<TimeDelta> timeout, java.util.Optional<java.lang.Boolean> disableBreaks, java.util.Optional<java.lang.Boolean> replMode)
Evaluates expression on global object.static Event<ExceptionRevoked>
exceptionRevoked()
static Event<ExceptionThrown>
exceptionThrown()
static Event<ExecutionContextDescription>
executionContextCreated()
static Event<ExecutionContextId>
executionContextDestroyed()
static Event<java.lang.Void>
executionContextsCleared()
static Command<Runtime.GetHeapUsageResponse>
getHeapUsage()
Returns the JavaScript heap usage.static Command<java.lang.String>
getIsolateId()
Returns the isolate id.static Command<Runtime.GetPropertiesResponse>
getProperties(RemoteObjectId objectId, java.util.Optional<java.lang.Boolean> ownProperties, java.util.Optional<java.lang.Boolean> accessorPropertiesOnly, java.util.Optional<java.lang.Boolean> generatePreview)
Returns properties of a given object.static Command<java.util.List<java.lang.String>>
globalLexicalScopeNames(java.util.Optional<ExecutionContextId> executionContextId)
Returns all let, const and class variables from global scope.static Event<InspectRequested>
inspectRequested()
static Command<RemoteObject>
queryObjects(RemoteObjectId prototypeObjectId, java.util.Optional<java.lang.String> objectGroup)
static Command<java.lang.Void>
releaseObject(RemoteObjectId objectId)
Releases remote object with given id.static Command<java.lang.Void>
releaseObjectGroup(java.lang.String objectGroup)
Releases all remote objects that belong to a given group.static Command<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.static Command<java.lang.Void>
runIfWaitingForDebugger()
Tells inspected instance to run if it was waiting for debugger to attach.static Command<Runtime.RunScriptResponse>
runScript(ScriptId scriptId, java.util.Optional<ExecutionContextId> executionContextId, java.util.Optional<java.lang.String> objectGroup, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<java.lang.Boolean> includeCommandLineAPI, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> awaitPromise)
Runs script with given id in a given context.static Command<java.lang.Void>
setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.static Command<java.lang.Void>
setCustomObjectFormatterEnabled(java.lang.Boolean enabled)
static Command<java.lang.Void>
setMaxCallStackSizeToCapture(java.lang.Integer size)
static Command<java.lang.Void>
terminateExecution()
Terminate current or next JavaScript execution.
-
-
-
Method Detail
-
awaitPromise
public static Command<Runtime.AwaitPromiseResponse> awaitPromise(RemoteObjectId promiseObjectId, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview)
Add handler to promise with given promise object id.
-
callFunctionOn
public static Command<Runtime.CallFunctionOnResponse> callFunctionOn(java.lang.String functionDeclaration, java.util.Optional<RemoteObjectId> objectId, java.util.Optional<java.util.List<CallArgument>> arguments, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> userGesture, java.util.Optional<java.lang.Boolean> awaitPromise, java.util.Optional<ExecutionContextId> executionContextId, java.util.Optional<java.lang.String> objectGroup)
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
-
compileScript
public static Command<Runtime.CompileScriptResponse> compileScript(java.lang.String expression, java.lang.String sourceURL, java.lang.Boolean persistScript, java.util.Optional<ExecutionContextId> executionContextId)
Compiles expression.
-
disable
public static Command<java.lang.Void> disable()
Disables reporting of execution contexts creation.
-
discardConsoleEntries
public static Command<java.lang.Void> discardConsoleEntries()
Discards collected exceptions and console API calls.
-
enable
public static Command<java.lang.Void> enable()
Enables reporting of execution contexts creation by means of `executionContextCreated` event. When the reporting gets enabled the event will be sent immediately for each existing execution context.
-
evaluate
public static Command<Runtime.EvaluateResponse> evaluate(java.lang.String expression, java.util.Optional<java.lang.String> objectGroup, java.util.Optional<java.lang.Boolean> includeCommandLineAPI, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<ExecutionContextId> contextId, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> userGesture, java.util.Optional<java.lang.Boolean> awaitPromise, java.util.Optional<java.lang.Boolean> throwOnSideEffect, java.util.Optional<TimeDelta> timeout, java.util.Optional<java.lang.Boolean> disableBreaks, java.util.Optional<java.lang.Boolean> replMode)
Evaluates expression on global object.
-
getIsolateId
@Beta public static Command<java.lang.String> getIsolateId()
Returns the isolate id.
-
getHeapUsage
@Beta public static Command<Runtime.GetHeapUsageResponse> getHeapUsage()
Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.
-
getProperties
public static Command<Runtime.GetPropertiesResponse> getProperties(RemoteObjectId objectId, java.util.Optional<java.lang.Boolean> ownProperties, java.util.Optional<java.lang.Boolean> accessorPropertiesOnly, java.util.Optional<java.lang.Boolean> generatePreview)
Returns properties of a given object. Object group of the result is inherited from the target object.
-
globalLexicalScopeNames
public static Command<java.util.List<java.lang.String>> globalLexicalScopeNames(java.util.Optional<ExecutionContextId> executionContextId)
Returns all let, const and class variables from global scope.
-
queryObjects
public static Command<RemoteObject> queryObjects(RemoteObjectId prototypeObjectId, java.util.Optional<java.lang.String> objectGroup)
-
releaseObject
public static Command<java.lang.Void> releaseObject(RemoteObjectId objectId)
Releases remote object with given id.
-
releaseObjectGroup
public static Command<java.lang.Void> releaseObjectGroup(java.lang.String objectGroup)
Releases all remote objects that belong to a given group.
-
runIfWaitingForDebugger
public static Command<java.lang.Void> runIfWaitingForDebugger()
Tells inspected instance to run if it was waiting for debugger to attach.
-
runScript
public static Command<Runtime.RunScriptResponse> runScript(ScriptId scriptId, java.util.Optional<ExecutionContextId> executionContextId, java.util.Optional<java.lang.String> objectGroup, java.util.Optional<java.lang.Boolean> silent, java.util.Optional<java.lang.Boolean> includeCommandLineAPI, java.util.Optional<java.lang.Boolean> returnByValue, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.Boolean> awaitPromise)
Runs script with given id in a given context.
-
setAsyncCallStackDepth
public static Command<java.lang.Void> setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.
-
setCustomObjectFormatterEnabled
@Beta public static Command<java.lang.Void> setCustomObjectFormatterEnabled(java.lang.Boolean enabled)
-
setMaxCallStackSizeToCapture
@Beta public static Command<java.lang.Void> setMaxCallStackSizeToCapture(java.lang.Integer size)
-
terminateExecution
@Beta public static Command<java.lang.Void> terminateExecution()
Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.
-
addBinding
@Beta public static Command<java.lang.Void> addBinding(java.lang.String name, java.util.Optional<ExecutionContextId> executionContextId)
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. If executionContextId is specified, adds binding only on global object of given execution context. 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.
-
removeBinding
@Beta public static Command<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.
-
bindingCalled
public static Event<BindingCalled> bindingCalled()
-
consoleAPICalled
public static Event<ConsoleAPICalled> consoleAPICalled()
-
exceptionRevoked
public static Event<ExceptionRevoked> exceptionRevoked()
-
exceptionThrown
public static Event<ExceptionThrown> exceptionThrown()
-
executionContextCreated
public static Event<ExecutionContextDescription> executionContextCreated()
-
executionContextDestroyed
public static Event<ExecutionContextId> executionContextDestroyed()
-
executionContextsCleared
public static Event<java.lang.Void> executionContextsCleared()
-
inspectRequested
public static Event<InspectRequested> inspectRequested()
-
-