diff --git a/src/common/FrameManager.ts b/src/common/FrameManager.ts index c2639a956d3be..2b5aa7ddd5670 100644 --- a/src/common/FrameManager.ts +++ b/src/common/FrameManager.ts @@ -702,6 +702,11 @@ export class Frame { ); } + /** + * @remarks + * + * @returns `true` if the frame is an OOP frame, or `false` otherwise. + */ isOOPFrame(): boolean { return this._client !== this._frameManager._client; } @@ -785,6 +790,13 @@ export class Frame { return await this._frameManager.waitForFrameNavigation(this, options); } + /** + * @internal + */ + client(): CDPSession { + return this._client; + } + /** * @returns a promise that resolves to the frame's default execution context. */ diff --git a/test/frame.spec.ts b/test/frame.spec.ts index 29ae553a32392..45d19279b2c0e 100644 --- a/test/frame.spec.ts +++ b/test/frame.spec.ts @@ -22,6 +22,7 @@ import { setupTestPageAndContextHooks, itFailsFirefox, } from './mocha-utils'; // eslint-disable-line import/extensions +import { CDPSession } from '../lib/cjs/puppeteer/common/Connection.js'; describe('Frame specs', function () { setupTestBrowserHooks(); @@ -278,4 +279,11 @@ describe('Frame specs', function () { ); }); }); + + describe('Frame.client', function () { + it('should return the client instance', async () => { + const { page } = getTestState(); + expect(page.mainFrame().client()).toBeInstanceOf(CDPSession); + }); + }); }); diff --git a/utils/doclint/check_public_api/index.js b/utils/doclint/check_public_api/index.js index f1de72b2a011e..6ff6df38c5fca 100644 --- a/utils/doclint/check_public_api/index.js +++ b/utils/doclint/check_public_api/index.js @@ -24,6 +24,7 @@ const { const EXCLUDE_PROPERTIES = new Set([ 'Browser.create', + 'Frame.client', 'Headers.fromPayload', 'Page.client', 'Page.create',