Skip to content

feat(roll): roll Playwright 1.14.0-1629408981000 #855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions playwright/_impl/_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ async def new_context(
recordVideoSize: ViewportSize = None,
storageState: Union[StorageState, str, Path] = None,
baseURL: str = None,
strictSelectors: bool = None,
) -> BrowserContext:
params = locals_to_params(locals())
await normalize_context_params(self._connection._is_sync, params)
Expand Down Expand Up @@ -147,6 +148,7 @@ async def new_page(
recordVideoSize: ViewportSize = None,
storageState: Union[StorageState, str, Path] = None,
baseURL: str = None,
strictSelectors: bool = None,
) -> Page:
params = locals_to_params(locals())
context = await self.new_context(**params)
Expand Down
1 change: 1 addition & 0 deletions playwright/_impl/_browser_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ async def launch_persistent_context(
recordVideoDir: Union[Path, str] = None,
recordVideoSize: ViewportSize = None,
baseURL: str = None,
strictSelectors: bool = None,
) -> BrowserContext:
userDataDir = str(Path(userDataDir))
params = locals_to_params(locals())
Expand Down
24 changes: 21 additions & 3 deletions playwright/async_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -9615,7 +9615,8 @@ async def new_context(
record_video_dir: typing.Union[str, pathlib.Path] = None,
record_video_size: ViewportSize = None,
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
base_url: str = None
base_url: str = None,
strict_selectors: bool = None
) -> "BrowserContext":
"""Browser.new_context

Expand Down Expand Up @@ -9709,6 +9710,10 @@ async def new_context(
Examples:
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
strict_selectors : Union[bool, NoneType]
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
more about the strict mode.

Returns
-------
Expand Down Expand Up @@ -9747,6 +9752,7 @@ async def new_context(
recordVideoSize=record_video_size,
storageState=storage_state,
baseURL=base_url,
strictSelectors=strict_selectors,
),
)
)
Expand Down Expand Up @@ -9781,7 +9787,8 @@ async def new_page(
record_video_dir: typing.Union[str, pathlib.Path] = None,
record_video_size: ViewportSize = None,
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
base_url: str = None
base_url: str = None,
strict_selectors: bool = None
) -> "Page":
"""Browser.new_page

Expand Down Expand Up @@ -9870,6 +9877,10 @@ async def new_page(
Examples:
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
strict_selectors : Union[bool, NoneType]
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
more about the strict mode.

Returns
-------
Expand Down Expand Up @@ -9908,6 +9919,7 @@ async def new_page(
recordVideoSize=record_video_size,
storageState=storage_state,
baseURL=base_url,
strictSelectors=strict_selectors,
),
)
)
Expand Down Expand Up @@ -10218,7 +10230,8 @@ async def launch_persistent_context(
record_har_omit_content: bool = None,
record_video_dir: typing.Union[str, pathlib.Path] = None,
record_video_size: ViewportSize = None,
base_url: str = None
base_url: str = None,
strict_selectors: bool = None
) -> "BrowserContext":
"""BrowserType.launch_persistent_context

Expand Down Expand Up @@ -10345,6 +10358,10 @@ async def launch_persistent_context(
Examples:
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
strict_selectors : Union[bool, NoneType]
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
more about the strict mode.

Returns
-------
Expand Down Expand Up @@ -10397,6 +10414,7 @@ async def launch_persistent_context(
recordVideoDir=record_video_dir,
recordVideoSize=record_video_size,
baseURL=base_url,
strictSelectors=strict_selectors,
),
)
)
Expand Down
24 changes: 21 additions & 3 deletions playwright/sync_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -9556,7 +9556,8 @@ def new_context(
record_video_dir: typing.Union[str, pathlib.Path] = None,
record_video_size: ViewportSize = None,
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
base_url: str = None
base_url: str = None,
strict_selectors: bool = None
) -> "BrowserContext":
"""Browser.new_context

Expand Down Expand Up @@ -9650,6 +9651,10 @@ def new_context(
Examples:
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
strict_selectors : Union[bool, NoneType]
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
more about the strict mode.

Returns
-------
Expand Down Expand Up @@ -9688,6 +9693,7 @@ def new_context(
recordVideoSize=record_video_size,
storageState=storage_state,
baseURL=base_url,
strictSelectors=strict_selectors,
),
)
)
Expand Down Expand Up @@ -9722,7 +9728,8 @@ def new_page(
record_video_dir: typing.Union[str, pathlib.Path] = None,
record_video_size: ViewportSize = None,
storage_state: typing.Union[StorageState, str, pathlib.Path] = None,
base_url: str = None
base_url: str = None,
strict_selectors: bool = None
) -> "Page":
"""Browser.new_page

Expand Down Expand Up @@ -9811,6 +9818,10 @@ def new_page(
Examples:
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
strict_selectors : Union[bool, NoneType]
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
more about the strict mode.

Returns
-------
Expand Down Expand Up @@ -9849,6 +9860,7 @@ def new_page(
recordVideoSize=record_video_size,
storageState=storage_state,
baseURL=base_url,
strictSelectors=strict_selectors,
),
)
)
Expand Down Expand Up @@ -10159,7 +10171,8 @@ def launch_persistent_context(
record_har_omit_content: bool = None,
record_video_dir: typing.Union[str, pathlib.Path] = None,
record_video_size: ViewportSize = None,
base_url: str = None
base_url: str = None,
strict_selectors: bool = None
) -> "BrowserContext":
"""BrowserType.launch_persistent_context

Expand Down Expand Up @@ -10286,6 +10299,10 @@ def launch_persistent_context(
Examples:
- baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
- baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in `http://localhost:3000/foo/bar.html`
strict_selectors : Union[bool, NoneType]
It specified, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors
that imply single target DOM element will throw when more than one element matches the selector. See `Locator` to learn
more about the strict mode.

Returns
-------
Expand Down Expand Up @@ -10338,6 +10355,7 @@ def launch_persistent_context(
recordVideoDir=record_video_dir,
recordVideoSize=record_video_size,
baseURL=base_url,
strictSelectors=strict_selectors,
),
)
)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
InWheel = None
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand

driver_version = "1.14.0-1628783206000"
driver_version = "1.14.0-1629408981000"


def extractall(zip: zipfile.ZipFile, path: str) -> None:
Expand Down
18 changes: 17 additions & 1 deletion tests/async/test_browsercontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import pytest

from playwright.async_api import Error
from playwright.async_api import Browser, Error
from tests.server import Server


async def test_page_event_should_create_new_context(browser):
Expand Down Expand Up @@ -725,3 +726,18 @@ async def test_page_event_should_work_with_ctrl_clicking(context, server, is_mac
await page.click("a", modifiers=["Meta" if is_mac else "Control"])
popup = await popup_info.value
assert await popup.opener() is None


async def test_strict_selectors_on_context(browser: Browser, server: Server):
context = await browser.new_context(strict_selectors=True)
page = await context.new_page()
await page.goto(server.EMPTY_PAGE)
await page.set_content(
"""
<button>Hello</button>
<button>Hello</button>
"""
)
with pytest.raises(Error):
await page.text_content("button")
await context.close()