RuntimeClientEvaluateAsync Method |
Version 130.1.90
Evaluates expression on global object.
Namespace: CefSharp.DevTools.RuntimeAssembly: CefSharp.Core (in CefSharp.Core.dll) Version: 129.0.110.0
Syntax public Task<EvaluateResponse> EvaluateAsync(
string expression,
string objectGroup = null,
bool? includeCommandLineAPI = null,
bool? silent = null,
int? contextId = null,
bool? returnByValue = null,
bool? generatePreview = null,
bool? userGesture = null,
bool? awaitPromise = null,
bool? throwOnSideEffect = null,
double? timeout = null,
bool? disableBreaks = null,
bool? replMode = null,
bool? allowUnsafeEvalBlockedByCSP = null,
string uniqueContextId = null,
SerializationOptions serializationOptions = null
)
public:
Task<EvaluateResponse^>^ EvaluateAsync(
String^ expression,
String^ objectGroup = nullptr,
Nullable<bool> includeCommandLineAPI = nullptr,
Nullable<bool> silent = nullptr,
Nullable<int> contextId = nullptr,
Nullable<bool> returnByValue = nullptr,
Nullable<bool> generatePreview = nullptr,
Nullable<bool> userGesture = nullptr,
Nullable<bool> awaitPromise = nullptr,
Nullable<bool> throwOnSideEffect = nullptr,
Nullable<double> timeout = nullptr,
Nullable<bool> disableBreaks = nullptr,
Nullable<bool> replMode = nullptr,
Nullable<bool> allowUnsafeEvalBlockedByCSP = nullptr,
String^ uniqueContextId = nullptr,
SerializationOptions^ serializationOptions = nullptr
)
Parameters
- expression String
- Expression to evaluate.
- objectGroup String (Optional)
- Symbolic group name that can be used to release multiple objects.
- includeCommandLineAPI NullableBoolean (Optional)
- Determines whether Command Line API should be available during the evaluation.
- silent NullableBoolean (Optional)
- In silent mode exceptions thrown during evaluation are not reported and do not pauseexecution. Overrides `setPauseOnException` state.
- contextId NullableInt32 (Optional)
- Specifies in which execution context to perform evaluation. If the parameter is omitted theevaluation will be performed in the context of the inspected page.This is mutually exclusive with `uniqueContextId`, which offers analternative way to identify the execution context that is more reliablein a multi-process environment.
- returnByValue NullableBoolean (Optional)
- Whether the result is expected to be a JSON object that should be sent by value.
- generatePreview NullableBoolean (Optional)
- Whether preview should be generated for the result.
- userGesture NullableBoolean (Optional)
- Whether execution should be treated as initiated by user in the UI.
- awaitPromise NullableBoolean (Optional)
- Whether execution should `await` for resulting value and return once awaited promise isresolved.
- throwOnSideEffect NullableBoolean (Optional)
- Whether to throw an exception if side effect cannot be ruled out during evaluation.This implies `disableBreaks` below.
- timeout NullableDouble (Optional)
- Terminate execution after timing out (number of milliseconds).
- disableBreaks NullableBoolean (Optional)
- Disable breakpoints during execution.
- replMode NullableBoolean (Optional)
- 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.
- allowUnsafeEvalBlockedByCSP NullableBoolean (Optional)
- 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 thisevaluation and allows unsafe-eval. Defaults to true.
- uniqueContextId String (Optional)
- An alternative way to specify the execution context to evaluate in.Compared to contextId that may be reused across processes, this is guaranteed to besystem-unique, so it can be used to prevent accidental evaluation of the expressionin context different than intended (e.g. as a result of navigation across processboundaries).This is mutually exclusive with `contextId`.
- serializationOptions SerializationOptions (Optional)
- Specifies the result serialization. If provided, overrides`generatePreview` and `returnByValue`.
Return Value
TaskEvaluateResponsereturns System.Threading.Tasks.Task<EvaluateResponse>
See Also