mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #45745 [puppeteer] Fixed return type for Frame.executionContext and ExecutionContext.queryObjects by @timocov
- Frame.executionContext returns a Promise - ExecutionContext.queryObjects returns a Promise
This commit is contained in:
parent
58752d5aff
commit
eaaf689a26
4
types/puppeteer/index.d.ts
vendored
4
types/puppeteer/index.d.ts
vendored
@ -863,7 +863,7 @@ export interface ElementHandle<E extends Element = Element> extends JSHandle<E>,
|
||||
|
||||
/** The class represents a context for JavaScript execution. */
|
||||
export interface ExecutionContext extends JSEvalable {
|
||||
queryObjects(prototypeHandle: JSHandle): JSHandle;
|
||||
queryObjects(prototypeHandle: JSHandle): Promise<JSHandle>;
|
||||
}
|
||||
|
||||
/** JSHandle represents an in-page JavaScript object. */
|
||||
@ -1280,7 +1280,7 @@ export interface FrameBase extends Evalable, JSEvalable {
|
||||
export interface Frame extends FrameBase {
|
||||
childFrames(): Frame[];
|
||||
/** Execution context associated with this frame. */
|
||||
executionContext(): ExecutionContext;
|
||||
executionContext(): Promise<ExecutionContext>;
|
||||
/** Returns `true` if the frame has been detached, or `false` otherwise. */
|
||||
isDetached(): boolean;
|
||||
/** Returns frame's name attribute as specified in the tag. */
|
||||
|
||||
@ -707,3 +707,17 @@ puppeteer.launch().then(async browser => {
|
||||
|
||||
const selected: string[] = await elementHandle.select('a', 'b', 'c');
|
||||
})();
|
||||
|
||||
// .executionContext on Frame, and ExecutionContext.queryObjects
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch();
|
||||
const page = await browser.newPage();
|
||||
|
||||
const frame = page.mainFrame();
|
||||
frame.executionContext().then(() => {});
|
||||
|
||||
const context = await frame.executionContext();
|
||||
|
||||
const queryObjectsRes = context.queryObjects(await context.evaluateHandle(() => {}));
|
||||
queryObjectsRes.then(() => {});
|
||||
})();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user