ExecutionContext class

The 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.
  • Extensions's content scripts create additional execution contexts.

Besides pages, execution contexts can be found in workers.

Constructors

ExecutionContext(Client client, ExecutionContextDescription context, DomWorld? world)

Properties

client → Client
final
context ExecutionContextDescription
final
domApi DOMApi
final
frame Frame?
Frame associated with this execution context.
no setter
hashCode int
The hash code for this object.
no setterinherited
pageApi PageApi
final
runtimeApi RuntimeApi
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
world → DomWorld?
final

Methods

adoptBackendNodeId(BackendNodeId backendNodeId) Future<ElementHandle>
adoptElementHandle(ElementHandle elementHandle) Future<ElementHandle>
evaluate<T>(String pageFunction, {List? args}) Future<T>
If the function passed to the executionContext.evaluate returns a Promise, then executionContext.evaluate would wait for the promise to resolve and return its value.
evaluateHandle<T extends JsHandle>(String pageFunction, {List? args}) Future<T>
The only difference between executionContext.evaluate and executionContext.evaluateHandle is that executionContext.evaluateHandle returns in-page object (JSHandle).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryObjects(JsHandle prototypeHandle) Future<JsHandle>
The method iterates the JavaScript heap and finds all the objects with the given prototype.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited