open-index/open-npm huggingface dataset:
npm package: @szymonrybczak/patchright-cloudflare
Description: Patchright for Cloudflare Workers
Author: Cloudflare, patched by github.com/Kaliiiiiiiiii-Vinyzu/
Latest version: 0.0.14

# patchright-cloudflare

Patchright for Cloudflare Workers. This package enables using [Patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright-nodejs) with [Cloudflare Browser Rendering](https://developers.cloudflare.com/browser-rendering/).

## Installation

```bash
npm install @szymonrybczak/patchright-cloudflare
```

## Usage

```typescript
import { launch } from '@szymonrybczak/patchright-cloudflare';

export default {
  async fetch(request, env) {
    const browser = await launch(env.MYBROWSER);
    const page = await browser.newPage();
    await page.goto('https://example.com');
    const title = await page.title();
    await browser.close();
    return new Response(title);
  }
};
```

## Configuration

Add to your `wrangler.toml`:

```toml
compatibility_flags = [ "nodejs_compat" ]
browser = { binding = "MYBROWSER" }
```