Interface IExecutionContext
- Namespace
- PuppeteerSharp
- Assembly
- PuppeteerSharp.dll
The class represents a context for JavaScript execution. Examples of JavaScript contexts are: Each Frame has a separate IExecutionContext All kind of web workers have their own contexts.
public interface IExecutionContext
Properties
Frame
Frame associated with this execution context.
IFrame Frame { get; }
Property Value
Remarks
NOTE Not every execution context is associated with a frame. For example, workers and extensions have execution contexts that are not associated with frames.
Methods
EvaluateExpressionAsync(string)
Executes a script in browser context.
Task<JsonElement?> EvaluateExpressionAsync(string script)
Parameters
script
stringScript to be evaluated in browser context.
Returns
- Task<JsonElement?>
Task which resolves to script return value.
Remarks
If the script, returns a Promise, then the method would wait for the promise to resolve and return its value.
- See Also
EvaluateExpressionAsync<T>(string)
Executes a script in browser context.
Task<T> EvaluateExpressionAsync<T>(string script)
Parameters
script
stringScript to be evaluated in browser context.
Returns
- Task<T>
Task which resolves to script return value.
Type Parameters
T
The type to deserialize the result to.
Remarks
If the script, returns a Promise, then the method would wait for the promise to resolve and return its value.
- See Also
EvaluateExpressionHandleAsync(string)
Executes a script in browser context.
Task<IJSHandle> EvaluateExpressionHandleAsync(string script)
Parameters
script
stringScript to be evaluated in browser context.
Returns
Remarks
If the script, returns a Promise, then the method would wait for the promise to resolve and return its value.
EvaluateFunctionAsync(string, params object[])
Executes a function in browser context.
Task<JsonElement?> EvaluateFunctionAsync(string script, params object[] args)
Parameters
Returns
- Task<JsonElement?>
Task which resolves to script return value.
Remarks
If the script, returns a Promise, then the method would wait for the promise to resolve and return its value. IJSHandle instances can be passed as arguments.
- See Also
EvaluateFunctionAsync<T>(string, params object[])
Executes a function in browser context.
Task<T> EvaluateFunctionAsync<T>(string script, params object[] args)
Parameters
Returns
- Task<T>
Task which resolves to script return value.
Type Parameters
T
The type to deserialize the result to.
Remarks
If the script, returns a Promise, then the method would wait for the promise to resolve and return its value. IJSHandle instances can be passed as arguments.
- See Also
EvaluateFunctionHandleAsync(string, params object[])
Executes a script in browser context.
Task<IJSHandle> EvaluateFunctionHandleAsync(string pageFunction, params object[] args)
Parameters
Returns
Remarks
If the script, returns a Promise, then the method would wait for the promise to resolve and return its value. IJSHandle instances can be passed as arguments.