mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	This commit is contained in:
		
							parent
							
								
									ebf82b0854
								
							
						
					
					
						commit
						3d5f85d7e4
					
				@ -87,31 +87,15 @@ class BrowserTypeExamples
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## async method: BrowserType.connect
 | 
					## async method: BrowserType.connect
 | 
				
			||||||
* since: v1.8
 | 
					* since: v1.8
 | 
				
			||||||
* langs: js
 | 
					 | 
				
			||||||
- returns: <[Browser]>
 | 
					- returns: <[Browser]>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This method attaches Playwright to an existing browser instance created via [`method: BrowserType.launchServer`].
 | 
					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).
 | 
				
			||||||
 | 
					 | 
				
			||||||
:::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).
 | 
					 | 
				
			||||||
:::
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## async method: BrowserType.connect
 | 
					 | 
				
			||||||
* since: v1.8
 | 
					 | 
				
			||||||
* langs: python, csharp, java
 | 
					 | 
				
			||||||
- returns: <[Browser]>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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
 | 
					### param: BrowserType.connect.wsEndpoint
 | 
				
			||||||
* since: v1.10
 | 
					* since: v1.10
 | 
				
			||||||
- `wsEndpoint` <[string]>
 | 
					- `wsEndpoint` <[string]>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A Playwright browser websocket endpoint to connect to. You obtain this endpoint via [`method: BrowserServer.wsEndpoint`].
 | 
					A browser websocket endpoint to connect to.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### option: BrowserType.connect.headers
 | 
					### option: BrowserType.connect.headers
 | 
				
			||||||
* since: v1.11
 | 
					* since: v1.11
 | 
				
			||||||
@ -168,10 +152,6 @@ The default browser context is accessible via [`method: Browser.contexts`].
 | 
				
			|||||||
Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
 | 
					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**
 | 
					**Usage**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```js
 | 
					```js
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										34
									
								
								packages/playwright-core/types/types.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								packages/playwright-core/types/types.d.ts
									
									
									
									
										vendored
									
									
								
							@ -14554,11 +14554,6 @@ export interface BrowserType<Unused = {}> {
 | 
				
			|||||||
   *
 | 
					   *
 | 
				
			||||||
   * **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
 | 
					   * **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**
 | 
					   * **Usage**
 | 
				
			||||||
   *
 | 
					   *
 | 
				
			||||||
   * ```js
 | 
					   * ```js
 | 
				
			||||||
@ -14584,11 +14579,6 @@ export interface BrowserType<Unused = {}> {
 | 
				
			|||||||
   *
 | 
					   *
 | 
				
			||||||
   * **NOTE** Connecting over the Chrome DevTools Protocol is only supported for Chromium-based browsers.
 | 
					   * **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**
 | 
					   * **Usage**
 | 
				
			||||||
   *
 | 
					   *
 | 
				
			||||||
   * ```js
 | 
					   * ```js
 | 
				
			||||||
@ -14603,14 +14593,10 @@ export interface BrowserType<Unused = {}> {
 | 
				
			|||||||
   */
 | 
					   */
 | 
				
			||||||
  connectOverCDP(options: ConnectOverCDPOptions & { wsEndpoint?: string }): Promise<Browser>;
 | 
					  connectOverCDP(options: ConnectOverCDPOptions & { wsEndpoint?: string }): Promise<Browser>;
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * This method attaches Playwright to an existing browser instance created via
 | 
					   * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
 | 
				
			||||||
   * [browserType.launchServer([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server).
 | 
					   * `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).
 | 
				
			||||||
   * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
 | 
					   * @param wsEndpoint A browser websocket endpoint to connect to.
 | 
				
			||||||
   * 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()](https://playwright.dev/docs/api/class-browserserver#browser-server-ws-endpoint).
 | 
					 | 
				
			||||||
   * @param options
 | 
					   * @param options
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
 | 
					  connect(wsEndpoint: string, options?: ConnectOptions): Promise<Browser>;
 | 
				
			||||||
@ -14621,14 +14607,10 @@ export interface BrowserType<Unused = {}> {
 | 
				
			|||||||
   * @deprecated
 | 
					   * @deprecated
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * This method attaches Playwright to an existing browser instance created via
 | 
					   * This method attaches Playwright to an existing browser instance. When connecting to another browser launched via
 | 
				
			||||||
   * [browserType.launchServer([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server).
 | 
					   * `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).
 | 
				
			||||||
   * **NOTE** The major and minor version of the Playwright instance that connects needs to match the version of
 | 
					   * @param wsEndpoint A browser websocket endpoint to connect to.
 | 
				
			||||||
   * 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()](https://playwright.dev/docs/api/class-browserserver#browser-server-ws-endpoint).
 | 
					 | 
				
			||||||
   * @param options
 | 
					   * @param options
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;
 | 
					  connect(options: ConnectOptions & { wsEndpoint?: string }): Promise<Browser>;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user