diff --git a/packages/puppeteer-core/src/common/bidi/BrowsingContext.ts b/packages/puppeteer-core/src/common/bidi/BrowsingContext.ts index 597b281a..35018ea6 100644 --- a/packages/puppeteer-core/src/common/bidi/BrowsingContext.ts +++ b/packages/puppeteer-core/src/common/bidi/BrowsingContext.ts @@ -270,6 +270,12 @@ export class BrowsingContext extends EventEmitter { this.removeAllListeners(); this.connection.unregisterBrowsingContexts(this.#id); } + + title(): Promise { + return this.evaluate(() => { + return document.title; + }); + } } /** diff --git a/packages/puppeteer-core/src/common/bidi/Frame.ts b/packages/puppeteer-core/src/common/bidi/Frame.ts index 47bda108..75254aac 100644 --- a/packages/puppeteer-core/src/common/bidi/Frame.ts +++ b/packages/puppeteer-core/src/common/bidi/Frame.ts @@ -111,6 +111,10 @@ export class Frame extends BaseFrame { return this.#context.content(); } + override title(): Promise { + return this.#context.title(); + } + context(): BrowsingContext { return this.#context; } diff --git a/packages/puppeteer-core/src/common/bidi/Page.ts b/packages/puppeteer-core/src/common/bidi/Page.ts index 8e635aee..f1b849cf 100644 --- a/packages/puppeteer-core/src/common/bidi/Page.ts +++ b/packages/puppeteer-core/src/common/bidi/Page.ts @@ -496,6 +496,10 @@ export class Page extends PageBase { this.#closedDeferred.valueOrThrow() ); } + + override title(): Promise { + return this.mainFrame().title(); + } } function isConsoleLogEntry(