Class Runtime
- java.lang.Object
-
- org.openqa.selenium.devtools.v112.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 org.openqa.selenium.devtools.Command<java.lang.Void>
addBinding(java.lang.String name, java.util.Optional<ExecutionContextId> executionContextId, java.util.Optional<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.static org.openqa.selenium.devtools.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 org.openqa.selenium.devtools.Event<BindingCalled>
bindingCalled()
static org.openqa.selenium.devtools.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, java.util.Optional<java.lang.Boolean> throwOnSideEffect, java.util.Optional<java.lang.String> uniqueContextId, java.util.Optional<java.lang.Boolean> generateWebDriverValue)
Calls function with given declaration on the given object.static org.openqa.selenium.devtools.Command<Runtime.CompileScriptResponse>
compileScript(java.lang.String expression, java.lang.String sourceURL, java.lang.Boolean persistScript, java.util.Optional<ExecutionContextId> executionContextId)
Compiles expression.static org.openqa.selenium.devtools.Event<ConsoleAPICalled>
consoleAPICalled()
static org.openqa.selenium.devtools.Command<java.lang.Void>
disable()
Disables reporting of execution contexts creation.static org.openqa.selenium.devtools.Command<java.lang.Void>
discardConsoleEntries()
Discards collected exceptions and console API calls.static org.openqa.selenium.devtools.Command<java.lang.Void>
enable()
Enables reporting of execution contexts creation by means of `executionContextCreated` event.static org.openqa.selenium.devtools.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, java.util.Optional<java.lang.Boolean> allowUnsafeEvalBlockedByCSP, java.util.Optional<java.lang.String> uniqueContextId, java.util.Optional<java.lang.Boolean> generateWebDriverValue)
Evaluates expression on global object.static org.openqa.selenium.devtools.Event<ExceptionRevoked>
exceptionRevoked()
static org.openqa.selenium.devtools.Event<ExceptionThrown>
exceptionThrown()
static org.openqa.selenium.devtools.Event<ExecutionContextDescription>
executionContextCreated()
static org.openqa.selenium.devtools.Event<ExecutionContextDestroyed>
executionContextDestroyed()
static org.openqa.selenium.devtools.Event<java.lang.Void>
executionContextsCleared()
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>
getHeapUsage()
Returns the JavaScript heap usage.static org.openqa.selenium.devtools.Command<java.lang.String>
getIsolateId()
Returns the isolate id.static org.openqa.selenium.devtools.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, java.util.Optional<java.lang.Boolean> nonIndexedPropertiesOnly)
Returns properties of a given object.static org.openqa.selenium.devtools.Command<java.util.List<java.lang.String>>
globalLexicalScopeNames(java.util.Optional<ExecutionContextId> executionContextId)
Returns all let, const and class variables from global scope.static org.openqa.selenium.devtools.Event<InspectRequested>
inspectRequested()
static org.openqa.selenium.devtools.Command<RemoteObject>
queryObjects(RemoteObjectId prototypeObjectId, java.util.Optional<java.lang.String> objectGroup)
static org.openqa.selenium.devtools.Command<java.lang.Void>
releaseObject(RemoteObjectId objectId)
Releases remote object with given id.static org.openqa.selenium.devtools.Command<java.lang.Void>
releaseObjectGroup(java.lang.String objectGroup)
Releases all remote objects that belong to a given group.static org.openqa.selenium.devtools.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 org.openqa.selenium.devtools.Command<java.lang.Void>
runIfWaitingForDebugger()
Tells inspected instance to run if it was waiting for debugger to attach.static org.openqa.selenium.devtools.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 org.openqa.selenium.devtools.Command<java.lang.Void>
setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.static org.openqa.selenium.devtools.Command<java.lang.Void>
setCustomObjectFormatterEnabled(java.lang.Boolean enabled)
static org.openqa.selenium.devtools.Command<java.lang.Void>
setMaxCallStackSizeToCapture(java.lang.Integer size)
static org.openqa.selenium.devtools.Command<java.lang.Void>
terminateExecution()
Terminate current or next JavaScript execution.
-
-
-
Method Detail
-
awaitPromise
public static org.openqa.selenium.devtools.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 org.openqa.selenium.devtools.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, java.util.Optional<java.lang.Boolean> throwOnSideEffect, java.util.Optional<java.lang.String> uniqueContextId, java.util.Optional<java.lang.Boolean> generateWebDriverValue)
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(java.lang.String expression, java.lang.String sourceURL, java.lang.Boolean persistScript, java.util.Optional<ExecutionContextId> executionContextId)
Compiles expression.
-
disable
public static org.openqa.selenium.devtools.Command<java.lang.Void> disable()
Disables reporting of execution contexts creation.
-
discardConsoleEntries
public static org.openqa.selenium.devtools.Command<java.lang.Void> discardConsoleEntries()
Discards collected exceptions and console API calls.
-
enable
public static org.openqa.selenium.devtools.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 org.openqa.selenium.devtools.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, java.util.Optional<java.lang.Boolean> allowUnsafeEvalBlockedByCSP, java.util.Optional<java.lang.String> uniqueContextId, java.util.Optional<java.lang.Boolean> generateWebDriverValue)
Evaluates expression on global object.
-
getIsolateId
@Beta public static org.openqa.selenium.devtools.Command<java.lang.String> 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, java.util.Optional<java.lang.Boolean> ownProperties, java.util.Optional<java.lang.Boolean> accessorPropertiesOnly, java.util.Optional<java.lang.Boolean> generatePreview, java.util.Optional<java.lang.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<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 org.openqa.selenium.devtools.Command<RemoteObject> queryObjects(RemoteObjectId prototypeObjectId, java.util.Optional<java.lang.String> objectGroup)
-
releaseObject
public static org.openqa.selenium.devtools.Command<java.lang.Void> releaseObject(RemoteObjectId objectId)
Releases remote object with given id.
-
releaseObjectGroup
public static org.openqa.selenium.devtools.Command<java.lang.Void> releaseObjectGroup(java.lang.String objectGroup)
Releases all remote objects that belong to a given group.
-
runIfWaitingForDebugger
public static org.openqa.selenium.devtools.Command<java.lang.Void> 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, 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 org.openqa.selenium.devtools.Command<java.lang.Void> setAsyncCallStackDepth(java.lang.Integer maxDepth)
Enables or disables async call stacks tracking.
-
setCustomObjectFormatterEnabled
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setCustomObjectFormatterEnabled(java.lang.Boolean enabled)
-
setMaxCallStackSizeToCapture
@Beta public static org.openqa.selenium.devtools.Command<java.lang.Void> setMaxCallStackSizeToCapture(java.lang.Integer size)
-
terminateExecution
@Beta public static org.openqa.selenium.devtools.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 org.openqa.selenium.devtools.Command<java.lang.Void> addBinding(java.lang.String name, java.util.Optional<ExecutionContextId> executionContextId, java.util.Optional<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.
-
removeBinding
@Beta public static org.openqa.selenium.devtools.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.
-
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
public static org.openqa.selenium.devtools.Event<BindingCalled> bindingCalled()
-
consoleAPICalled
public static org.openqa.selenium.devtools.Event<ConsoleAPICalled> consoleAPICalled()
-
exceptionRevoked
public static org.openqa.selenium.devtools.Event<ExceptionRevoked> exceptionRevoked()
-
exceptionThrown
public static org.openqa.selenium.devtools.Event<ExceptionThrown> exceptionThrown()
-
executionContextCreated
public static org.openqa.selenium.devtools.Event<ExecutionContextDescription> executionContextCreated()
-
executionContextDestroyed
public static org.openqa.selenium.devtools.Event<ExecutionContextDestroyed> executionContextDestroyed()
-
executionContextsCleared
public static org.openqa.selenium.devtools.Event<java.lang.Void> executionContextsCleared()
-
inspectRequested
public static org.openqa.selenium.devtools.Event<InspectRequested> inspectRequested()
-
-