@@ -168,14 +168,17 @@ Type `Optional[str]`, default `None`
168168The endpoint of a remote Chromium browser to connect using the
169169[ Chrome DevTools Protocol] ( https://chromedevtools.github.io/devtools-protocol/ ) ,
170170via [ ` BrowserType.connect_over_cdp ` ] ( https://playwright.dev/python/docs/api/class-browsertype#browser-type-connect-over-cdp ) .
171+
172+ ``` python
173+ PLAYWRIGHT_CDP_URL = " http://localhost:9222"
174+ ```
175+
171176If this setting is used:
172177* all non-persistent contexts will be created on the connected remote browser
173178* the ` PLAYWRIGHT_LAUNCH_OPTIONS ` setting is ignored
174179* the ` PLAYWRIGHT_BROWSER_TYPE ` setting must not be set to a value different than "chromium"
175180
176- ``` python
177- PLAYWRIGHT_CDP_URL = " http://localhost:9222"
178- ```
181+ ** This settings CANNOT be used at the same time as ` PLAYWRIGHT_CONNECT_URL ` **
179182
180183### ` PLAYWRIGHT_CDP_KWARGS `
181184Type ` dict[str, Any] ` , default ` {} `
@@ -192,6 +195,41 @@ PLAYWRIGHT_CDP_KWARGS = {
192195}
193196```
194197
198+ ### ` PLAYWRIGHT_CONNECT_URL `
199+ Type ` Optional[str] ` , default ` None `
200+
201+ URL of a remote Playwright browser instance to connect using
202+ [ ` BrowserType.connect ` ] ( https://playwright.dev/python/docs/api/class-browsertype#browser-type-connect ) .
203+
204+ From the upstream Playwright docs:
205+ > When connecting to another browser launched via
206+ > [ ` BrowserType.launchServer ` ] ( https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server )
207+ > in Node.js, the major and minor version needs to match the client version (1.2.3 → is compatible with 1.2.x).
208+
209+ ``` python
210+ PLAYWRIGHT_CONNECT_URL = " ws://localhost:35477/ae1fa0bc325adcfd9600d9f712e9c733"
211+ ```
212+
213+ If this setting is used:
214+ * all non-persistent contexts will be created on the connected remote browser
215+ * the ` PLAYWRIGHT_LAUNCH_OPTIONS ` setting is ignored
216+
217+ ** This settings CANNOT be used at the same time as ` PLAYWRIGHT_CDP_URL ` **
218+
219+ ### ` PLAYWRIGHT_CONNECT_KWARGS `
220+ Type ` dict[str, Any] ` , default ` {} `
221+
222+ Additional keyword arguments to be passed to
223+ [ ` BrowserType.connect ` ] ( https://playwright.dev/python/docs/api/class-browsertype#browser-type-connect )
224+ when using ` PLAYWRIGHT_CONNECT_URL ` . The ` ws_endpoint ` key is always ignored,
225+ ` PLAYWRIGHT_CONNECT_URL ` is used instead.
226+
227+ ``` python
228+ PLAYWRIGHT_CONNECT_KWARGS = {
229+ " slow_mo" : 1000 ,
230+ " timeout" : 10 * 1000
231+ }
232+ ```
195233
196234### ` PLAYWRIGHT_CONTEXTS `
197235Type ` dict[str, dict] ` , default ` {} `
0 commit comments