Skip to content

Commit 3b7c24c

Browse files
authored
chore: roll Playwright to 1.62.0 (#3161)
1 parent 1db079f commit 3b7c24c

22 files changed

Lines changed: 317 additions & 177 deletions

‎DRIVER_VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.62.0-alpha-2026-07-16
1+
1.62.0

‎NODE_VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.18.0
1+
24.18.1

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
44

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->151.0.7922.19<!-- GEN:stop --> | ✅ | ✅ | ✅ |
7+
| Chromium <!-- GEN:chromium-version -->151.0.7922.34<!-- GEN:stop --> | ✅ | ✅ | ✅ |
88
| WebKit <!-- GEN:webkit-version -->26.5<!-- GEN:stop --> | ✅ | ✅ | ✅ |
9-
| Firefox <!-- GEN:firefox-version -->152.0.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
9+
| Firefox <!-- GEN:firefox-version -->153.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
1010

1111
## Documentation
1212

‎ROLLING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pre-commit install
1212
pip install -e .
1313
```
1414
* change the driver pin in `DRIVER_VERSION` (the `playwright-core` npm version, e.g. `1.61.0`) and refresh `NODE_VERSION`: `python scripts/update_node_version.py`
15-
* download the new driver: `python -m build --wheel` (fetches `playwright-core` from npm + the matching Node.js binary and assembles the bundle; no source build)
15+
* download the new driver: `python -m build --wheel` (fetches `playwright-core` from npm + the matching Node.js binary and assembles the bundle; no source build). Set `npm_config_registry` to use a different npm registry.
1616
* generate API (needs a nearby `microsoft/playwright` checkout at `v<new>`): `PW_SRC_DIR=../playwright ./scripts/update_api.sh`
1717
* commit changes & send PR
1818
* wait for bots to pass & merge the PR

‎playwright/_impl/_browser_context.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ async def route_from_har(
499499
update: bool = None,
500500
updateContent: Literal["attach", "embed"] = None,
501501
updateMode: HarMode = None,
502-
interceptAPIRequests: bool = None,
503502
) -> None:
504503
if update:
505504
await self._tracing._record_into_har(
@@ -518,8 +517,6 @@ async def route_from_har(
518517
)
519518
self._har_routers.append(router)
520519
await router.add_context_route(self)
521-
if interceptAPIRequests:
522-
await router.add_api_request_route(self)
523520

524521
async def _update_interception_patterns(self) -> None:
525522
patterns = RouteHandler.prepare_interception_patterns(self._routes)

‎playwright/_impl/_har_router.py‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313
# limitations under the License.
1414
import asyncio
1515
import base64
16-
import re
17-
from typing import TYPE_CHECKING, List, Optional, Tuple, cast
16+
from typing import TYPE_CHECKING, Optional, cast
1817

1918
from playwright._impl._api_structures import HeadersArray
2019
from playwright._impl._helper import (
2120
HarLookupResult,
2221
RouteFromHarNotFoundPolicy,
2322
URLMatch,
24-
escape_regex_flags,
2523
)
2624
from playwright._impl._local_utils import LocalUtils
2725

@@ -43,7 +41,6 @@ def __init__(
4341
self._har_id: str = har_id
4442
self._not_found_action: RouteFromHarNotFoundPolicy = not_found_action
4543
self._options_url_match: Optional[URLMatch] = url_matcher
46-
self._api_request_registrations: List[Tuple["BrowserContext", str]] = []
4744

4845
@staticmethod
4946
async def create(
@@ -119,30 +116,7 @@ async def add_page_route(self, page: "Page") -> None:
119116
handler=lambda route, _: asyncio.create_task(self._handle(route)),
120117
)
121118

122-
async def add_api_request_route(self, context: "BrowserContext") -> None:
123-
url_match = self._options_url_match
124-
params: dict = {
125-
"harId": self._har_id,
126-
"notFound": self._not_found_action,
127-
}
128-
if isinstance(url_match, str):
129-
params["urlGlob"] = url_match
130-
elif isinstance(url_match, re.Pattern):
131-
params["urlRegexSource"] = url_match.pattern
132-
params["urlRegexFlags"] = escape_regex_flags(url_match)
133-
result = await context._channel.send_return_as_dict(
134-
"routeAPIRequestsFromHar", None, params
135-
)
136-
self._api_request_registrations.append((context, result["registrationId"]))
137-
138119
def dispose(self) -> None:
139-
for context, registration_id in self._api_request_registrations:
140-
context._channel.send_may_fail(
141-
"unrouteAPIRequestsFromHar",
142-
None,
143-
{"registrationId": registration_id},
144-
)
145-
self._api_request_registrations = []
146120
self._local_utils._channel.send_may_fail(
147121
"harClose", None, {"harId": self._har_id}
148122
)

‎playwright/_impl/_network.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ async def sizes(self) -> RequestSizes:
208208
@property
209209
def post_data(self) -> Optional[str]:
210210
data = self._fallback_overrides.post_data_buffer
211-
if data:
211+
if data is not None:
212212
return data.decode()
213213
base64_post_data = self._initializer.get("postData")
214214
if base64_post_data is not None:

‎playwright/_impl/_screencast.py‎

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,47 @@ def __init__(self, page: "Page") -> None:
5151
self._save_path: Optional[Union[str, Path]] = None
5252
self._on_frame: Optional[ScreencastFrameCallback] = None
5353
self._artifact: Optional[Artifact] = None
54-
page._channel.on("screencastFrame", lambda params: self._dispatch_frame(params))
55-
56-
def _dispatch_frame(self, params: dict) -> None:
57-
if not self._on_frame:
58-
return
59-
data = params["data"]
60-
if isinstance(data, str):
61-
data = base64.b64decode(data)
62-
result = self._on_frame(
63-
{
64-
"data": data,
65-
"timestamp": params.get("timestamp", 0),
66-
"viewportWidth": params["viewportWidth"],
67-
"viewportHeight": params["viewportHeight"],
68-
}
69-
)
70-
if hasattr(result, "__await__"):
71-
self._page._loop.create_task(result)
54+
page._channel.on("screencastFrame", self._dispatch_frame)
55+
56+
def _ack_frame(self, frame_id: int) -> None:
57+
try:
58+
self._page._channel.send_no_reply(
59+
"screencastFrameAck", None, {"frameId": frame_id}
60+
)
61+
except (Error, OSError):
62+
pass
63+
64+
async def _await_callback_and_ack(self, result: Any, frame_id: int) -> None:
65+
try:
66+
await result
67+
finally:
68+
self._ack_frame(frame_id)
69+
70+
def _dispatch_frame(self, params: dict) -> Any:
71+
result = None
72+
task = None
73+
try:
74+
if not self._on_frame:
75+
return
76+
data = params["data"]
77+
if isinstance(data, str):
78+
data = base64.b64decode(data)
79+
result = self._on_frame(
80+
{
81+
"data": data,
82+
"timestamp": params.get("timestamp", 0),
83+
"viewportWidth": params["viewportWidth"],
84+
"viewportHeight": params["viewportHeight"],
85+
}
86+
)
87+
finally:
88+
if hasattr(result, "__await__"):
89+
task = self._loop.create_task(
90+
self._await_callback_and_ack(result, params["frameId"])
91+
)
92+
else:
93+
self._ack_frame(params["frameId"])
94+
return task
7295

7396
async def start(
7497
self,

‎playwright/async_api/_generated.py‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7240,7 +7240,7 @@ async def install(
72407240
Parameters
72417241
----------
72427242
time : Union[datetime.datetime, float, str, None]
7243-
Time to initialize with, current system time by default.
7243+
Time to initialize with, current system time by default. Numeric values are Unix time in seconds.
72447244
"""
72457245

72467246
return mapping.from_maybe_impl(await self._impl_obj.install(time=time))
@@ -7299,7 +7299,7 @@ async def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> N
72997299
Parameters
73007300
----------
73017301
time : Union[datetime.datetime, float, str]
7302-
Time to pause at.
7302+
Time to pause at. Numeric values are Unix time in seconds.
73037303
"""
73047304

73057305
return mapping.from_maybe_impl(await self._impl_obj.pause_at(time=time))
@@ -7354,7 +7354,7 @@ async def set_fixed_time(
73547354
Parameters
73557355
----------
73567356
time : Union[datetime.datetime, float, str]
7357-
Time to be set.
7357+
Time to be set. Numeric values are Unix time in seconds.
73587358
"""
73597359

73607360
return mapping.from_maybe_impl(await self._impl_obj.set_fixed_time(time=time))
@@ -7378,7 +7378,7 @@ async def set_system_time(
73787378
Parameters
73797379
----------
73807380
time : Union[datetime.datetime, float, str]
7381-
Time to be set.
7381+
Time to be set. Numeric values are Unix time in seconds.
73827382
"""
73837383

73847384
return mapping.from_maybe_impl(await self._impl_obj.set_system_time(time=time))
@@ -10254,6 +10254,12 @@ async def go_back(
1025410254

1025510255
Navigate to the previous page in history.
1025610256

10257+
**NOTE** **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the
10258+
Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on
10259+
network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using
10260+
`page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized
10261+
`Page` state.
10262+
1025710263
Parameters
1025810264
----------
1025910265
timeout : Union[float, None]
@@ -10296,6 +10302,12 @@ async def go_forward(
1029610302

1029710303
Navigate to the next page in history.
1029810304

10305+
**NOTE** **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the
10306+
Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on
10307+
network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using
10308+
`page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized
10309+
`Page` state.
10310+
1029910311
Parameters
1030010312
----------
1030110313
timeout : Union[float, None]
@@ -15092,7 +15104,6 @@ async def route_from_har(
1509215104
update: typing.Optional[bool] = None,
1509315105
update_content: typing.Optional[Literal["attach", "embed"]] = None,
1509415106
update_mode: typing.Optional[Literal["full", "minimal"]] = None,
15095-
intercept_api_requests: typing.Optional[bool] = None,
1509615107
) -> None:
1509715108
"""BrowserContext.route_from_har
1509815109

@@ -15126,10 +15137,6 @@ async def route_from_har(
1512615137
When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page,
1512715138
cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to
1512815139
`minimal`.
15129-
intercept_api_requests : Union[bool, None]
15130-
If set to `true`, requests made via `APIRequestContext` (such as `browser_context.request` or
15131-
`page.request`) are also served from the HAR file. By default these requests are sent to the network,
15132-
matching the behavior prior to v1.62. Defaults to `false` for backward compatibility.
1513315140
"""
1513415141

1513515142
return mapping.from_maybe_impl(
@@ -15140,7 +15147,6 @@ async def route_from_har(
1514015147
update=update,
1514115148
updateContent=update_content,
1514215149
updateMode=update_mode,
15143-
interceptAPIRequests=intercept_api_requests,
1514415150
)
1514515151
)
1514615152

‎playwright/sync_api/_generated.py‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7330,7 +7330,7 @@ def install(
73307330
Parameters
73317331
----------
73327332
time : Union[datetime.datetime, float, str, None]
7333-
Time to initialize with, current system time by default.
7333+
Time to initialize with, current system time by default. Numeric values are Unix time in seconds.
73347334
"""
73357335

73367336
return mapping.from_maybe_impl(self._sync(self._impl_obj.install(time=time)))
@@ -7391,7 +7391,7 @@ def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> None:
73917391
Parameters
73927392
----------
73937393
time : Union[datetime.datetime, float, str]
7394-
Time to pause at.
7394+
Time to pause at. Numeric values are Unix time in seconds.
73957395
"""
73967396

73977397
return mapping.from_maybe_impl(self._sync(self._impl_obj.pause_at(time=time)))
@@ -7444,7 +7444,7 @@ def set_fixed_time(self, time: typing.Union[float, str, datetime.datetime]) -> N
74447444
Parameters
74457445
----------
74467446
time : Union[datetime.datetime, float, str]
7447-
Time to be set.
7447+
Time to be set. Numeric values are Unix time in seconds.
74487448
"""
74497449

74507450
return mapping.from_maybe_impl(
@@ -7470,7 +7470,7 @@ def set_system_time(
74707470
Parameters
74717471
----------
74727472
time : Union[datetime.datetime, float, str]
7473-
Time to be set.
7473+
Time to be set. Numeric values are Unix time in seconds.
74747474
"""
74757475

74767476
return mapping.from_maybe_impl(
@@ -10270,6 +10270,12 @@ def go_back(
1027010270

1027110271
Navigate to the previous page in history.
1027210272

10273+
**NOTE** **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the
10274+
Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on
10275+
network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using
10276+
`page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized
10277+
`Page` state.
10278+
1027310279
Parameters
1027410280
----------
1027510281
timeout : Union[float, None]
@@ -10314,6 +10320,12 @@ def go_forward(
1031410320

1031510321
Navigate to the next page in history.
1031610322

10323+
**NOTE** **Testing Back/Forward Cache (BFCache) is not supported.** By default, Playwright disables the
10324+
Back/Forward Cache across all browsers. Even if explicitly enabled, Playwright's internal state relies on
10325+
network-level navigation events. Because BFCache restores unfreeze the DOM without firing these events, using
10326+
`page.goBack()` or `page.goForward()` to trigger a BFCache restore will result in timeouts and a desynchronized
10327+
`Page` state.
10328+
1031710329
Parameters
1031810330
----------
1031910331
timeout : Union[float, None]
@@ -15093,7 +15105,6 @@ def route_from_har(
1509315105
update: typing.Optional[bool] = None,
1509415106
update_content: typing.Optional[Literal["attach", "embed"]] = None,
1509515107
update_mode: typing.Optional[Literal["full", "minimal"]] = None,
15096-
intercept_api_requests: typing.Optional[bool] = None,
1509715108
) -> None:
1509815109
"""BrowserContext.route_from_har
1509915110

@@ -15127,10 +15138,6 @@ def route_from_har(
1512715138
When set to `minimal`, only record information necessary for routing from HAR. This omits sizes, timing, page,
1512815139
cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to
1512915140
`minimal`.
15130-
intercept_api_requests : Union[bool, None]
15131-
If set to `true`, requests made via `APIRequestContext` (such as `browser_context.request` or
15132-
`page.request`) are also served from the HAR file. By default these requests are sent to the network,
15133-
matching the behavior prior to v1.62. Defaults to `false` for backward compatibility.
1513415141
"""
1513515142

1513615143
return mapping.from_maybe_impl(
@@ -15142,7 +15149,6 @@ def route_from_har(
1514215149
update=update,
1514315150
updateContent=update_content,
1514415151
updateMode=update_mode,
15145-
interceptAPIRequests=intercept_api_requests,
1514615152
)
1514715153
)
1514815154
)

0 commit comments

Comments
 (0)