> ## Documentation Index
> Fetch the complete documentation index at: https://docs.driver.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Playwright

> Stock Playwright connects to Driver over CDP but carries fingerprints that get sessions blocked. Prefer Patchright.

> [!WARNING]
>
> Stock Playwright issues CDP commands anti-bot systems detect (`Runtime.enable` and its bookkeeping hooks), and protected sites block the session. Use [Patchright](https://docs.driver.dev/docs/frameworks/patchright.md): same API, one import change.

If you've measured that your targets don't care, stock Playwright works unchanged:

```typescript TypeScript theme={"dark"}
import { chromium } from "playwright";

const browser = await chromium.connectOverCDP(session.cdpUrl);
const context = browser.contexts()[0] ?? (await browser.newContext());
const page = context.pages()[0] ?? (await context.newPage());
await page.goto("https://example.com");
console.log(await page.title());
await browser.close();
```

```python Python theme={"dark"}
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp(session["cdpUrl"])
    context = browser.contexts[0] if browser.contexts else browser.new_context()
    page = context.pages[0] if context.pages else context.new_page()
    page.goto("https://example.com")
    print(page.title())
    browser.close()
```

Install with `npm install playwright` or `pip install playwright`. Don't run `playwright install`; the browser is Driver's.

## Everything else

Contexts, tabs, disconnecting versus stopping, reconnecting and timeouts work the same as with Patchright. See [Connect over CDP](https://docs.driver.dev/docs/sessions/connect.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.