diff --git a/packages/puppeteer-core/src/common/bidi/Connection.ts b/packages/puppeteer-core/src/common/bidi/Connection.ts index 80800d14fbb..2a5265abe2c 100644 --- a/packages/puppeteer-core/src/common/bidi/Connection.ts +++ b/packages/puppeteer-core/src/common/bidi/Connection.ts @@ -48,6 +48,10 @@ interface Commands { returnType: Bidi.Script.AddPreloadScriptResult; }; + 'browsingContext.activate': { + params: Bidi.BrowsingContext.ActivateParameters; + returnType: Bidi.EmptyResult; + }; 'browsingContext.create': { params: Bidi.BrowsingContext.CreateParameters; returnType: Bidi.BrowsingContext.CreateResult; diff --git a/packages/puppeteer-core/src/common/bidi/Page.ts b/packages/puppeteer-core/src/common/bidi/Page.ts index c26e72d370a..ffd439ebffe 100644 --- a/packages/puppeteer-core/src/common/bidi/Page.ts +++ b/packages/puppeteer-core/src/common/bidi/Page.ts @@ -712,6 +712,12 @@ export class Page extends PageBase { }); return new CDPSessionWrapper(this.mainFrame().context(), sessionId); } + + override async bringToFront(): Promise { + await this.#connection.send('browsingContext.activate', { + context: this.mainFrame()._id, + }); + } } function isConsoleLogEntry(