Deprecated
Do not use directly.
Represents a context for JavaScript execution.
import { ExecutionContext } from "https://deno.land/x/frugal@0.9.6/dep/puppeteer/mod.ts";
Examples
A Page can have several execution contexts:
A Page can have several execution contexts:
- Each Frame of a Page | page has a "default" execution context that is always created after frame is attached to DOM. This context is returned by the Frame.executionContext method.
- Each Chrome extensions creates additional execution contexts to isolate their code.
Constructors
new
ExecutionContext(client: CDPSession,
contextPayload: Protocol.Runtime.ExecutionContextDescription,
world?: IsolatedWorld,
Methods
evaluate<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>
Evaluates the given function.
evaluateHandle<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>
Evaluates the given function.
Unlike ExecutionContext.evaluate | evaluate, this method returns a handle to the result of the function.
This method may be better suited if the object cannot be serialized (e.g.
Map
) and requires further manipulation.
queryObjects<Prototype>(prototypeHandle: JSHandle<Prototype>): Promise<HandleFor<Prototype[]>>
Iterates through the JavaScript heap and finds all the objects with the given prototype.