Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: disable page.pause() when JS debugger is attached (#11926)

Pavel Feldmandbd124d84b73
diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.ts
index 0558dbb8a7..cda775ada8 100644
--- a/packages/playwright-core/src/client/page.ts
+++ b/packages/playwright-core/src/client/page.ts
@@ -644,7 +644,10 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
}
async pause() {
- await this.context()._channel.pause();
+ if (!!require('inspector').url())
+ debugger; // eslint-disable-line no-debugger
+ else
+ await this.context()._channel.pause();
}
async pdf(options: PDFOptions = {}): Promise<Buffer> {
diff --git a/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts b/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts
index f3d9baf9bf..738a228ce5 100644
--- a/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts
+++ b/packages/playwright-core/src/dispatchers/browserContextDispatcher.ts
@@ -179,7 +179,7 @@ export class BrowserContextDispatcher extends Dispatcher<BrowserContext, channel
}
async pause(params: channels.BrowserContextPauseParams, metadata: CallMetadata) {
- // Inspector controller will take care of this.
+ // Debugger will take care of this.
}
async newCDPSession(params: channels.BrowserContextNewCDPSessionParams): Promise<channels.BrowserContextNewCDPSessionResult> {