Skip to content

Commit 819fee9

Browse files
chore: roll Playwright to 1.66.0-next (58d69dcc39)
1 parent 6bd6aaa commit 819fee9

14 files changed

Lines changed: 138 additions & 12 deletions

‎DRIVER_VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0ea36910324ed8aa2a5f460317cbd35881ee88d4
1+
58d69dcc392af3a6994eab0323dc2e883f05f396

‎README.md‎

Lines changed: 1 addition & 1 deletion
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 -->158.0.8127.2<!-- GEN:stop --> | ✅ | ✅ | ✅ |
7+
| Chromium <!-- GEN:chromium-version -->158.0.8127.18<!-- GEN:stop --> | ✅ | ✅ | ✅ |
88
| WebKit <!-- GEN:webkit-version -->27.2<!-- GEN:stop --> | ✅ | ✅ | ✅ |
99
| Firefox <!-- GEN:firefox-version -->159.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
1010

‎playwright/_impl/_protocol.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@
634634
},
635635
},
636636
"strictSelectors": "boolean?",
637+
"locateOnlyVisible": "boolean?",
637638
"serviceWorkers": {"type": "enum?", "literals": ["allow", "block"]},
638639
"selectorEngines": {"type": "array?", "items": "SelectorEngine"},
639640
"testIdAttributeName": "string?",
@@ -821,6 +822,7 @@
821822
},
822823
},
823824
"strictSelectors": "boolean?",
825+
"locateOnlyVisible": "boolean?",
824826
"serviceWorkers": {"type": "enum?", "literals": ["allow", "block"]},
825827
"selectorEngines": {"type": "array?", "items": "SelectorEngine"},
826828
"testIdAttributeName": "string?",
@@ -949,6 +951,7 @@
949951
},
950952
},
951953
"strictSelectors": "boolean?",
954+
"locateOnlyVisible": "boolean?",
952955
"serviceWorkers": {"type": "enum?", "literals": ["allow", "block"]},
953956
"selectorEngines": {"type": "array?", "items": "SelectorEngine"},
954957
"testIdAttributeName": "string?",
@@ -1285,6 +1288,7 @@
12851288
},
12861289
},
12871290
"strictSelectors": "boolean?",
1291+
"locateOnlyVisible": "boolean?",
12881292
"serviceWorkers": {"type": "enum?", "literals": ["allow", "block"]},
12891293
"selectorEngines": {"type": "array?", "items": "SelectorEngine"},
12901294
"testIdAttributeName": "string?",
@@ -1375,6 +1379,7 @@
13751379
},
13761380
},
13771381
"strictSelectors": "boolean?",
1382+
"locateOnlyVisible": "boolean?",
13781383
"timezoneId": "string?",
13791384
"tracesDir": "string?",
13801385
"artifactsDir": "string?",

‎playwright/_impl/browser_context.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,8 @@ async def prepare_browser_context_params(options: Dict[str, Any]) -> Dict[str, A
944944
else None
945945
),
946946
"strictSelectors": options.get("strict_selectors"),
947+
# Not ported: locateOnlyVisible is JavaScript-only (docs: langs: js).
948+
"locateOnlyVisible": None,
947949
"selectorEngines": options.get("selectorEngines"),
948950
"testIdAttributeName": options.get("testIdAttributeName"),
949951
"proxy": options.get("proxy"),

