Table of Contents

Class EvaluateCommandSettings

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

Evaluates expression on global object.

public sealed class EvaluateCommandSettings : ICommand
Inheritance
EvaluateCommandSettings
Implements
Inherited Members

Properties

AllowUnsafeEvalBlockedByCSP

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.

[JsonPropertyName("allowUnsafeEvalBlockedByCSP")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? AllowUnsafeEvalBlockedByCSP { get; set; }

Property Value

bool?

AwaitPromise

Whether execution should await for resulting value and return once awaited promise is resolved.

[JsonPropertyName("awaitPromise")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? AwaitPromise { get; set; }

Property Value

bool?

CommandName

Gets the name of the command.

[JsonIgnore]
public string CommandName { get; }

Property Value

string

ContextId

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 with uniqueContextId, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.

[JsonPropertyName("contextId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public long? ContextId { get; set; }

Property Value

long?

DisableBreaks

Disable breakpoints during execution.

[JsonPropertyName("disableBreaks")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? DisableBreaks { get; set; }

Property Value

bool?

Expression

Expression to evaluate.

[JsonPropertyName("expression")]
public string Expression { get; set; }

Property Value

string

GeneratePreview

Whether preview should be generated for the result.

[JsonPropertyName("generatePreview")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? GeneratePreview { get; set; }

Property Value

bool?

IncludeCommandLineAPI

Determines whether Command Line API should be available during the evaluation.

[JsonPropertyName("includeCommandLineAPI")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? IncludeCommandLineAPI { get; set; }

Property Value

bool?

ObjectGroup

Symbolic group name that can be used to release multiple objects.

[JsonPropertyName("objectGroup")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? ObjectGroup { get; set; }

Property Value

string

ReplMode

Setting this flag to true enables let re-declaration and top-level await. Note that let variables can only be re-declared if they originate from replMode themselves.

[JsonPropertyName("replMode")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? ReplMode { get; set; }

Property Value

bool?

ReturnByValue

Whether the result is expected to be a JSON object that should be sent by value.

[JsonPropertyName("returnByValue")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? ReturnByValue { get; set; }

Property Value

bool?

SerializationOptions

Specifies the result serialization. If provided, overrides generatePreview and returnByValue.

[JsonPropertyName("serializationOptions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public SerializationOptions? SerializationOptions { get; set; }

Property Value

SerializationOptions

Silent

In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.

[JsonPropertyName("silent")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? Silent { get; set; }

Property Value

bool?

ThrowOnSideEffect

Whether to throw an exception if side effect cannot be ruled out during evaluation. This implies disableBreaks below.

[JsonPropertyName("throwOnSideEffect")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? ThrowOnSideEffect { get; set; }

Property Value

bool?

Timeout

Terminate execution after timing out (number of milliseconds).

[JsonPropertyName("timeout")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public double? Timeout { get; set; }

Property Value

double?

UniqueContextId

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 with contextId.

[JsonPropertyName("uniqueContextId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? UniqueContextId { get; set; }

Property Value

string

UserGesture

Whether execution should be treated as initiated by user in the UI.

[JsonPropertyName("userGesture")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool? UserGesture { get; set; }

Property Value

bool?