diff --git a/docs/api/puppeteer.webworker.md b/docs/api/puppeteer.webworker.md index d0f683ff..3723f438 100644 --- a/docs/api/puppeteer.webworker.md +++ b/docs/api/puppeteer.webworker.md @@ -36,6 +36,12 @@ for (const worker of page.workers()) { } ``` +## Properties + +| Property | Modifiers | Type | Description | +| -------- | --------------------- | --------------------------------------- | ------------------------------------------------ | +| client | readonly | [CDPSession](./puppeteer.cdpsession.md) | The CDP session client the WebWorker belongs to. | + ## Methods | Method | Modifiers | Description | diff --git a/packages/puppeteer-core/src/common/WebWorker.ts b/packages/puppeteer-core/src/common/WebWorker.ts index d4265741..fface119 100644 --- a/packages/puppeteer-core/src/common/WebWorker.ts +++ b/packages/puppeteer-core/src/common/WebWorker.ts @@ -122,6 +122,13 @@ export class WebWorker extends EventEmitter { return this.#url; } + /** + * The CDP session client the WebWorker belongs to. + */ + get client(): CDPSession { + return this.#client; + } + /** * If the function passed to the `worker.evaluate` returns a Promise, then * `worker.evaluate` would wait for the promise to resolve and return its