Skip to content

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

Revert "Revert "chore(docs): clarify connection method via BrowserType.connect (#34560)" (#34594)" (#34595)

Adam Gastineau5996a0df0aa5
diff --git a/docs/src/api/class-browsertype.md b/docs/src/api/class-browsertype.md
index 0d41bb1aa7..29c323f002 100644
--- a/docs/src/api/class-browsertype.md
+++ b/docs/src/api/class-browsertype.md
@@ -89,13 +89,17 @@ class BrowserTypeExamples
* since: v1.8
- returns: <[Browser]>
-This method attaches Playwright to an existing browser instance. When connecting to another browser launched via `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
+This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
+
+:::note
+The major and minor version of the Playwright instance that connects needs to match the version of Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
+:::
### param: BrowserType.connect.wsEndpoint
* since: v1.10
- `wsEndpoint` <[string]>
-A browser websocket endpoint to connect to.
+A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
### option: BrowserType.connect.headers
* since: v1.11
@@ -152,6 +156,10 @@ The default browser context is accessible via [`method: Browser.contexts`].
Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
:::
+:::note
+This connection is significantly lower fidelity than the Playwright protocol connection via [`method: BrowserType.connect`]. If you are experiencing issues or attempting to use advanced functionality, you probably want to use [`method: BrowserType.connect`].
+:::
+
**Usage**
```js
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index a841123461..a150fdacd6 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -14554,6 +14554,11 @@ export interface BrowserType<Unused = {}> {
*
* **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
*
+ * **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
+ * If you are experiencing issues or attempting to use advanced functionality, you probably want to use
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
+ *
* **Usage**
*
* ```js
@@ -14579,6 +14584,11 @@ export interface BrowserType<Unused = {}> {
*
* **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
*
+ * **NOTE** This connection is significantly lower fidelity than the Playwright protocol connection via
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
+ * If you are experiencing issues or attempting to use advanced functionality, you probably want to use
+ * [browserType.connect(wsEndpoint[, options])](https://playwright.dev/docs/api/class-browsertype#browser-type-connect).
+ *
* **Usage**
*
* ```js
@@ -14593,10 +14603,12 @@ export interface BrowserType<Unused = {}> {
*/
connectOverCDP(options: ConnectOverCDPOptions & { wsEndpoint?: string }): Promise<Browser>;
/**
- * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
- * `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
- * compatible with 1.2.x).
- * @param wsEndpoint A browser websocket endpoint to connect to.
+ * This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
+ *
+ * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
+ * Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
+ *
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
* @param options
*/
connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
@@ -14607,10 +14619,12 @@ export interface BrowserType<Unused = {}> {
* @deprecated
*/
/**
- * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
- * `BrowserType.launchServer` in Node.js, the major and minor version needs to match the client version (1.2.3 → is
- * compatible with 1.2.x).
- * @param wsEndpoint A browser websocket endpoint to connect to.
+ * This method attaches Playwright to an existing browser instance created via `BrowserType.launchServer` in Node.js.
+ *
+ * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
+ * Playwright that launches the browser (1.2.3 → is compatible with 1.2.x).
+ *
+ * @param wsEndpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via `BrowserServer.wsEndpoint`.
* @param options
*/
connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;