import { ExecutionContext } from './execution-context'; import { CdpRemoteObject, RemoteExpression } from './types'; /** * Represents a reference to a remote object in JavaScript runtime of the page. * * Remote objects are returned as a result `evaluate` methods available on * `Page`, `Target`, `Frame`, `ExecutionContext` and `RemoteObject`. * * This API is considered low level: in most circumstances you'll will probably use * `evaluateJson` which returns JSON representation of a remote object * or more specific `evaluateElement` which returns `RemoteElement` * (a subclass of `RemoteObject`) with broader set of methods specific to HTML DOM elements. * * As per [CDP docs](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/) * Remote objects are retained in browser's memory and must be manually released * with `release`. Released object cannot be used and will result in exceptions * thrown by CDP. Reloading the page or frame also releases all the objects * and makes all references invalid. * * @public */ export declare class RemoteObject { readonly executionContext: ExecutionContext; readonly cdpRemoteObject: CdpRemoteObject; /** * Creates a new RemoteObject instance. Should not be called directly, * unless you obtain a CDP remote object reference manually * (e.g. via `page.send`) * * @param executionContext Execution context this object belongs to. * @param cdpRemoteObject CDP [RemoteObject](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject) * @internal */ constructor(executionContext: ExecutionContext, cdpRemoteObject: CdpRemoteObject); /** * @returns Frame this object belongs to. * @public */ get frame(): import("./frame").Frame; /** * @returns Page this object belongs to. * @public */ get page(): import("./page").Page; /** * @returns Whether the object is `null` or `undefined`. * @public */ isNull(): boolean; /** * Evaluates `pageFn` in the same execution context as this object and returns `RemoteObject`. * This object is passed as `pageFn`'s first argument. * * @param pageFn Function to execute in page context. * @param args Array of additional arguments that will be available in `pageFn`. * @public */ evaluate(pageFn: RemoteExpression, ...args: any[]): Promise; /** * Evaluates `pageFn` in the same execution context as this object and returns `RemoteElement`. * This object is passed as `pageFn`'s first argument, `pageFn` is expected to return a reference * to DOM node. * * @param pageFn Function to execute in page context. * @param args Array of additional arguments that will be available in `pageFn`. * @public */ evaluateElement(pageFn: RemoteExpression, ...args: any[]): Promise; /** * Evaluates `pageFn` in the same execution context as this object and returns `RemoteElement`. * This object is passed as `pageFn`'s first argument, `pageFn` is expected to return * a reference to `NodeList` or any kind of enumerable of DOM nodes. * * @param pageFn Function to execute in page context. * @param args Array of additional arguments that will be available in `pageFn`. */ evaluateElementList(pageFn: RemoteExpression, ...args: any[]): Promise; /** * Evaluates `pageFn` in the same execution context as this object and returns * a JSON-serialized value of `pageFn` result. * This object is passed as `pageFn`'s first argument. * * Note: most runtime objects are not JSON-serializable. These include all DOM nodes * and classes like Date, RegExp, etc. * * @param pageFn Function to execute * @param args Array of additional arguments that will be available in `pageFn`. */ evaluateJson(pageFn: RemoteExpression, ...args: any[]): Promise; /** * Converts this remote object reference into its JSON representation. * This allows working with object in engine runtime, but only applies * to JSON-serializable values. */ jsonValue(): Promise; /** * Returns a key-value map of this object's properties. */ getOwnProperties(): Promise>; /** * Releases this object reference, so that the page can garbage collect it. * * After releasing, working with this instance is no longer possible. */ release(): Promise; } //# sourceMappingURL=remote-object.d.ts.map