Skip to content

Commit 6980e90

Browse files
authored
chore(roll): roll Playwright to 1.35.0-beta-1686247644000 (#1964)
1 parent 45b1312 commit 6980e90

13 files changed

+304
-202
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
44

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->114.0.5735.35<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->115.0.5790.24<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> ||||
99
| Firefox <!-- GEN:firefox-version -->113.0<!-- GEN:stop --> ||||
1010

playwright/_impl/_browser_context.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,19 @@ def _on_binding(self, binding_call: BindingCall) -> None:
232232
asyncio.create_task(binding_call.call(func))
233233

234234
def set_default_navigation_timeout(self, timeout: float) -> None:
235-
self._timeout_settings.set_navigation_timeout(timeout)
235+
return self._set_default_navigation_timeout_impl(timeout)
236+
237+
def _set_default_navigation_timeout_impl(self, timeout: Optional[float]) -> None:
238+
self._timeout_settings.set_default_navigation_timeout(timeout)
236239
self._channel.send_no_reply(
237240
"setDefaultNavigationTimeoutNoReply", dict(timeout=timeout)
238241
)
239242

240243
def set_default_timeout(self, timeout: float) -> None:
241-
self._timeout_settings.set_timeout(timeout)
244+
return self._set_default_timeout_impl(timeout)
245+
246+
def _set_default_timeout_impl(self, timeout: Optional[float]) -> None:
247+
self._timeout_settings.set_default_timeout(timeout)
242248
self._channel.send_no_reply("setDefaultTimeoutNoReply", dict(timeout=timeout))
243249

244250
@property

playwright/_impl/_element_handle.py

+1
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ async def screenshot(
287287
caret: Literal["hide", "initial"] = None,
288288
scale: Literal["css", "device"] = None,
289289
mask: List["Locator"] = None,
290+
mask_color: str = None,
290291
) -> bytes:
291292
params = locals_to_params(locals())
292293
if "path" in params:

playwright/_impl/_helper.py

+18-10
Original file line numberDiff line numberDiff line change
@@ -177,27 +177,35 @@ class HarLookupResult(TypedDict, total=False):
177177
class TimeoutSettings:
178178
def __init__(self, parent: Optional["TimeoutSettings"]) -> None:
179179
self._parent = parent
180-
self._timeout: Optional[float] = None
181-
self._navigation_timeout: Optional[float] = None
180+
self._default_timeout: Optional[float] = None
181+
self._default_navigation_timeout: Optional[float] = None
182182

183-
def set_timeout(self, timeout: float) -> None:
184-
self._timeout = timeout
183+
def set_default_timeout(self, timeout: Optional[float]) -> None:
184+
self._default_timeout = timeout
185185

186186
def timeout(self, timeout: float = None) -> float:
187187
if timeout is not None:
188188
return timeout
189-
if self._timeout is not None:
190-
return self._timeout
189+
if self._default_timeout is not None:
190+
return self._default_timeout
191191
if self._parent:
192192
return self._parent.timeout()
193193
return 30000
194194

195-
def set_navigation_timeout(self, navigation_timeout: float) -> None:
196-
self._navigation_timeout = navigation_timeout
195+
def set_default_navigation_timeout(
196+
self, navigation_timeout: Optional[float]
197+
) -> None:
198+
self._default_navigation_timeout = navigation_timeout
199+
200+
def default_navigation_timeout(self) -> Optional[float]:
201+
return self._default_navigation_timeout
202+
203+
def default_timeout(self) -> Optional[float]:
204+
return self._default_timeout
197205

198206
def navigation_timeout(self) -> float:
199-
if self._navigation_timeout is not None:
200-
return self._navigation_timeout
207+
if self._default_navigation_timeout is not None:
208+
return self._default_navigation_timeout
201209
if self._parent:
202210
return self._parent.navigation_timeout()
203211
return 30000

playwright/_impl/_locator.py

+1
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ async def screenshot(
524524
caret: Literal["hide", "initial"] = None,
525525
scale: Literal["css", "device"] = None,
526526
mask: List["Locator"] = None,
527+
mask_color: str = None,
527528
) -> bytes:
528529
params = locals_to_params(locals())
529530
return await self._with_element(

playwright/_impl/_network.py

+1
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ async def continue_route() -> None:
422422
if "headers" in params:
423423
params["headers"] = serialize_headers(params["headers"])
424424
params["requestUrl"] = self.request._initializer["url"]
425+
params["isFallback"] = is_internal
425426
await self._connection.wrap_api_call(
426427
lambda: self._race_with_page_close(
427428
self._channel.send(

playwright/_impl/_page.py

+21-8
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,13 @@ def frames(self) -> List[Frame]:
323323
return self._frames.copy()
324324

325325
def set_default_navigation_timeout(self, timeout: float) -> None:
326-
self._timeout_settings.set_navigation_timeout(timeout)
326+
self._timeout_settings.set_default_navigation_timeout(timeout)
327327
self._channel.send_no_reply(
328328
"setDefaultNavigationTimeoutNoReply", dict(timeout=timeout)
329329
)
330330

331331
def set_default_timeout(self, timeout: float) -> None:
332-
self._timeout_settings.set_timeout(timeout)
332+
self._timeout_settings.set_default_timeout(timeout)
333333
self._channel.send_no_reply("setDefaultTimeoutNoReply", dict(timeout=timeout))
334334

335335
async def query_selector(
@@ -641,6 +641,7 @@ async def screenshot(
641641
caret: Literal["hide", "initial"] = None,
642642
scale: Literal["css", "device"] = None,
643643
mask: List["Locator"] = None,
644+
mask_color: str = None,
644645
) -> bytes:
645646
params = locals_to_params(locals())
646647
if "path" in params:
@@ -957,13 +958,25 @@ def request(self) -> "APIRequestContext":
957958
return self.context.request
958959

959960
async def pause(self) -> None:
960-
await asyncio.wait(
961-
[
962-
asyncio.create_task(self._browser_context._pause()),
963-
self._closed_or_crashed_future,
964-
],
965-
return_when=asyncio.FIRST_COMPLETED,
961+
default_navigation_timeout = (
962+
self._browser_context._timeout_settings.default_navigation_timeout()
966963
)
964+
default_timeout = self._browser_context._timeout_settings.default_timeout()
965+
self._browser_context.set_default_navigation_timeout(0)
966+
self._browser_context.set_default_timeout(0)
967+
try:
968+
await asyncio.wait(
969+
[
970+
asyncio.create_task(self._browser_context._pause()),
971+
self._closed_or_crashed_future,
972+
],
973+
return_when=asyncio.FIRST_COMPLETED,
974+
)
975+
finally:
976+
self._browser_context._set_default_navigation_timeout_impl(
977+
default_navigation_timeout
978+
)
979+
self._browser_context._set_default_timeout_impl(default_timeout)
967980

968981
async def pdf(
969982
self,

playwright/_impl/_set_input_files_helpers.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,26 @@ async def convert_input_files(
3333
) -> InputFilesList:
3434
file_list = files if isinstance(files, list) else [files]
3535

36-
has_large_buffer = any(
37-
[
38-
len(f.get("buffer", "")) > SIZE_LIMIT_IN_BYTES
39-
for f in file_list
40-
if not isinstance(f, (str, Path))
41-
]
36+
total_buffer_size_exceeds_limit = (
37+
sum(
38+
[
39+
len(f.get("buffer", ""))
40+
for f in file_list
41+
if not isinstance(f, (str, Path))
42+
]
43+
)
44+
> SIZE_LIMIT_IN_BYTES
4245
)
43-
if has_large_buffer:
46+
if total_buffer_size_exceeds_limit:
4447
raise Error(
4548
"Cannot set buffer larger than 50Mb, please write it to a file and pass its path instead."
4649
)
4750

48-
has_large_file = any(
49-
[
50-
os.stat(f).st_size > SIZE_LIMIT_IN_BYTES
51-
for f in file_list
52-
if isinstance(f, (str, Path))
53-
]
51+
total_file_size_exceeds_limit = (
52+
sum([os.stat(f).st_size for f in file_list if isinstance(f, (str, Path))])
53+
> SIZE_LIMIT_IN_BYTES
5454
)
55-
if has_large_file:
55+
if total_file_size_exceeds_limit:
5656
if context._channel._connection.is_remote:
5757
streams = []
5858
for file in file_list:

0 commit comments

Comments
 (0)