You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/browser-rendering/platform/playwright.mdx
+13-22Lines changed: 13 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,12 @@ The current version of the Playwright is [**v1.55.0**](https://github.com/cloudf
28
28
29
29
## Use Playwright in a Worker
30
30
31
+
In this [example](https://github.com/cloudflare/playwright/tree/main/packages/playwright-cloudflare/examples/todomvc), you will run Playwright tests in a Cloudflare Worker using the [todomvc](https://demo.playwright.dev/todomvc) application.
32
+
33
+
If you want to skip the steps and get started quickly, select **Deploy to Cloudflare** below.
34
+
35
+
[](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/playwright/tree/main/packages/playwright-cloudflare/examples/todomvc)
36
+
31
37
Make sure you have the [browser binding](/browser-rendering/platform/wrangler/#bindings) configured in your `wrangler.toml` file:
32
38
33
39
<WranglerConfig>
@@ -36,13 +42,10 @@ Make sure you have the [browser binding](/browser-rendering/platform/wrangler/#b
36
42
name = "cloudflare-playwright-example"
37
43
main = "src/index.ts"
38
44
workers_dev = true
39
-
compatibility_flags = ["nodejs_compat_v2"]
40
-
compatibility_date = "2025-03-05"
45
+
compatibility_flags = ["nodejs_compat"]
46
+
compatibility_date = "2025-09-17"
41
47
upload_source_maps = true
42
48
43
-
[dev]
44
-
port = 9000
45
-
46
49
[browser]
47
50
binding = "MYBROWSER"
48
51
```
@@ -60,11 +63,7 @@ Let's look at some examples of how to use Playwright:
60
63
Using browser automation to take screenshots of web pages is a common use case. This script tells the browser to navigate to https://demo.playwright.dev/todomvc, create some items, take a screenshot of the page, and return the image in the response.
One of the most common use cases for using Playwright is software testing. Playwright includes test assertion features in its APIs; refer to [Assertions](https://playwright.dev/docs/test-assertions) in the Playwright documentation for details. Here's an example of a Worker doing `expect()` test assertions of the [todomvc](https://demo.playwright.dev/todomvc) demo page:
0 commit comments