Skip to content

Commit 182fae7

Browse files
authored
feat(roll): roll Playwright 1.14.0-1629408981000 (microsoft#855)
1 parent c52f0f2 commit 182fae7

File tree

6 files changed

+63
-8
lines changed

6 files changed

+63
-8
lines changed

playwright/_impl/_browser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ async def new_context(
106106
recordVideoSize: ViewportSize = None,
107107
storageState: Union[StorageState, str, Path] = None,
108108
baseURL: str = None,
109+
strictSelectors: bool = None,
109110
) -> BrowserContext:
110111
params = locals_to_params(locals())
111112
await normalize_context_params(self._connection._is_sync, params)
@@ -147,6 +148,7 @@ async def new_page(
147148
recordVideoSize: ViewportSize = None,
148149
storageState: Union[StorageState, str, Path] = None,
149150
baseURL: str = None,
151+
strictSelectors: bool = None,
150152
) -> Page:
151153
params = locals_to_params(locals())
152154
context = await self.new_context(**params)

playwright/_impl/_browser_type.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ async def launch_persistent_context(
133133
recordVideoDir: Union[Path, str] = None,
134134
recordVideoSize: ViewportSize = None,
135135
baseURL: str = None,
136+
strictSelectors: bool = None,
136137
) -> BrowserContext:
137138
userDataDir = str(Path(userDataDir))
138139
params = locals_to_params(locals())

playwright/async_api/_generated.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9615,7 +9615,8 @@ async def new_context(
96159615
record_video_dir: typing.Union[str, pathlib.Path] = None,
96169616
record_video_size: ViewportSize = None,
96179617
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9618-
base_url: str = None
9618+
base_url: str = None,
9619+
strict_selectors: bool = None
96199620
) -> "BrowserContext":
96209621
"""Browser.new_context
96219622
@@ -9709,6 +9710,10 @@ async def new_context(
97099710
Examples:
97109711
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
97119712
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9713+
strict_selectors : Union[bool, NoneType]
9714+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9715+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9716+
more about the strict mode.
97129717
97139718
Returns
97149719
-------
@@ -9747,6 +9752,7 @@ async def new_context(
97479752
recordVideoSize=record_video_size,
97489753
storageState=storage_state,
97499754
baseURL=base_url,
9755+
strictSelectors=strict_selectors,
97509756
),
97519757
)
97529758
)
@@ -9781,7 +9787,8 @@ async def new_page(
97819787
record_video_dir: typing.Union[str, pathlib.Path] = None,
97829788
record_video_size: ViewportSize = None,
97839789
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9784-
base_url: str = None
9790+
base_url: str = None,
9791+
strict_selectors: bool = None
97859792
) -> "Page":
97869793
"""Browser.new_page
97879794
@@ -9870,6 +9877,10 @@ async def new_page(
98709877
Examples:
98719878
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
98729879
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9880+
strict_selectors : Union[bool, NoneType]
9881+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9882+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9883+
more about the strict mode.
98739884
98749885
Returns
98759886
-------
@@ -9908,6 +9919,7 @@ async def new_page(
99089919
recordVideoSize=record_video_size,
99099920
storageState=storage_state,
99109921
baseURL=base_url,
9922+
strictSelectors=strict_selectors,
99119923
),
99129924
)
99139925
)
@@ -10218,7 +10230,8 @@ async def launch_persistent_context(
1021810230
record_har_omit_content: bool = None,
1021910231
record_video_dir: typing.Union[str, pathlib.Path] = None,
1022010232
record_video_size: ViewportSize = None,
10221-
base_url: str = None
10233+
base_url: str = None,
10234+
strict_selectors: bool = None
1022210235
) -> "BrowserContext":
1022310236
"""BrowserType.launch_persistent_context
1022410237
@@ -10345,6 +10358,10 @@ async def launch_persistent_context(
1034510358
Examples:
1034610359
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
1034710360
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
10361+
strict_selectors : Union[bool, NoneType]
10362+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
10363+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
10364+
more about the strict mode.
1034810365
1034910366
Returns
1035010367
-------
@@ -10397,6 +10414,7 @@ async def launch_persistent_context(
1039710414
recordVideoDir=record_video_dir,
1039810415
recordVideoSize=record_video_size,
1039910416
baseURL=base_url,
10417+
strictSelectors=strict_selectors,
1040010418
),
1040110419
)
1040210420
)

playwright/sync_api/_generated.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9556,7 +9556,8 @@ def new_context(
95569556
record_video_dir: typing.Union[str, pathlib.Path] = None,
95579557
record_video_size: ViewportSize = None,
95589558
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9559-
base_url: str = None
9559+
base_url: str = None,
9560+
strict_selectors: bool = None
95609561
) -> "BrowserContext":
95619562
"""Browser.new_context
95629563
@@ -9650,6 +9651,10 @@ def new_context(
96509651
Examples:
96519652
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
96529653
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9654+
strict_selectors : Union[bool, NoneType]
9655+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9656+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9657+
more about the strict mode.
96539658
96549659
Returns
96559660
-------
@@ -9688,6 +9693,7 @@ def new_context(
96889693
recordVideoSize=record_video_size,
96899694
storageState=storage_state,
96909695
baseURL=base_url,
9696+
strictSelectors=strict_selectors,
96919697
),
96929698
)
96939699
)
@@ -9722,7 +9728,8 @@ def new_page(
97229728
record_video_dir: typing.Union[str, pathlib.Path] = None,
97239729
record_video_size: ViewportSize = None,
97249730
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
9725-
base_url: str = None
9731+
base_url: str = None,
9732+
strict_selectors: bool = None
97269733
) -> "Page":
97279734
"""Browser.new_page
97289735
@@ -9811,6 +9818,10 @@ def new_page(
98119818
Examples:
98129819
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
98139820
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
9821+
strict_selectors : Union[bool, NoneType]
9822+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
9823+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
9824+
more about the strict mode.
98149825
98159826
Returns
98169827
-------
@@ -9849,6 +9860,7 @@ def new_page(
98499860
recordVideoSize=record_video_size,
98509861
storageState=storage_state,
98519862
baseURL=base_url,
9863+
strictSelectors=strict_selectors,
98529864
),
98539865
)
98549866
)
@@ -10159,7 +10171,8 @@ def launch_persistent_context(
1015910171
record_har_omit_content: bool = None,
1016010172
record_video_dir: typing.Union[str, pathlib.Path] = None,
1016110173
record_video_size: ViewportSize = None,
10162-
base_url: str = None
10174+
base_url: str = None,
10175+
strict_selectors: bool = None
1016310176
) -> "BrowserContext":
1016410177
"""BrowserType.launch_persistent_context
1016510178
@@ -10286,6 +10299,10 @@ def launch_persistent_context(
1028610299
Examples:
1028710300
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
1028810301
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
10302+
strict_selectors : Union[bool, NoneType]
10303+
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
10304+
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
10305+
more about the strict mode.
1028910306
1029010307
Returns
1029110308
-------
@@ -10338,6 +10355,7 @@ def launch_persistent_context(
1033810355
recordVideoDir=record_video_dir,
1033910356
recordVideoSize=record_video_size,
1034010357
baseURL=base_url,
10358+
strictSelectors=strict_selectors,
1034110359
),
1034210360
)
1034310361
)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
InWheel = None
2929
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
3030

31-
driver_version = "1.14.0-1628783206000"
31+
driver_version = "1.14.0-1629408981000"
3232

3333

3434
def extractall(zip: zipfile.ZipFile, path: str) -> None:

tests/async/test_browsercontext.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
import pytest
1818

19-
from playwright.async_api import Error
19+
from playwright.async_api import Browser, Error
20+
from tests.server import Server
2021

2122

2223
async def test_page_event_should_create_new_context(browser):
@@ -725,3 +726,18 @@ async def test_page_event_should_work_with_ctrl_clicking(context, server, is_mac
725726
await page.click("a", modifiers=["Meta" if is_mac else "Control"])
726727
popup = await popup_info.value
727728
assert await popup.opener() is None
729+
730+
731+
async def test_strict_selectors_on_context(browser: Browser, server: Server):
732+
context = await browser.new_context(strict_selectors=True)
733+
page = await context.new_page()
734+
await page.goto(server.EMPTY_PAGE)
735+
await page.set_content(
736+
"""
737+
<button>Hello</button>
738+
<button>Hello</button>
739+
"""
740+
)
741+
with pytest.raises(Error):
742+
await page.text_content("button")
743+
await context.close()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy