runScript method
Runs script with given id in a given context.
scriptId
Id of the script to run.
executionContextId
Specifies in which execution context to perform script run. If the parameter is omitted the
evaluation will be performed in the context of the inspected page.
objectGroup
Symbolic group name that can be used to release multiple objects.
silent
In silent mode exceptions thrown during evaluation are not reported and do not pause
execution. Overrides setPauseOnException
state.
includeCommandLineAPI
Determines whether Command Line API should be available during the evaluation.
returnByValue
Whether the result is expected to be a JSON object which should be sent by value.
generatePreview
Whether preview should be generated for the result.
awaitPromise
Whether execution should await
for resulting value and return once awaited promise is
resolved.
Implementation
Future<RunScriptResult> runScript(ScriptId scriptId,
{ExecutionContextId? executionContextId,
String? objectGroup,
bool? silent,
bool? includeCommandLineAPI,
bool? returnByValue,
bool? generatePreview,
bool? awaitPromise}) async {
var result = await _client.send('Runtime.runScript', {
'scriptId': scriptId,
if (executionContextId != null) 'executionContextId': executionContextId,
if (objectGroup != null) 'objectGroup': objectGroup,
if (silent != null) 'silent': silent,
if (includeCommandLineAPI != null)
'includeCommandLineAPI': includeCommandLineAPI,
if (returnByValue != null) 'returnByValue': returnByValue,
if (generatePreview != null) 'generatePreview': generatePreview,
if (awaitPromise != null) 'awaitPromise': awaitPromise,
});
return RunScriptResult.fromJson(result);
}