Skip to content

Commit cfe490d

Browse files
committed
cherry-pick(#43353): docs: release notes for v1.64 Python
1 parent 866cbb8 commit cfe490d

1 file changed

Lines changed: 105 additions & 0 deletions

File tree

‎docs/src/release-notes-python.md‎

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,111 @@ toc_max_heading_level: 2
66

77
import LiteYouTube from '@site/src/components/LiteYouTube';
88

9+
## Version 1.64
10+
11+
### 🧰 WebMCP
12+
13+
New [`property: Page.webmcp`] and [`property: Frame.webmcp`] give access to the tools that a page registers through
14+
the experimental [WebMCP](https://webmachinelearning.github.io/webmcp/) browser API, so you can test them like
15+
any other part of your app:
16+
17+
```python
18+
browser = chromium.launch(args=["--enable-features=WebMCP"])
19+
page = browser.new_page()
20+
page.goto("https://example.com")
21+
22+
for tool in page.webmcp.tools():
23+
print(tool["name"], tool["description"])
24+
25+
result = page.webmcp.call_tool("add", {"a": 2, "b": 40})
26+
print(result["content"][0]["text"]) # "42"
27+
```
28+
29+
[Playwright MCP](./getting-started-mcp.md) also supports WebMCP by default, with page-defined tools offered to the agent as `webmcp_<tool>`. Pass `--no-webmcp` to opt out.
30+
31+
[`playwright-cli`](./getting-started-cli.md) exposes them as well:
32+
33+
```bash
34+
playwright-cli webmcp-list
35+
playwright-cli webmcp-call search_catalog --params '{"query":"cats"}'
36+
```
37+
38+
### 🎬 Better videos
39+
40+
Videos can now be recorded at a custom frame rate, and the decorations for actions are styled with plain CSS:
41+
42+
```python
43+
page.screencast.start(path="video.webm", size={"width": 1920, "height": 1080}, fps=60)
44+
page.screencast.show_actions(
45+
style={
46+
"point": "width: 20px; height: 20px; border-radius: 50%; background: red",
47+
"highlight": "outline: 2px solid #333; background: rgba(0, 128, 255, .15)",
48+
"title": "font-size: 16px",
49+
}
50+
)
51+
```
52+
53+
- New [`option: Browser.newContext.recordVideoFps`] option and new [`option: Screencast.start.fps`] option in
54+
[`method: Screencast.start`]. Firefox and WebKit currently capture up to 25 frames per second.
55+
- New [`option: Screencast.showActions.style`] option takes CSS declarations for the `point` marker, the target
56+
`highlight` and the action `title`. It replaces the `font_size` option, which is now deprecated.
57+
- The cursor stays visible at the last action point, survives navigations and travels along a natural, eased path.
58+
- Videos are encoded with VP9 instead of VP8, which takes less CPU and produces smaller files of the same or better
59+
quality.
60+
- All video options are also available in [Playwright MCP](./getting-started-mcp.md) and [`playwright-cli`](./getting-started-cli.md).
61+
62+
### 🪆 Locator.within()
63+
64+
New [`method: Locator.within`] combines two locators that you already have, reading in the natural order —
65+
"this button, within that dialog":
66+
67+
```python
68+
save_button = page.get_by_role("button", name="Save")
69+
dialog = page.get_by_test_id("settings-dialog")
70+
71+
save_button.within(dialog).click()
72+
```
73+
74+
Relative locators such as [`method: Locator.nth`] or [`method: Locator.first`] are resolved inside each parent
75+
separately, which makes column-like queries straightforward:
76+
77+
```python
78+
# The third cell of every row, not the third cell in the table.
79+
third_column = page.get_by_role("cell").nth(2).within(page.get_by_role("row"))
80+
expect(third_column).to_have_text(["Apple", "Banana", "Cherry"])
81+
```
82+
83+
### New APIs
84+
85+
- New [`method: Page.getByRef`] locates an element by its aria ref, such as `e2`, reported by [`method: Page.ariaSnapshot`] in the `"ai"` mode.
86+
- New option [`option: Page.content.includeShadow`] in [`method: Page.content`] and [`method: Frame.content`] serializes open shadow roots as [declarative shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM#declaratively_with_html).
87+
- New option [`option: Credentials.create.signCount`] sets the initial signature counter of a virtual credential. [`method: Credentials.create`] and [`method: Credentials.get`] return the current `sign_count`, and it is saved and restored together with the credentials in the storage state.
88+
- New [`method: APIRequestContext.addCookies`], [`method: APIRequestContext.cookies`] and [`method: APIRequestContext.clearCookies`] manage cookies of a request context, mirroring the [BrowserContext] methods:
89+
90+
```python
91+
request.add_cookies(
92+
[{"name": "session-id", "value": "42", "url": "https://example.com"}]
93+
)
94+
print(request.cookies("https://example.com"))
95+
request.clear_cookies(name="session-id")
96+
```
97+
98+
### Breaking Changes ⚠️
99+
100+
- Elements inside hidden iframes are considered hidden. Elements inside an iframe that is not visible, for example with `visibility: hidden`, are now considered hidden by actions, [`method: Locator.isVisible`] and [`method: LocatorAssertions.toBeVisible`].
101+
102+
### Browser Versions
103+
104+
- Chromium 156.0.8078.4
105+
- Mozilla Firefox 157.0
106+
- WebKit 27.2
107+
108+
This version was also tested against the following stable channels:
109+
110+
- Google Chrome 155
111+
- Microsoft Edge 155
112+
113+
9114
## Version 1.63
10115

11116
### 🪟 Locate across frames

0 commit comments

Comments
 (0)