diff --git a/src/common/Target.ts b/src/common/Target.ts index 08400865..d36232e2 100644 --- a/src/common/Target.ts +++ b/src/common/Target.ts @@ -123,7 +123,7 @@ export class Target { /** * If the target is not of type `"page"` or `"background_page"`, returns `null`. */ - async page(): Promise { + async page(): Promise { if (this._isPageTargetCallback(this._targetInfo) && !this._pagePromise) { this._pagePromise = this._sessionFactory().then((client) => Page.create( @@ -135,7 +135,7 @@ export class Target { ) ); } - return this._pagePromise; + return (await this._pagePromise) ?? null; } /**