Module

x/puppeteer/mod.ts>ExecutionContext

A port of puppeteer running on Deno
Latest
class ExecutionContext
Deprecated
Deprecated

Do not use directly.

Represents a context for JavaScript execution.

import { ExecutionContext } from "https://dotland.deno.dev/x/puppeteer@16.2.0/mod.ts";

Examples

A {@link Page} can have several execution contexts:

  • Each {@link Frame} of a {@link Page | page} has a "default" execution context that is always created after frame is attached to DOM. This context is returned by the {@link 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,
)

Properties

_client: CDPSession
_contextId: number
_contextName: string
optional
_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 {@link 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.

frame(): Frame | null
queryObjects<Prototype>(prototypeHandle: JSHandle<Prototype>): Promise<HandleFor<Prototype[]>>

Iterates through the JavaScript heap and finds all the objects with the given prototype.

import ExecutionContext
import { ExecutionContext } from "https://dotland.deno.dev/x/puppeteer@16.2.0/mod.ts";