Class Runtime
java.lang.Object
org.openqa.selenium.devtools.v126.runtime.Runtime
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 ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.openqa.selenium.devtools.Command<Void>
addBinding
(String name, Optional<ExecutionContextId> executionContextId, Optional<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.static org.openqa.selenium.devtools.Command<Runtime.AwaitPromiseResponse>
awaitPromise
(RemoteObjectId promiseObjectId, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview) Add handler to promise with given promise object id.static org.openqa.selenium.devtools.Event<BindingCalled>
static org.openqa.selenium.devtools.Command<Runtime.CallFunctionOnResponse>
callFunctionOn
(String functionDeclaration, Optional<RemoteObjectId> objectId, Optional<List<CallArgument>> arguments, Optional<Boolean> silent, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview, Optional<Boolean> userGesture, Optional<Boolean> awaitPromise, Optional<ExecutionContextId> executionContextId, Optional<String> objectGroup, Optional<Boolean> throwOnSideEffect, Optional<String> uniqueContextId, Optional<SerializationOptions> serializationOptions) Calls function with given declaration on the given object.static org.openqa.selenium.devtools.Command<Runtime.CompileScriptResponse>
compileScript
(String expression, String sourceURL, Boolean persistScript, Optional<ExecutionContextId> executionContextId) Compiles expression.static org.openqa.selenium.devtools.Event<ConsoleAPICalled>
static org.openqa.selenium.devtools.Command<Void>
disable()
Disables reporting of execution contexts creation.static org.openqa.selenium.devtools.Command<Void>
Discards collected exceptions and console API calls.static org.openqa.selenium.devtools.Command<Void>
enable()
Enables reporting of execution contexts creation by means of `executionContextCreated` event.static org.openqa.selenium.devtools.Command<Runtime.EvaluateResponse>
evaluate
(String expression, Optional<String> objectGroup, Optional<Boolean> includeCommandLineAPI, Optional<Boolean> silent, Optional<ExecutionContextId> contextId, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview, Optional<Boolean> userGesture, Optional<Boolean> awaitPromise, Optional<Boolean> throwOnSideEffect, Optional<TimeDelta> timeout, Optional<Boolean> disableBreaks, Optional<Boolean> replMode, Optional<Boolean> allowUnsafeEvalBlockedByCSP, Optional<String> uniqueContextId, Optional<SerializationOptions> serializationOptions) Evaluates expression on global object.static org.openqa.selenium.devtools.Event<ExceptionRevoked>
static org.openqa.selenium.devtools.Event<ExceptionThrown>
static org.openqa.selenium.devtools.Event<ExecutionContextDescription>
static org.openqa.selenium.devtools.Event<ExecutionContextDestroyed>
static org.openqa.selenium.devtools.Event<Void>
static org.openqa.selenium.devtools.Command<ExceptionDetails>
getExceptionDetails
(RemoteObjectId errorObjectId) This method tries to lookup and populate exception details for a JavaScript Error object.static org.openqa.selenium.devtools.Command<Runtime.GetHeapUsageResponse>
Returns the JavaScript heap usage.static org.openqa.selenium.devtools.Command<String>
Returns the isolate id.static org.openqa.selenium.devtools.Command<Runtime.GetPropertiesResponse>
getProperties
(RemoteObjectId objectId, Optional<Boolean> ownProperties, Optional<Boolean> accessorPropertiesOnly, Optional<Boolean> generatePreview, Optional<Boolean> nonIndexedPropertiesOnly) Returns properties of a given object.globalLexicalScopeNames
(Optional<ExecutionContextId> executionContextId) Returns all let, const and class variables from global scope.static org.openqa.selenium.devtools.Event<InspectRequested>
static org.openqa.selenium.devtools.Command<RemoteObject>
queryObjects
(RemoteObjectId prototypeObjectId, Optional<String> objectGroup) static org.openqa.selenium.devtools.Command<Void>
releaseObject
(RemoteObjectId objectId) Releases remote object with given id.static org.openqa.selenium.devtools.Command<Void>
releaseObjectGroup
(String objectGroup) Releases all remote objects that belong to a given group.static org.openqa.selenium.devtools.Command<Void>
removeBinding
(String name) This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.static org.openqa.selenium.devtools.Command<Void>
Tells inspected instance to run if it was waiting for debugger to attach.static org.openqa.selenium.devtools.Command<Runtime.RunScriptResponse>
runScript
(ScriptId scriptId, Optional<ExecutionContextId> executionContextId, Optional<String> objectGroup, Optional<Boolean> silent, Optional<Boolean> includeCommandLineAPI, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview, Optional<Boolean> awaitPromise) Runs script with given id in a given context.static org.openqa.selenium.devtools.Command<Void>
setAsyncCallStackDepth
(Integer maxDepth) Enables or disables async call stacks tracking.static org.openqa.selenium.devtools.Command<Void>
setCustomObjectFormatterEnabled
(Boolean enabled) static org.openqa.selenium.devtools.Command<Void>
static org.openqa.selenium.devtools.Command<Void>
Terminate current or next JavaScript execution.
-
Constructor Details
-
Runtime
public Runtime()
-
-
Method Details
-
awaitPromise
public static org.openqa.selenium.devtools.Command<Runtime.AwaitPromiseResponse> awaitPromise(RemoteObjectId promiseObjectId, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview) Add handler to promise with given promise object id. -
callFunctionOn
public static org.openqa.selenium.devtools.Command<Runtime.CallFunctionOnResponse> callFunctionOn(String functionDeclaration, Optional<RemoteObjectId> objectId, Optional<List<CallArgument>> arguments, Optional<Boolean> silent, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview, Optional<Boolean> userGesture, Optional<Boolean> awaitPromise, Optional<ExecutionContextId> executionContextId, Optional<String> objectGroup, Optional<Boolean> throwOnSideEffect, Optional<String> uniqueContextId, Optional<SerializationOptions> serializationOptions) Calls function with given declaration on the given object. Object group of the result is inherited from the target object. -
compileScript
public static org.openqa.selenium.devtools.Command<Runtime.CompileScriptResponse> compileScript(String expression, String sourceURL, Boolean persistScript, Optional<ExecutionContextId> executionContextId) Compiles expression. -
disable
Disables reporting of execution contexts creation. -
discardConsoleEntries
Discards collected exceptions and console API calls. -
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 org.openqa.selenium.devtools.Command<Runtime.EvaluateResponse> evaluate(String expression, Optional<String> objectGroup, Optional<Boolean> includeCommandLineAPI, Optional<Boolean> silent, Optional<ExecutionContextId> contextId, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview, Optional<Boolean> userGesture, Optional<Boolean> awaitPromise, Optional<Boolean> throwOnSideEffect, Optional<TimeDelta> timeout, Optional<Boolean> disableBreaks, Optional<Boolean> replMode, Optional<Boolean> allowUnsafeEvalBlockedByCSP, Optional<String> uniqueContextId, Optional<SerializationOptions> serializationOptions) Evaluates expression on global object. -
getIsolateId
Returns the isolate id. -
getHeapUsage
@Beta public static org.openqa.selenium.devtools.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 org.openqa.selenium.devtools.Command<Runtime.GetPropertiesResponse> getProperties(RemoteObjectId objectId, Optional<Boolean> ownProperties, Optional<Boolean> accessorPropertiesOnly, Optional<Boolean> generatePreview, Optional<Boolean> nonIndexedPropertiesOnly) Returns properties of a given object. Object group of the result is inherited from the target object. -
globalLexicalScopeNames
public static org.openqa.selenium.devtools.Command<List<String>> globalLexicalScopeNames(Optional<ExecutionContextId> executionContextId) Returns all let, const and class variables from global scope. -
queryObjects
public static org.openqa.selenium.devtools.Command<RemoteObject> queryObjects(RemoteObjectId prototypeObjectId, Optional<String> objectGroup) -
releaseObject
Releases remote object with given id. -
releaseObjectGroup
Releases all remote objects that belong to a given group. -
runIfWaitingForDebugger
Tells inspected instance to run if it was waiting for debugger to attach. -
runScript
public static org.openqa.selenium.devtools.Command<Runtime.RunScriptResponse> runScript(ScriptId scriptId, Optional<ExecutionContextId> executionContextId, Optional<String> objectGroup, Optional<Boolean> silent, Optional<Boolean> includeCommandLineAPI, Optional<Boolean> returnByValue, Optional<Boolean> generatePreview, Optional<Boolean> awaitPromise) Runs script with given id in a given context. -
setAsyncCallStackDepth
Enables or disables async call stacks tracking. -
setCustomObjectFormatterEnabled
-
setMaxCallStackSizeToCapture
-
terminateExecution
Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends. -
addBinding
public static org.openqa.selenium.devtools.Command<Void> addBinding(String name, Optional<ExecutionContextId> executionContextId, Optional<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. -
removeBinding
This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications. -
getExceptionDetails
@Beta public static org.openqa.selenium.devtools.Command<ExceptionDetails> getExceptionDetails(RemoteObjectId 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. -
bindingCalled
-
consoleAPICalled
-
exceptionRevoked
-
exceptionThrown
-
executionContextCreated
public static org.openqa.selenium.devtools.Event<ExecutionContextDescription> executionContextCreated() -
executionContextDestroyed
public static org.openqa.selenium.devtools.Event<ExecutionContextDestroyed> executionContextDestroyed() -
executionContextsCleared
-
inspectRequested
-