Skip to content

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

feat(browserType): throw on remote connectOverCDP(transport) (#40997)

Simon Knott74fc94e67c3a
diff --git a/packages/playwright-core/src/client/browserType.ts b/packages/playwright-core/src/client/browserType.ts
index 5cbc931d71..436f16eb55 100644
--- a/packages/playwright-core/src/client/browserType.ts
+++ b/packages/playwright-core/src/client/browserType.ts
@@ -168,6 +168,8 @@ export class BrowserType extends ChannelOwner<channels.BrowserTypeChannel> imple
async _connectOverCDPTransport(transport: api.ConnectionTransport): Promise<Browser> {
if (this.name() !== 'chromium')
throw new Error('Connecting over CDP is only supported in Chromium.');
+ if (this._connection.isRemote())
+ throw new Error('Passing a ConnectionTransport to connectOverCDP is not supported when connecting remotely.');
const result = await this._channel.connectOverCDPTransport({ transport: transport as any });
return await this._browserFromConnectResult(result);
}