‎playwright/_impl/locator.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
Python code of a normalized locator, and repr() shows the selector otherwise. The
2121
JavaScript-only API (util.inspect.custom, toString(), ariaSnapshotJSON(), the object
2222
form of the highlight style, signal) is not ported.
23+
24+
Not ported: selectorForQuery(), for the JavaScript-only locateOnlyVisible context
25+
option (docs: langs: js). Python queries keep the unmodified selector, including
26+
screenshot masks and locator handlers.
2327
"""
2428

2529
import json

‎playwright/_impl/protocol/validator.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324
)
325325
),
326326
"strictSelectors": t_optional(t_boolean),
327+
"locateOnlyVisible": t_optional(t_boolean),
327328
"serviceWorkers": t_optional(t_enum(["allow", "block"])),
328329
"selectorEngines": t_optional(t_array(t_type("SelectorEngine"))),
329330
"testIdAttributeName": t_optional(t_string),
@@ -783,6 +784,7 @@
783784
)
784785
),
785786
"strictSelectors": t_optional(t_boolean),
787+
"locateOnlyVisible": t_optional(t_boolean),
786788
"serviceWorkers": t_optional(t_enum(["allow", "block"])),
787789
"selectorEngines": t_optional(t_array(t_type("SelectorEngine"))),
788790
"testIdAttributeName": t_optional(t_string),
@@ -923,6 +925,7 @@
923925
)
924926
),
925927
"strictSelectors": t_optional(t_boolean),
928+
"locateOnlyVisible": t_optional(t_boolean),
926929
"serviceWorkers": t_optional(t_enum(["allow", "block"])),
927930
"selectorEngines": t_optional(t_array(t_type("SelectorEngine"))),
928931
"testIdAttributeName": t_optional(t_string),
@@ -1100,6 +1103,7 @@
11001103
)
11011104
),
11021105
"strictSelectors": t_optional(t_boolean),
1106+
"locateOnlyVisible": t_optional(t_boolean),
11031107
"serviceWorkers": t_optional(t_enum(["allow", "block"])),
11041108
"selectorEngines": t_optional(t_array(t_type("SelectorEngine"))),
11051109
"testIdAttributeName": t_optional(t_string),
@@ -1717,6 +1721,7 @@
17171721
)
17181722
),
17191723
"strictSelectors": t_optional(t_boolean),
1724+
"locateOnlyVisible": t_optional(t_boolean),
17201725
"serviceWorkers": t_optional(t_enum(["allow", "block"])),
17211726
"selectorEngines": t_optional(t_array(t_type("SelectorEngine"))),
17221727
"testIdAttributeName": t_optional(t_string),
@@ -1869,6 +1874,7 @@
18691874
)
18701875
),
18711876
"strictSelectors": t_optional(t_boolean),
1877+
"locateOnlyVisible": t_optional(t_boolean),
18721878
"timezoneId": t_optional(t_string),
18731879
"tracesDir": t_optional(t_string),
18741880
"artifactsDir": t_optional(t_string),

‎playwright/_impl/protocol_channels.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ def launchBrowser(
332332
baseURL: Optional[str],
333333
recordVideo: Optional[channels.AndroidDeviceLaunchBrowserParamsRecordVideo],
334334
strictSelectors: Optional[bool],
335+
locateOnlyVisible: Optional[bool],
335336
serviceWorkers: Optional[Literal["allow", "block"]],
336337
selectorEngines: Optional[Sequence[channels.SelectorEngine]],
337338
testIdAttributeName: Optional[str],
@@ -369,6 +370,7 @@ def launchBrowser(
369370
"baseURL": baseURL,
370371
"recordVideo": recordVideo,
371372
"strictSelectors": strictSelectors,
373+
"locateOnlyVisible": locateOnlyVisible,
372374
"serviceWorkers": serviceWorkers,
373375
"selectorEngines": selectorEngines,
374376
"testIdAttributeName": testIdAttributeName,
@@ -816,6 +818,7 @@ def newContext(
816818
baseURL: Optional[str],
817819
recordVideo: Optional[channels.BrowserNewContextParamsRecordVideo],
818820
strictSelectors: Optional[bool],
821+
locateOnlyVisible: Optional[bool],
819822
serviceWorkers: Optional[Literal["allow", "block"]],
820823
selectorEngines: Optional[Sequence[channels.SelectorEngine]],
821824
testIdAttributeName: Optional[str],
@@ -852,6 +855,7 @@ def newContext(
852855
"baseURL": baseURL,
853856
"recordVideo": recordVideo,
854857
"strictSelectors": strictSelectors,
858+
"locateOnlyVisible": locateOnlyVisible,
855859
"serviceWorkers": serviceWorkers,
856860
"selectorEngines": selectorEngines,
857861
"testIdAttributeName": testIdAttributeName,
@@ -894,6 +898,7 @@ def newContextForReuse(
894898
baseURL: Optional[str],
895899
recordVideo: Optional[channels.BrowserNewContextForReuseParamsRecordVideo],
896900
strictSelectors: Optional[bool],
901+
locateOnlyVisible: Optional[bool],
897902
serviceWorkers: Optional[Literal["allow", "block"]],
898903
selectorEngines: Optional[Sequence[channels.SelectorEngine]],
899904
testIdAttributeName: Optional[str],
@@ -930,6 +935,7 @@ def newContextForReuse(
930935
"baseURL": baseURL,
931936
"recordVideo": recordVideo,
932937
"strictSelectors": strictSelectors,
938+
"locateOnlyVisible": locateOnlyVisible,
933939
"serviceWorkers": serviceWorkers,
934940
"selectorEngines": selectorEngines,
935941
"testIdAttributeName": testIdAttributeName,
@@ -1804,6 +1810,7 @@ def launchPersistentContext(
18041810
channels.BrowserTypeLaunchPersistentContextParamsRecordVideo
18051811
],
18061812
strictSelectors: Optional[bool],
1813+
locateOnlyVisible: Optional[bool],
18071814
serviceWorkers: Optional[Literal["allow", "block"]],
18081815
selectorEngines: Optional[Sequence[channels.SelectorEngine]],
18091816
testIdAttributeName: Optional[str],
@@ -1857,6 +1864,7 @@ def launchPersistentContext(
18571864
"baseURL": baseURL,
18581865
"recordVideo": recordVideo,
18591866
"strictSelectors": strictSelectors,
1867+
"locateOnlyVisible": locateOnlyVisible,
18601868
"serviceWorkers": serviceWorkers,
18611869
"selectorEngines": selectorEngines,
18621870
"testIdAttributeName": testIdAttributeName,
@@ -1940,6 +1948,7 @@ def launch(
19401948
offline: Optional[bool],
19411949
recordVideo: Optional[channels.ElectronLaunchParamsRecordVideo],
19421950
strictSelectors: Optional[bool],
1951+
locateOnlyVisible: Optional[bool],
19431952
timezoneId: Optional[str],
19441953
tracesDir: Optional[str],
19451954
artifactsDir: Optional[str],
@@ -1966,6 +1975,7 @@ def launch(
19661975
"offline": offline,
19671976
"recordVideo": recordVideo,
19681977
"strictSelectors": strictSelectors,
1978+
"locateOnlyVisible": locateOnlyVisible,
19691979
"timezoneId": timezoneId,
19701980
"tracesDir": tracesDir,
19711981
"artifactsDir": artifactsDir,

‎playwright/_impl/protocol_types.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ class BrowserContextInitializerOptions(TypedDict):
570570
baseURL: NotRequired[str]
571571
recordVideo: NotRequired[BrowserContextInitializerOptionsRecordVideo]
572572
strictSelectors: NotRequired[bool]
573+
locateOnlyVisible: NotRequired[bool]
573574
serviceWorkers: NotRequired[Literal["allow", "block"]]
574575
selectorEngines: NotRequired[List[SelectorEngine]]
575576
testIdAttributeName: NotRequired[str]

‎tests/async/library/test_screencast.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ async def test_SC_001_screencast_start_delivers_frames_via_on_frame_callback(
8888
# Each frame must be a valid JPEG (starts with FF D8)
8989
assert frame[0] == 0xFF
9090
assert frame[1] == 0xD8
91-
dimensions = jpeg_dimensions(frame)
92-
# Frame should be scaled down to fit the maximum size.
93-
assert dimensions["width"] == 500
94-
assert dimensions["height"] == 200
91+
# Chromium scales the first frame against the window size it had before the viewport
92+
# was applied, so only the last frame is reliably scaled down to fit the maximum size.
93+
dimensions = jpeg_dimensions(frames[-1])
94+
assert dimensions["width"] == 500
95+
assert dimensions["height"] == 200
9596

9697
await context.close()
9798

‎tests/async/page/test_page_event_popup.py‎

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616

1717

1818
import asyncio
19+
from concurrent.futures import Future
20+
21+
import pytest
1922

2023
from playwright.async_api import Page
21-
from tests.server import Server
24+
from tests.server import Server, TestServerRequest, reactor
2225

2326

2427
async def test_PO_001_should_work_smoke(page: Page) -> None:
@@ -185,3 +188,46 @@ async def test_PO_013_should_report_popup_opened_from_iframes(
185188
await frame.evaluate("() => window.open('')")
186189
popup = await popup_info.value
187190
assert popup
191+
192+
193+
async def test_PO_030_should_finish_loading_after_opening_a_popup_while_a_cross_site_iframe_is_loading(
194+
page: Page, server: Server, is_headless_shell: bool
195+
) -> None:
196+
if is_headless_shell:
197+
pytest.skip(
198+
"fixme: Without site isolation, which is the default in headless shell, the opener never fires the load event"
199+
)
200+
201+
# Python: a thread-safe future gates the response on the Twisted reactor thread.
202+
frame_may_finish: Future[None] = Future()
203+
204+
def handle_frame(request: TestServerRequest) -> None:
205+
def finish() -> None:
206+
request.setHeader("Content-Type", "text/html")
207+
request.write(b"<body>frame</body>")
208+
request.finish()
209+
210+
frame_may_finish.add_done_callback(lambda _: reactor.callFromThread(finish))
211+
212+
server.set_route("/frame.html", handle_frame)
213+
214+
def handle_opener(request: TestServerRequest) -> None:
215+
request.setHeader("Content-Type", "text/html")
216+
request.write(
217+
f"""
218+
<iframe src="{server.CROSS_PROCESS_PREFIX}/frame.html"></iframe>
219+
<script>window.open('{server.EMPTY_PAGE}')</script>
220+
""".encode()
221+
)
222+
request.finish()
223+
224+
server.set_route("/opener.html", handle_opener)
225+
226+
async with page.expect_popup() as popup_info:
227+
await page.goto(server.PREFIX + "/opener.html", wait_until="commit")
228+
popup = await popup_info.value
229+
# The iframe is still loading when the popup opens.
230+
frame_may_finish.set_result(None)
231+
await popup.wait_for_load_state("load")
232+
await page.wait_for_load_state("load")
233+
assert await page.evaluate("() => document.readyState") == "complete"

0 commit comments

Comments
 (0)