Table of Contents

Class RuntimeAdapter

Namespace
OpenQA.Selenium.DevTools.V148.Runtime
Assembly
Selenium.WebDriver.dll

Represents an adapter for the Runtime domain to simplify the command interface.

public class RuntimeAdapter
Inheritance
RuntimeAdapter
Inherited Members

Constructors

RuntimeAdapter(IDevToolsSession)

Initializes a new instance of the RuntimeAdapter class.

public RuntimeAdapter(IDevToolsSession session)

Parameters

session IDevToolsSession

The IDevToolsSession to be used with this adapter.

Exceptions

ArgumentNullException

If session is null.

Properties

Session

Gets the DevToolsSession associated with the adapter.

public IDevToolsSession Session { get; }

Property Value

IDevToolsSession

Methods

AddBinding(AddBindingCommandSettings, CancellationToken, int?, bool)

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.

public Task<AddBindingCommandResponse?> AddBinding(AddBindingCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command AddBindingCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<AddBindingCommandResponse>

AwaitPromise(AwaitPromiseCommandSettings, CancellationToken, int?, bool)

Add handler to promise with given promise object id.

public Task<AwaitPromiseCommandResponse> AwaitPromise(AwaitPromiseCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command AwaitPromiseCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<AwaitPromiseCommandResponse>

CallFunctionOn(CallFunctionOnCommandSettings, CancellationToken, int?, bool)

Calls function with given declaration on the given object. Object group of the result is inherited from the target object.

public Task<CallFunctionOnCommandResponse> CallFunctionOn(CallFunctionOnCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command CallFunctionOnCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<CallFunctionOnCommandResponse>

CompileScript(CompileScriptCommandSettings, CancellationToken, int?, bool)

Compiles expression.

public Task<CompileScriptCommandResponse> CompileScript(CompileScriptCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command CompileScriptCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<CompileScriptCommandResponse>

Disable(DisableCommandSettings?, CancellationToken, int?, bool)

Disables reporting of execution contexts creation.

public Task<DisableCommandResponse?> Disable(DisableCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command DisableCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<DisableCommandResponse>

DiscardConsoleEntries(DiscardConsoleEntriesCommandSettings?, CancellationToken, int?, bool)

Discards collected exceptions and console API calls.

public Task<DiscardConsoleEntriesCommandResponse?> DiscardConsoleEntries(DiscardConsoleEntriesCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command DiscardConsoleEntriesCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<DiscardConsoleEntriesCommandResponse>

Enable(EnableCommandSettings?, CancellationToken, int?, bool)

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.

public Task<EnableCommandResponse?> Enable(EnableCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command EnableCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<EnableCommandResponse>

Evaluate(EvaluateCommandSettings, CancellationToken, int?, bool)

Evaluates expression on global object.

public Task<EvaluateCommandResponse> Evaluate(EvaluateCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command EvaluateCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<EvaluateCommandResponse>

GetExceptionDetails(GetExceptionDetailsCommandSettings, CancellationToken, int?, bool)

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.

public Task<GetExceptionDetailsCommandResponse> GetExceptionDetails(GetExceptionDetailsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetExceptionDetailsCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetExceptionDetailsCommandResponse>

GetHeapUsage(GetHeapUsageCommandSettings?, CancellationToken, int?, bool)

Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.

public Task<GetHeapUsageCommandResponse> GetHeapUsage(GetHeapUsageCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetHeapUsageCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetHeapUsageCommandResponse>

GetIsolateId(GetIsolateIdCommandSettings?, CancellationToken, int?, bool)

Returns the isolate id.

public Task<GetIsolateIdCommandResponse> GetIsolateId(GetIsolateIdCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetIsolateIdCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetIsolateIdCommandResponse>

GetProperties(GetPropertiesCommandSettings, CancellationToken, int?, bool)

Returns properties of a given object. Object group of the result is inherited from the target object.

public Task<GetPropertiesCommandResponse> GetProperties(GetPropertiesCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetPropertiesCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetPropertiesCommandResponse>

GlobalLexicalScopeNames(GlobalLexicalScopeNamesCommandSettings, CancellationToken, int?, bool)

Returns all let, const and class variables from global scope.

public Task<GlobalLexicalScopeNamesCommandResponse> GlobalLexicalScopeNames(GlobalLexicalScopeNamesCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GlobalLexicalScopeNamesCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GlobalLexicalScopeNamesCommandResponse>

QueryObjects(QueryObjectsCommandSettings, CancellationToken, int?, bool)

queryObjects

public Task<QueryObjectsCommandResponse> QueryObjects(QueryObjectsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command QueryObjectsCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<QueryObjectsCommandResponse>

ReleaseObject(ReleaseObjectCommandSettings, CancellationToken, int?, bool)

Releases remote object with given id.

public Task<ReleaseObjectCommandResponse?> ReleaseObject(ReleaseObjectCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command ReleaseObjectCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<ReleaseObjectCommandResponse>

ReleaseObjectGroup(ReleaseObjectGroupCommandSettings, CancellationToken, int?, bool)

Releases all remote objects that belong to a given group.

public Task<ReleaseObjectGroupCommandResponse?> ReleaseObjectGroup(ReleaseObjectGroupCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command ReleaseObjectGroupCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<ReleaseObjectGroupCommandResponse>

RemoveBinding(RemoveBindingCommandSettings, CancellationToken, int?, bool)

This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.

public Task<RemoveBindingCommandResponse?> RemoveBinding(RemoveBindingCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command RemoveBindingCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<RemoveBindingCommandResponse>

RunIfWaitingForDebugger(RunIfWaitingForDebuggerCommandSettings?, CancellationToken, int?, bool)

Tells inspected instance to run if it was waiting for debugger to attach.

public Task<RunIfWaitingForDebuggerCommandResponse?> RunIfWaitingForDebugger(RunIfWaitingForDebuggerCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command RunIfWaitingForDebuggerCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<RunIfWaitingForDebuggerCommandResponse>

RunScript(RunScriptCommandSettings, CancellationToken, int?, bool)

Runs script with given id in a given context.

public Task<RunScriptCommandResponse> RunScript(RunScriptCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command RunScriptCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<RunScriptCommandResponse>

SetAsyncCallStackDepth(SetAsyncCallStackDepthCommandSettings, CancellationToken, int?, bool)

Enables or disables async call stacks tracking.

public Task<SetAsyncCallStackDepthCommandResponse?> SetAsyncCallStackDepth(SetAsyncCallStackDepthCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetAsyncCallStackDepthCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetAsyncCallStackDepthCommandResponse>

SetCustomObjectFormatterEnabled(SetCustomObjectFormatterEnabledCommandSettings, CancellationToken, int?, bool)

setCustomObjectFormatterEnabled

public Task<SetCustomObjectFormatterEnabledCommandResponse?> SetCustomObjectFormatterEnabled(SetCustomObjectFormatterEnabledCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetCustomObjectFormatterEnabledCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetCustomObjectFormatterEnabledCommandResponse>

SetMaxCallStackSizeToCapture(SetMaxCallStackSizeToCaptureCommandSettings, CancellationToken, int?, bool)

setMaxCallStackSizeToCapture

public Task<SetMaxCallStackSizeToCaptureCommandResponse?> SetMaxCallStackSizeToCapture(SetMaxCallStackSizeToCaptureCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetMaxCallStackSizeToCaptureCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetMaxCallStackSizeToCaptureCommandResponse>

TerminateExecution(TerminateExecutionCommandSettings?, CancellationToken, int?, bool)

Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.

public Task<TerminateExecutionCommandResponse?> TerminateExecution(TerminateExecutionCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command TerminateExecutionCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<TerminateExecutionCommandResponse>

Events

BindingCalled

Notification is issued every time when binding is called.

public event EventHandler<BindingCalledEventArgs>? BindingCalled

Event Type

EventHandler<BindingCalledEventArgs>

ConsoleAPICalled

Issued when console API was called.

public event EventHandler<ConsoleAPICalledEventArgs>? ConsoleAPICalled

Event Type

EventHandler<ConsoleAPICalledEventArgs>

ExceptionRevoked

Issued when unhandled exception was revoked.

public event EventHandler<ExceptionRevokedEventArgs>? ExceptionRevoked

Event Type

EventHandler<ExceptionRevokedEventArgs>

ExceptionThrown

Issued when exception was thrown and unhandled.

public event EventHandler<ExceptionThrownEventArgs>? ExceptionThrown

Event Type

EventHandler<ExceptionThrownEventArgs>

ExecutionContextCreated

Issued when new execution context is created.

public event EventHandler<ExecutionContextCreatedEventArgs>? ExecutionContextCreated

Event Type

EventHandler<ExecutionContextCreatedEventArgs>

ExecutionContextDestroyed

Issued when execution context is destroyed.

public event EventHandler<ExecutionContextDestroyedEventArgs>? ExecutionContextDestroyed

Event Type

EventHandler<ExecutionContextDestroyedEventArgs>

ExecutionContextsCleared

Issued when all executionContexts were cleared in browser

public event EventHandler<ExecutionContextsClearedEventArgs>? ExecutionContextsCleared

Event Type

EventHandler<ExecutionContextsClearedEventArgs>

InspectRequested

Issued when object should be inspected (for example, as a result of inspect() command line API call).

public event EventHandler<InspectRequestedEventArgs>? InspectRequested

Event Type

EventHandler<InspectRequestedEventArgs>