mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat: export Frame._client
through getter (#8041)
Co-authored-by: Randolf Jung <jrandolf@chromium.org>
This commit is contained in:
parent
c5e01efdef
commit
e9278fcfcf
@ -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.
|
||||
*/
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -24,6 +24,7 @@ const {
|
||||
|
||||
const EXCLUDE_PROPERTIES = new Set([
|
||||
'Browser.create',
|
||||
'Frame.client',
|
||||
'Headers.fromPayload',
|
||||
'Page.client',
|
||||
'Page.create',
|
||||
|
Loading…
Reference in New Issue
Block a user