Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pptr/mod.ts>ExecutionContext

Headless Chrome Deno API
Latest
class ExecutionContext
Re-export
import { ExecutionContext } from "https://deno.land/x/pptr@1.2.0/mod.ts";

This class represents a context for JavaScript execution. A [Page] might have many execution contexts:

  • each frame has "default" execution context that is always created after frame is attached to DOM. This context is returned by the frame.executionContext() method.
  • Extension's content scripts create additional execution contexts.

Besides pages, execution contexts can be found in workers.

Constructors

new
ExecutionContext()

Properties

_client: CDPSession
_contextId: number
_world: DOMWorld

Methods

private
_evaluateInternal<ReturnType>(
returnByValue: boolean,
pageFunction: Function | string,
...args: unknown[],
): Promise<ReturnType>
evaluate<ReturnType extends any>(pageFunction: Function | string, ...args: unknown[]): Promise<ReturnType>
evaluateHandle<HandleType extends JSHandle | ElementHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandleType>
frame(): Frame | null
queryObjects(prototypeHandle: JSHandle): Promise<JSHandle>

This method iterates the JavaScript heap and finds all the objects with the given prototype.