diff --git a/packages/puppeteer-core/src/cdp/ChromeTargetManager.ts b/packages/puppeteer-core/src/cdp/ChromeTargetManager.ts index e87d71fff91..ab22a0a1d13 100644 --- a/packages/puppeteer-core/src/cdp/ChromeTargetManager.ts +++ b/packages/puppeteer-core/src/cdp/ChromeTargetManager.ts @@ -122,10 +122,15 @@ export class ChromeTargetManager this, undefined ); + // Targets that will not be auto-attached. Therefore, we should + // not add them to #targetsIdsForInit. + const skipTarget = + targetInfo.type === 'browser' || + targetInfo.url.startsWith('chrome-extension://'); if ( (!this.#targetFilterCallback || this.#targetFilterCallback(targetForFilter)) && - targetInfo.type !== 'browser' + !skipTarget ) { this.#targetsIdsForInit.add(targetId); }