Skip to content

Commit 65aab1e

Browse files
feat(roll): roll to ToT Playwright (31-03-26) (#1999)
1 parent 2e3c304 commit 65aab1e

18 files changed

Lines changed: 696 additions & 66 deletions

dotnet/docs/api/class-browser.mdx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,40 @@ await browser.CloseAsync();
2525

2626
## Methods
2727

28+
### BindAsync {#browser-bind}
29+
30+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>browser.BindAsync</x-search>
31+
32+
Binds the browser to a named pipe or web socket, making it available for other clients to connect to.
33+
34+
**Usage**
35+
36+
```csharp
37+
await Browser.BindAsync(title, options);
38+
```
39+
40+
**Arguments**
41+
- `title` [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-title"/><a href="#browser-bind-option-title" class="list-anchor">#</a>
42+
43+
Title of the browser server, used for identification.
44+
- `options` `BrowserBindOptions?` *(optional)*
45+
- `Host` [string]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-host"/><a href="#browser-bind-option-host" class="list-anchor">#</a>
46+
47+
Host to bind the web socket server to. When specified, a web socket server is created instead of a named pipe.
48+
- `Port` [int]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-port"/><a href="#browser-bind-option-port" class="list-anchor">#</a>
49+
50+
Port to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. Use `0` to let the OS pick an available port.
51+
- `WorkspaceDir` [string]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-workspace-dir"/><a href="#browser-bind-option-workspace-dir" class="list-anchor">#</a>
52+
53+
Working directory associated with this browser server.
54+
55+
**Returns**
56+
- Bind<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-return"/><a href="#browser-bind-return" class="list-anchor">#</a>
57+
- `endpoint` [string]
58+
59+
60+
---
61+
2862
### BrowserType {#browser-browser-type}
2963

3064
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.23</font><x-search>browser.BrowserType</x-search>
@@ -587,6 +621,23 @@ await Browser.NewPageAsync(options);
587621

588622
---
589623

624+
### UnbindAsync {#browser-unbind}
625+
626+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>browser.UnbindAsync</x-search>
627+
628+
Unbinds the browser server previously bound with [Browser.BindAsync()](/api/class-browser.mdx#browser-bind).
629+
630+
**Usage**
631+
632+
```csharp
633+
await Browser.UnbindAsync();
634+
```
635+
636+
**Returns**
637+
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-unbind-return"/><a href="#browser-unbind-return" class="list-anchor">#</a>
638+
639+
---
640+
590641
### Version {#browser-version}
591642

592643
<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>browser.Version</x-search>

dotnet/docs/api/class-screencast.mdx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ Interface for capturing screencast frames from a page.
1414

1515
## Methods
1616

17+
### HideActionsAsync {#screencast-hide-actions}
18+
19+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.HideActionsAsync</x-search>
20+
21+
Removes action decorations.
22+
23+
**Usage**
24+
25+
```csharp
26+
await Screencast.HideActionsAsync();
27+
```
28+
29+
**Returns**
30+
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-hide-actions-return"/><a href="#screencast-hide-actions-return" class="list-anchor">#</a>
31+
32+
---
33+
1734
### HideOverlaysAsync {#screencast-hide-overlays}
1835

1936
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.HideOverlaysAsync</x-search>
@@ -31,6 +48,35 @@ await Screencast.HideOverlaysAsync();
3148

3249
---
3350

51+
### ShowActionsAsync {#screencast-show-actions}
52+
53+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.ShowActionsAsync</x-search>
54+
55+
Enables visual annotations on interacted elements. Returns a disposable that stops showing actions when disposed.
56+
57+
**Usage**
58+
59+
```csharp
60+
await Screencast.ShowActionsAsync(options);
61+
```
62+
63+
**Arguments**
64+
- `options` `ScreencastShowActionsOptions?` *(optional)*
65+
- `Duration` [float]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-option-duration"/><a href="#screencast-show-actions-option-duration" class="list-anchor">#</a>
66+
67+
How long each annotation is displayed in milliseconds. Defaults to `500`.
68+
- `FontSize` [int]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-option-font-size"/><a href="#screencast-show-actions-option-font-size" class="list-anchor">#</a>
69+
70+
Font size of the action title in pixels. Defaults to `24`.
71+
- `Position` `enum AnnotatePosition { TopLeft, Top, TopRight, BottomLeft, Bottom, BottomRight }?` *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-option-position"/><a href="#screencast-show-actions-option-position" class="list-anchor">#</a>
72+
73+
Position of the action title overlay. Defaults to `"top-right"`.
74+
75+
**Returns**
76+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-return"/><a href="#screencast-show-actions-return" class="list-anchor">#</a>
77+
78+
---
79+
3480
### ShowChapterAsync {#screencast-show-chapter}
3581

3682
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.ShowChapterAsync</x-search>

dotnet/docs/release-notes.mdx

Lines changed: 68 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ import LiteYouTube from '@site/src/components/LiteYouTube';
1313

1414
### 🎬 Screencast
1515

16-
New [Page.Screencast](/api/class-page.mdx#page-screencast) API provides a unified interface for capturing page content — both as video recordings and as real-time frame streams.
16+
New [Page.Screencast](/api/class-page.mdx#page-screencast) API provides a unified interface for capturing page content — both as video recordings, annotations, overlays, and a real-time frame stream.
17+
18+
<center>
1719

1820
<img src="https://raw.githubusercontent.com/microsoft/playwright/main/docs/src/images/release-notes-1.59-screencast-demo.gif" alt="Demo" width="500" height="313" />
1921

20-
**Video recording** — record video with precise start/stop control, as an alternative to the [RecordVideoDir](/api/class-browser.mdx#browser-new-context-option-record-video-dir) option:
22+
</center>
23+
24+
**Screencast recording** — record video with precise start/stop control, as an alternative to the [RecordVideoDir](/api/class-browser.mdx#browser-new-context-option-record-video-dir) option:
2125

2226
```csharp
2327
await page.Screencast.StartAsync(new() { Path = "video.webm" });
@@ -36,13 +40,10 @@ await page.Screencast.StartAsync(new() {
3640
**Action annotations** — enable built-in visual annotations that highlight interacted elements and display action titles during recording:
3741

3842
```csharp
39-
await page.Screencast.StartAsync(new() {
40-
Path = "video.webm",
41-
Annotate = new() { Position = "top-right" },
42-
});
43+
await page.Screencast.ShowActionsAsync(new() { Position = "top-right" });
4344
```
4445

45-
The `Annotate` option accepts `Position` (`"top-left"`, `"top"`, `"top-right"`, `"bottom-left"`, `"bottom"`, `"bottom-right"`), `Duration` (ms per annotation), and `FontSize` (px).
46+
`ShowActionsAsync` accepts `Position` (`"top-left"`, `"top"`, `"top-right"`, `"bottom-left"`, `"bottom"`, `"bottom-right"`), `Duration` (ms per annotation), and `FontSize` (px). Returns a disposable to stop showing actions.
4647

4748
**Visual overlays** — add chapter titles and custom HTML overlays on top of the page for richer narration:
4849

@@ -58,10 +59,8 @@ await page.Screencast.ShowOverlayAsync("<div style=\"color: red\">Recording</div
5859
**Agentic video receipts** — coding agents can produce video evidence of their work. After completing a task, an agent can record a walkthrough video with rich annotations for human review:
5960

6061
```csharp
61-
await page.Screencast.StartAsync(new() {
62-
Path = "receipt.webm",
63-
Annotate = new() { Position = "top-right" },
64-
});
62+
await page.Screencast.StartAsync(new() { Path = "receipt.webm" });
63+
await page.Screencast.ShowActionsAsync(new() { Position = "top-right" });
6564

6665
await page.Screencast.ShowChapterAsync("Verifying checkout flow", new() {
6766
Description = "Added coupon code support per ticket #1234",
@@ -92,7 +91,8 @@ The resulting video serves as a receipt: chapter titles provide context, action
9291
#### Screencast
9392
- [Page.Screencast](/api/class-page.mdx#page-screencast) provides video recording, real-time frame streaming, and overlay management.
9493
- Methods [Screencast.StartAsync()](/api/class-screencast.mdx#screencast-start) and [Screencast.StopAsync()](/api/class-screencast.mdx#screencast-stop) for recording and frame capture.
95-
- Methods [Screencast.ShowChapterAsync()](/api/class-screencast.mdx#screencast-show-chapter) and [Screencast.ShowOverlayAsync()](/api/class-screencast.mdx#screencast-show-overlay) for visual annotations.
94+
- Methods [Screencast.ShowActionsAsync()](/api/class-screencast.mdx#screencast-show-actions) and [Screencast.HideActionsAsync()](/api/class-screencast.mdx#screencast-hide-actions) for action annotations.
95+
- Methods [Screencast.ShowChapterAsync()](/api/class-screencast.mdx#screencast-show-chapter) and [Screencast.ShowOverlayAsync()](/api/class-screencast.mdx#screencast-show-overlay) for visual overlays.
9696
- Methods [Screencast.ShowOverlaysAsync()](/api/class-screencast.mdx#screencast-show-overlays) and [Screencast.HideOverlaysAsync()](/api/class-screencast.mdx#screencast-hide-overlays) for overlay visibility control.
9797

9898
#### Storage, Console and Errors
@@ -106,17 +106,71 @@ The resulting video serves as a receipt: chapter titles provide context, action
106106
- Method [BrowserContext.IsClosed](/api/class-browsercontext.mdx#browser-context-is-closed).
107107
- Method [Request.ExistingResponse](/api/class-request.mdx#request-existing-response) returns the response without waiting.
108108
- Method [Response.HttpVersionAsync()](/api/class-response.mdx#response-http-version) returns the HTTP version used by the response.
109-
- Event [CdpSession.Close](/api/class-cdpsession.mdx#cdp-session-event-close) for CDP sessions.
110109
- Option `Live` in [Tracing.StartAsync()](/api/class-tracing.mdx#tracing-start) for real-time trace updates.
111110
- Option `ArtifactsDir` in [BrowserType.LaunchAsync()](/api/class-browsertype.mdx#browser-type-launch) to configure the artifacts directory.
112111

112+
### 🔗 Interoperability
113+
114+
New [Browser.BindAsync()](/api/class-browser.mdx#browser-bind) API makes a launched browser available for `playwright-cli`, `@playwright/mcp`, and other clients to connect to.
115+
116+
**Bind a browser** — start a browser and bind it so others can connect:
117+
118+
```csharp
119+
var browser = await chromium.LaunchAsync();
120+
var serverInfo = await browser.BindAsync("my-session", new() {
121+
WorkspaceDir = "/my/project",
122+
});
123+
```
124+
125+
**Connect from playwright-cli**
126+
127+
```bash
128+
playwright-cli attach my-session
129+
```
130+
131+
**Connect from playwright/mcp**
132+
133+
```bash
134+
@playwright/mcp --endpoint=my-session
135+
```
136+
137+
**Connect from another client**
138+
139+
```csharp
140+
var browser = await chromium.ConnectAsync(serverInfo.Endpoint);
141+
```
142+
143+
Pass `Host` and `Port` options to bind over WebSocket instead of a named pipe:
144+
145+
```csharp
146+
var serverInfo = await browser.BindAsync("my-session", new() {
147+
Host = "localhost",
148+
Port = 0,
149+
});
150+
// serverInfo.Endpoint is a ws:// URL
151+
```
152+
153+
Call [Browser.UnbindAsync()](/api/class-browser.mdx#browser-unbind) to stop accepting new connections.
154+
155+
### 📊 Observability
156+
157+
Run `playwright-cli show` to open the Dashboard that lists all bound browsers, their status, and workspace.
158+
159+
<center>
160+
161+
<img src="https://raw.githubusercontent.com/microsoft/playwright/main/docs/src/images/release-notes-1.59-dashboard.gif" alt="Demo" width="1169" height="835" />
162+
163+
</center>
164+
- `playwright-cli` binds all of its browsers automatically, so you can see what your agents are doing.
165+
- Pass `PLAYWRIGHT_DASHBOARD=1` env variable to see all `@playwright/test` browsers in the dashboard.
166+
113167
### Breaking Changes ⚠️
114168
- Removed macOS 14 support for WebKit. We recommend upgrading your macOS version, or keeping an older Playwright version.
115169

116170
### Browser Versions
117171
- Chromium 147.0.7727.15
118172
- Mozilla Firefox 148.0.2
119-
- WebKit 26.0
173+
- WebKit 26.4
120174

121175
This version was also tested against the following stable channels:
122176
- Google Chrome 146
90.8 KB
Loading

java/docs/api/class-browser.mdx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,41 @@ public class Example {
3030

3131
## Methods
3232

33+
### bind {#browser-bind}
34+
35+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>browser.bind</x-search>
36+
37+
Binds the browser to a named pipe or web socket, making it available for other clients to connect to.
38+
39+
**Usage**
40+
41+
```java
42+
Browser.bind(title);
43+
Browser.bind(title, options);
44+
```
45+
46+
**Arguments**
47+
- `title` [String]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-title"/><a href="#browser-bind-option-title" class="list-anchor">#</a>
48+
49+
Title of the browser server, used for identification.
50+
- `options` `Browser.BindOptions` *(optional)*
51+
- `setHost` [String] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-host"/><a href="#browser-bind-option-host" class="list-anchor">#</a>
52+
53+
Host to bind the web socket server to. When specified, a web socket server is created instead of a named pipe.
54+
- `setPort` [int] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-port"/><a href="#browser-bind-option-port" class="list-anchor">#</a>
55+
56+
Port to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. Use `0` to let the OS pick an available port.
57+
- `setWorkspaceDir` [String] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-option-workspace-dir"/><a href="#browser-bind-option-workspace-dir" class="list-anchor">#</a>
58+
59+
Working directory associated with this browser server.
60+
61+
**Returns**
62+
- Bind<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-bind-return"/><a href="#browser-bind-return" class="list-anchor">#</a>
63+
- `endpoint` [String]
64+
65+
66+
---
67+
3368
### browserType {#browser-browser-type}
3469

3570
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.23</font><x-search>browser.browserType</x-search>
@@ -654,6 +689,23 @@ Browser.stopTracing();
654689

655690
---
656691

692+
### unbind {#browser-unbind}
693+
694+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>browser.unbind</x-search>
695+
696+
Unbinds the browser server previously bound with [Browser.bind()](/api/class-browser.mdx#browser-bind).
697+
698+
**Usage**
699+
700+
```java
701+
Browser.unbind();
702+
```
703+
704+
**Returns**
705+
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="browser-unbind-return"/><a href="#browser-unbind-return" class="list-anchor">#</a>
706+
707+
---
708+
657709
### version {#browser-version}
658710

659711
<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>browser.version</x-search>

java/docs/api/class-screencast.mdx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ Interface for capturing screencast frames from a page.
1414

1515
## Methods
1616

17+
### hideActions {#screencast-hide-actions}
18+
19+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.hideActions</x-search>
20+
21+
Removes action decorations.
22+
23+
**Usage**
24+
25+
```java
26+
Screencast.hideActions();
27+
```
28+
29+
**Returns**
30+
- [void]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-hide-actions-return"/><a href="#screencast-hide-actions-return" class="list-anchor">#</a>
31+
32+
---
33+
1734
### hideOverlays {#screencast-hide-overlays}
1835

1936
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.hideOverlays</x-search>
@@ -31,6 +48,36 @@ Screencast.hideOverlays();
3148

3249
---
3350

51+
### showActions {#screencast-show-actions}
52+
53+
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.showActions</x-search>
54+
55+
Enables visual annotations on interacted elements. Returns a disposable that stops showing actions when disposed.
56+
57+
**Usage**
58+
59+
```java
60+
Screencast.showActions();
61+
Screencast.showActions(options);
62+
```
63+
64+
**Arguments**
65+
- `options` `Screencast.ShowActionsOptions` *(optional)*
66+
- `setDuration` [double] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-option-duration"/><a href="#screencast-show-actions-option-duration" class="list-anchor">#</a>
67+
68+
How long each annotation is displayed in milliseconds. Defaults to `500`.
69+
- `setFontSize` [int] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-option-font-size"/><a href="#screencast-show-actions-option-font-size" class="list-anchor">#</a>
70+
71+
Font size of the action title in pixels. Defaults to `24`.
72+
- `setPosition` `enum AnnotatePosition { TOP_LEFT, TOP, TOP_RIGHT, BOTTOM_LEFT, BOTTOM, BOTTOM_RIGHT }` *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-option-position"/><a href="#screencast-show-actions-option-position" class="list-anchor">#</a>
73+
74+
Position of the action title overlay. Defaults to `"top-right"`.
75+
76+
**Returns**
77+
- [Disposable]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="screencast-show-actions-return"/><a href="#screencast-show-actions-return" class="list-anchor">#</a>
78+
79+
---
80+
3481
### showChapter {#screencast-show-chapter}
3582

3683
<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59</font><x-search>screencast.showChapter</x-search>

0 commit comments

Comments
 (0)