diff --git a/.claude/skills/playwright-roll/SKILL.md b/.claude/skills/playwright-roll/SKILL.md index 112cb8e66..3295bafda 100644 --- a/.claude/skills/playwright-roll/SKILL.md +++ b/.claude/skills/playwright-roll/SKILL.md @@ -17,7 +17,7 @@ The Python port is hand-written code in `playwright/_impl/`, plus a generator (` 2. applies the Python facts that the docs do not contain, from `scripts/codegen/python_rules.js`, and 3. emits the whole public API into `playwright/{async,sync}_api/_generated.py`: signatures, types, docstrings, event overloads, and the call into `_impl/` for every member. -The generator never reads `_impl/`. A new member or option in the docs therefore shows up in `_generated.py` right away, as a call into `_impl/` that does not exist yet. Each generated class types its `_impl_obj`, so **`mypy playwright` lists every such gap** as an error in `_generated.py`. (Temporary: while `scripts/codegen/legacy_order.json` exists, `_impl_obj` is not typed and mypy reports nothing. Find the gaps in the docs diff and with the tests instead.) Three resolutions: +The generator never reads `_impl/`. A new member or option in the docs therefore shows up in `_generated.py` right away, as a call into `_impl/` that does not exist yet. Each generated class types its `_impl_obj`, so **`mypy playwright` lists every such gap** as an error in `_generated.py`. Three resolutions: - **PORT** — the new API is intended for Python (no `langs.only` filter, or `langs.only` includes `"python"`). Implement it in `_impl/` until mypy is clean. - **MISMATCH** — the shipped Python API differs from the docs (a callback signature uses unions, a kwarg uses a legacy name, etc.). The shipped implementation wins. Add an entry to `scripts/codegen/python_rules.js` with a comment explaining *why*, and propose the upstream docs change that would make the entry unnecessary. diff --git a/CLAUDE.md b/CLAUDE.md index 779e6d18a..0ae206b2b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -12,7 +12,7 @@ Python bindings for [Playwright](https://playwright.dev). The Python client talk - `playwright/async_api/_generated.py`, `playwright/sync_api/_generated.py` — **auto-generated** from the upstream API docs. Never edit by hand; rerun `./scripts/update_api.sh` after a roll or after changing `scripts/codegen/`. - `scripts/codegen/generate_api.js` — the generator. A Node.js script that loads the upstream doc parser (`utils/doclint/api_parser.js`) from `$PW_SRC_DIR`, filters the docs for Python, and writes the whole public API: signatures, types, docstrings, event overloads, and the calls into `_impl/`. It does not read `_impl/`. - `scripts/codegen/python_rules.js` — the Python facts that the docs do not contain (positional parameters, struct names, type overrides, hidden members). Policy: the shipped Python API wins; each entry is a candidate for an upstream docs fix, and the generator fails on entries that no longer match anything. Every entry needs a one-line rationale comment above it. -- `scripts/codegen/legacy_order.json` — **temporary**. The old generator's order of classes, members, keyword-only parameters and union members. The generator applies it, and more old habits marked `TEMPORARY` in the generator, so that the switch to the docs generator has a small diff. New members go last. If the generator reports an entry that no longer matches, remove the entry. While the file exists, `_impl_obj` is not typed, so the mypy check described below is not active yet: a docs member that `_impl/` lacks fails only at run time. A follow-up change deletes the file and the `TEMPORARY` code. +- `scripts/codegen/legacy_order.json` — **temporary**. The old generator's order of classes, members, keyword-only parameters and union members. The generator applies it, and more old habits marked `TEMPORARY` in the generator, so that the switch to the docs generator has a small diff. New members go last. If the generator reports an entry that no longer matches, remove the entry. A follow-up change deletes the file and the `TEMPORARY` code. - `scripts/codegen/compare_api.py` — compares two generated files (signatures, annotations, call bodies, docstrings) and lists every difference. Use it to check that a generator change does not change the API. - `tests/async/`, `tests/sync/` — pytest suites. Most new tests are added to the async file with a sync mirror. - `DRIVER_VERSION` — the single source of truth for which Playwright release the driver is assembled from (one line, the `playwright-core` npm version, e.g. `1.61.0`, no `v` prefix). Read by `setup.py`, `scripts/build_driver.py`, and CI. The wheel build downloads `playwright-core` at this version from npm plus the matching Node.js binary and assembles the per-platform bundles — no source build. The version is baked into the staged bundle filenames (`driver/playwright--.zip`), so it doubles as the build cache key. diff --git a/ROLLING.md b/ROLLING.md index 567748612..fddddf39f 100644 --- a/ROLLING.md +++ b/ROLLING.md @@ -14,6 +14,6 @@ pip install -e . * 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` * download the new driver: `python -m build --wheel` (fetches `playwright-core` via `npm pack` + the matching Node.js binary and assembles the bundle; no source build). * generate API from the docs (needs a nearby `microsoft/playwright` checkout at the release branch for the new version, e.g. `release-1.64`): `PW_SRC_DIR=../playwright ./scripts/update_api.sh` -* run `mypy playwright`: every error in `_generated.py` points at an implementation method in `playwright/_impl/` that lacks a new member or option. Implement it there, or record the difference in `scripts/codegen/python_rules.js`. (Temporary: while `scripts/codegen/legacy_order.json` exists, mypy does not check this yet; rely on the tests.) +* run `mypy playwright`: every error in `_generated.py` points at an implementation method in `playwright/_impl/` that lacks a new member or option. Implement it there, or record the difference in `scripts/codegen/python_rules.js`. * commit changes & send PR * wait for bots to pass & merge the PR diff --git a/playwright/_impl/_async_base.py b/playwright/_impl/_async_base.py index db7e5d005..ea90181ac 100644 --- a/playwright/_impl/_async_base.py +++ b/playwright/_impl/_async_base.py @@ -68,9 +68,7 @@ def __init__(self, impl_obj: Any) -> None: def __str__(self) -> str: return self._impl_obj.__str__() - def _wrap_handler( - self, handler: Union[Callable[..., Any], Any] - ) -> Callable[..., None]: + def _wrap_handler(self, handler: Union[Callable[..., Any], Any]) -> Any: if callable(handler): return mapping.wrap_handler(handler) return handler diff --git a/playwright/_impl/_helper.py b/playwright/_impl/_helper.py index a9a47e6e3..b3e6820a6 100644 --- a/playwright/_impl/_helper.py +++ b/playwright/_impl/_helper.py @@ -36,6 +36,7 @@ TypeVar, Union, cast, + overload, ) from urllib.parse import ParseResult, urljoin, urlparse, urlunparse @@ -591,6 +592,20 @@ def is_textual_mime_type(mime_type: str) -> bool: return bool(TEXTUAL_MIME_TYPE.match(mime_type)) +@overload +def to_milliseconds(value: Union[float, datetime.timedelta]) -> float: ... + + +@overload +def to_milliseconds(value: None) -> None: ... + + +@overload +def to_milliseconds( + value: Union[float, datetime.timedelta, None], +) -> Optional[float]: ... + + def to_milliseconds( value: Union[float, datetime.timedelta, None], ) -> Optional[float]: diff --git a/playwright/_impl/_sync_base.py b/playwright/_impl/_sync_base.py index baabeb711..35ddc7302 100644 --- a/playwright/_impl/_sync_base.py +++ b/playwright/_impl/_sync_base.py @@ -110,9 +110,7 @@ def _sync( wait_for_future(self._loop, self._dispatcher_fiber, task) return task.result() - def _wrap_handler( - self, handler: Union[Callable[..., Any], Any] - ) -> Callable[..., None]: + def _wrap_handler(self, handler: Union[Callable[..., Any], Any]) -> Any: if callable(handler): return mapping.wrap_handler(handler) return handler diff --git a/playwright/async_api/_generated.py b/playwright/async_api/_generated.py index 64327aad7..08676ec30 100644 --- a/playwright/async_api/_generated.py +++ b/playwright/async_api/_generated.py @@ -104,6 +104,7 @@ class Request(AsyncBase): + _impl_obj: RequestImpl @property def url(self) -> str: @@ -438,6 +439,7 @@ async def header_value(self, name: str) -> typing.Optional[str]: class Response(AsyncBase): + _impl_obj: ResponseImpl @property def url(self) -> str: @@ -643,7 +645,7 @@ async def finished(self) -> None: Waits for this response to finish, returns always `null`. """ - return mapping.from_maybe_impl(await self._impl_obj.finished()) + await self._impl_obj.finished() async def body(self) -> bytes: """Response.body @@ -688,6 +690,7 @@ async def json(self) -> typing.Any: class Route(AsyncBase): + _impl_obj: RouteImpl @property def request(self) -> "Request": @@ -728,7 +731,7 @@ async def abort(self, error_code: typing.Optional[str] = None) -> None: - `'failed'` - A generic failure occurred. """ - return mapping.from_maybe_impl(await self._impl_obj.abort(errorCode=error_code)) + await self._impl_obj.abort(errorCode=error_code) async def fulfill( self, @@ -782,16 +785,14 @@ async def fulfill( overridden using fulfill options. """ - return mapping.from_maybe_impl( - await self._impl_obj.fulfill( - status=status, - headers=mapping.to_impl(headers), - body=body, - json=mapping.to_impl(json), - path=path, - contentType=content_type, - response=response._impl_obj if response else None, - ) + await self._impl_obj.fulfill( + status=status, + headers=mapping.to_impl(headers), + body=body, + json=mapping.to_impl(json), + path=path, + contentType=content_type, + response=response._impl_obj if response else None, ) async def fetch( @@ -948,13 +949,11 @@ async def handle(route, request): If set changes the post data of request. """ - return mapping.from_maybe_impl( - await self._impl_obj.fallback( - url=url, - method=method, - headers=mapping.to_impl(headers), - postData=mapping.to_impl(post_data), - ) + await self._impl_obj.fallback( + url=url, + method=method, + headers=mapping.to_impl(headers), + postData=mapping.to_impl(post_data), ) async def continue_( @@ -1011,13 +1010,11 @@ async def handle(route, request): If set changes the post data of request. """ - return mapping.from_maybe_impl( - await self._impl_obj.continue_( - url=url, - method=method, - headers=mapping.to_impl(headers), - postData=mapping.to_impl(post_data), - ) + await self._impl_obj.continue_( + url=url, + method=method, + headers=mapping.to_impl(headers), + postData=mapping.to_impl(post_data), ) @@ -1025,6 +1022,7 @@ async def handle(route, request): class WebSocket(AsyncBase): + _impl_obj: WebSocketImpl @typing.overload def on( @@ -1320,6 +1318,7 @@ def is_closed(self) -> bool: class WebSocketRoute(AsyncBase): + _impl_obj: WebSocketRouteImpl @property def url(self) -> str: @@ -1376,9 +1375,7 @@ async def close( Optional [close reason](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#reason). """ - return mapping.from_maybe_impl( - await self._impl_obj.close(code=code, reason=reason) - ) + await self._impl_obj.close(code=code, reason=reason) def connect_to_server(self) -> "WebSocketRoute": """WebSocketRoute.connect_to_server @@ -1416,7 +1413,7 @@ def send(self, message: typing.Union[str, bytes]) -> None: Message to send. """ - return mapping.from_maybe_impl(self._impl_obj.send(message=message)) + self._impl_obj.send(message=message) def on_message( self, handler: typing.Callable[[typing.Union[str, bytes]], typing.Any] @@ -1440,9 +1437,7 @@ def on_message( Function that will handle messages. """ - return mapping.from_maybe_impl( - self._impl_obj.on_message(handler=self._wrap_handler(handler)) - ) + self._impl_obj.on_message(handler=self._wrap_handler(handler)) def on_close( self, @@ -1466,15 +1461,14 @@ def on_close( [close reason](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#reason). """ - return mapping.from_maybe_impl( - self._impl_obj.on_close(handler=self._wrap_handler(handler)) - ) + self._impl_obj.on_close(handler=self._wrap_handler(handler)) mapping.register(WebSocketRouteImpl, WebSocketRoute) class Keyboard(AsyncBase): + _impl_obj: KeyboardImpl async def down(self, key: str) -> None: """Keyboard.down @@ -1513,7 +1507,7 @@ async def down(self, key: str) -> None: Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. """ - return mapping.from_maybe_impl(await self._impl_obj.down(key=key)) + await self._impl_obj.down(key=key) async def up(self, key: str) -> None: """Keyboard.up @@ -1526,7 +1520,7 @@ async def up(self, key: str) -> None: Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. """ - return mapping.from_maybe_impl(await self._impl_obj.up(key=key)) + await self._impl_obj.up(key=key) async def insert_text(self, text: str) -> None: """Keyboard.insert_text @@ -1548,7 +1542,7 @@ async def insert_text(self, text: str) -> None: Sets input to the specified text value. """ - return mapping.from_maybe_impl(await self._impl_obj.insert_text(text=text)) + await self._impl_obj.insert_text(text=text) async def type(self, text: str, *, delay: typing.Optional[float] = None) -> None: """Keyboard.type @@ -1579,9 +1573,7 @@ async def type(self, text: str, *, delay: typing.Optional[float] = None) -> None Time to wait between key presses in milliseconds. Defaults to 0. """ - return mapping.from_maybe_impl( - await self._impl_obj.type(text=text, delay=delay) - ) + await self._impl_obj.type(text=text, delay=delay) async def press(self, key: str, *, delay: typing.Optional[float] = None) -> None: """Keyboard.press @@ -1632,13 +1624,14 @@ async def press(self, key: str, *, delay: typing.Optional[float] = None) -> None Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. """ - return mapping.from_maybe_impl(await self._impl_obj.press(key=key, delay=delay)) + await self._impl_obj.press(key=key, delay=delay) mapping.register(KeyboardImpl, Keyboard) class Mouse(AsyncBase): + _impl_obj: MouseImpl async def move( self, x: float, y: float, *, steps: typing.Optional[int] = None @@ -1658,7 +1651,7 @@ async def move( position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location. """ - return mapping.from_maybe_impl(await self._impl_obj.move(x=x, y=y, steps=steps)) + await self._impl_obj.move(x=x, y=y, steps=steps) async def down( self, @@ -1678,9 +1671,7 @@ async def down( defaults to 1. See [UIEvent.detail]. """ - return mapping.from_maybe_impl( - await self._impl_obj.down(button=button, clickCount=click_count) - ) + await self._impl_obj.down(button=button, clickCount=click_count) async def up( self, @@ -1700,9 +1691,7 @@ async def up( defaults to 1. See [UIEvent.detail]. """ - return mapping.from_maybe_impl( - await self._impl_obj.up(button=button, clickCount=click_count) - ) + await self._impl_obj.up(button=button, clickCount=click_count) async def click( self, @@ -1731,10 +1720,8 @@ async def click( defaults to 1. See [UIEvent.detail]. """ - return mapping.from_maybe_impl( - await self._impl_obj.click( - x=x, y=y, delay=delay, button=button, clickCount=click_count - ) + await self._impl_obj.click( + x=x, y=y, delay=delay, button=button, clickCount=click_count ) async def dblclick( @@ -1762,9 +1749,7 @@ async def dblclick( Defaults to `left`. """ - return mapping.from_maybe_impl( - await self._impl_obj.dblclick(x=x, y=y, delay=delay, button=button) - ) + await self._impl_obj.dblclick(x=x, y=y, delay=delay, button=button) async def wheel(self, delta_x: float, delta_y: float) -> None: """Mouse.wheel @@ -1783,15 +1768,14 @@ async def wheel(self, delta_x: float, delta_y: float) -> None: Pixels to scroll vertically. """ - return mapping.from_maybe_impl( - await self._impl_obj.wheel(deltaX=delta_x, deltaY=delta_y) - ) + await self._impl_obj.wheel(deltaX=delta_x, deltaY=delta_y) mapping.register(MouseImpl, Mouse) class Touchscreen(AsyncBase): + _impl_obj: TouchscreenImpl async def tap(self, x: float, y: float) -> None: """Touchscreen.tap @@ -1808,13 +1792,14 @@ async def tap(self, x: float, y: float) -> None: Y coordinate relative to the main frame's viewport in CSS pixels. """ - return mapping.from_maybe_impl(await self._impl_obj.tap(x=x, y=y)) + await self._impl_obj.tap(x=x, y=y) mapping.register(TouchscreenImpl, Touchscreen) class JSHandle(AsyncBase): + _impl_obj: JSHandleImpl async def evaluate( self, expression: str, arg: typing.Optional[typing.Any] = None @@ -1949,7 +1934,7 @@ async def dispose(self) -> None: The `jsHandle.dispose` method stops referencing the element handle. """ - return mapping.from_maybe_impl(await self._impl_obj.dispose()) + await self._impl_obj.dispose() async def json_value(self) -> typing.Any: """JSHandle.json_value @@ -1971,6 +1956,7 @@ async def json_value(self) -> typing.Any: class ElementHandle(JSHandle): + _impl_obj: ElementHandleImpl async def owner_frame(self) -> typing.Optional["Frame"]: """ElementHandle.owner_frame @@ -2167,10 +2153,8 @@ async def dispatch_event( Optional event-specific initialization properties. """ - return mapping.from_maybe_impl( - await self._impl_obj.dispatch_event( - type=type, eventInit=mapping.to_impl(event_init) - ) + await self._impl_obj.dispatch_event( + type=type, eventInit=mapping.to_impl(event_init) ) async def scroll_into_view_if_needed( @@ -2196,10 +2180,8 @@ async def scroll_into_view_if_needed( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.scroll_into_view_if_needed( - timeout=to_milliseconds(timeout) - ) + await self._impl_obj.scroll_into_view_if_needed( + timeout=to_milliseconds(timeout) ) async def hover( @@ -2254,16 +2236,14 @@ async def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.hover( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.hover( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + trial=trial, + scroll=scroll, ) async def click( @@ -2334,20 +2314,18 @@ async def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.click( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + await self._impl_obj.click( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) async def dblclick( @@ -2414,19 +2392,17 @@ async def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.dblclick( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + await self._impl_obj.dblclick( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) async def select_option( @@ -2559,16 +2535,14 @@ async def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.tap( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.tap( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def fill( @@ -2605,13 +2579,11 @@ async def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - await self._impl_obj.fill( - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - ) + await self._impl_obj.fill( + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, ) async def select_text( @@ -2638,11 +2610,7 @@ async def select_text( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.select_text( - force=force, timeout=to_milliseconds(timeout) - ) - ) + await self._impl_obj.select_text(force=force, timeout=to_milliseconds(timeout)) async def input_value( self, @@ -2706,12 +2674,10 @@ async def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_input_files( - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.set_input_files( + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def focus(self) -> None: @@ -2720,7 +2686,7 @@ async def focus(self) -> None: Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element. """ - return mapping.from_maybe_impl(await self._impl_obj.focus()) + await self._impl_obj.focus() async def type( self, @@ -2753,13 +2719,11 @@ async def type( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.type( - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.type( + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def press( @@ -2810,13 +2774,11 @@ async def press( Deprecated: This option will default to `true` in the future. """ - return mapping.from_maybe_impl( - await self._impl_obj.press( - key=key, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.press( + key=key, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def set_checked( @@ -2869,16 +2831,14 @@ async def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_checked( - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.set_checked( + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def check( @@ -2929,15 +2889,13 @@ async def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.check( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.check( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def uncheck( @@ -2988,15 +2946,13 @@ async def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.uncheck( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.uncheck( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def bounding_box(self) -> typing.Optional[FloatRect]: @@ -3286,10 +3242,8 @@ async def wait_for_element_state( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_element_state( - state=state, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.wait_for_element_state( + state=state, timeout=to_milliseconds(timeout) ) async def wait_for_selector( @@ -3361,6 +3315,7 @@ async def wait_for_selector( class FileChooser(AsyncBase): + _impl_obj: FileChooserImpl @property def page(self) -> "Page": @@ -3427,12 +3382,10 @@ async def set_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_files( - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.set_files( + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) @@ -3440,6 +3393,7 @@ async def set_files( class Frame(AsyncBase): + _impl_obj: FrameImpl @property def page(self) -> "Page": @@ -3688,12 +3642,10 @@ async def wait_for_url( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_url( - url=self._wrap_handler(url), - waitUntil=wait_until, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.wait_for_url( + url=self._wrap_handler(url), + waitUntil=wait_until, + timeout=to_milliseconds(timeout), ) async def wait_for_load_state( @@ -3738,10 +3690,8 @@ async def wait_for_load_state( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_load_state( - state=state, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.wait_for_load_state( + state=state, timeout=to_milliseconds(timeout) ) async def frame_element(self) -> "ElementHandle": @@ -4260,14 +4210,12 @@ async def dispatch_event( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.dispatch_event( - selector=selector, - type=type, - eventInit=mapping.to_impl(event_init), - strict=strict, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.dispatch_event( + selector=selector, + type=type, + eventInit=mapping.to_impl(event_init), + strict=strict, + timeout=to_milliseconds(timeout), ) async def eval_on_selector( @@ -4418,10 +4366,8 @@ async def set_content( loading. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_content( - html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until - ) + await self._impl_obj.set_content( + html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until ) def is_detached(self) -> bool: @@ -4581,21 +4527,19 @@ async def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.click( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.click( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def dblclick( @@ -4669,20 +4613,18 @@ async def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.dblclick( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.dblclick( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def tap( @@ -4749,18 +4691,16 @@ async def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.tap( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.tap( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def fill( @@ -4806,15 +4746,13 @@ async def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - await self._impl_obj.fill( - selector=selector, - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - force=force, - ) + await self._impl_obj.fill( + selector=selector, + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, + force=force, ) def locator( @@ -5411,10 +5349,8 @@ async def focus( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.focus( - selector=selector, strict=strict, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.focus( + selector=selector, strict=strict, timeout=to_milliseconds(timeout) ) async def text_content( @@ -5621,18 +5557,16 @@ async def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.hover( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.hover( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + strict=strict, + trial=trial, + scroll=scroll, ) async def drag_and_drop( @@ -5690,20 +5624,18 @@ async def drag_and_drop( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.drag_and_drop( - source=source, - target=target, - sourcePosition=source_position, - targetPosition=target_position, - force=force, - noWaitAfter=no_wait_after, - strict=strict, - timeout=to_milliseconds(timeout), - trial=trial, - steps=steps, - scroll=scroll, - ) + await self._impl_obj.drag_and_drop( + source=source, + target=target, + sourcePosition=source_position, + targetPosition=target_position, + force=force, + noWaitAfter=no_wait_after, + strict=strict, + timeout=to_milliseconds(timeout), + trial=trial, + steps=steps, + scroll=scroll, ) async def select_option( @@ -5871,14 +5803,12 @@ async def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_input_files( - selector=selector, - files=mapping.to_impl(files), - strict=strict, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.set_input_files( + selector=selector, + files=mapping.to_impl(files), + strict=strict, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def type( @@ -5920,15 +5850,13 @@ async def type( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.type( - selector=selector, - text=text, - delay=delay, - strict=strict, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.type( + selector=selector, + text=text, + delay=delay, + strict=strict, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def press( @@ -5985,15 +5913,13 @@ async def press( Deprecated: This option will default to `true` in the future. """ - return mapping.from_maybe_impl( - await self._impl_obj.press( - selector=selector, - key=key, - delay=delay, - strict=strict, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.press( + selector=selector, + key=key, + delay=delay, + strict=strict, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def check( @@ -6052,17 +5978,15 @@ async def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.check( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.check( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def uncheck( @@ -6121,17 +6045,15 @@ async def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.uncheck( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.uncheck( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def wait_for_timeout( @@ -6150,9 +6072,7 @@ async def wait_for_timeout( A timeout to wait for """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout)) async def wait_for_function( self, @@ -6296,18 +6216,16 @@ async def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_checked( - selector=selector, - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.set_checked( + selector=selector, + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) @@ -6315,6 +6233,7 @@ async def set_checked( class FrameLocator(AsyncBase): + _impl_obj: FrameLocatorImpl @property def first(self) -> "FrameLocator": @@ -6931,6 +6850,7 @@ def nth(self, index: int) -> "FrameLocator": class Worker(AsyncBase): + _impl_obj: WorkerImpl @typing.overload def on( @@ -7140,6 +7060,7 @@ def expect_event( class Selectors(AsyncBase): + _impl_obj: SelectorsImpl async def register( self, @@ -7212,10 +7133,8 @@ async def main(): script is not guaranteed when this engine is used together with other registered engines. """ - return mapping.from_maybe_impl( - await self._impl_obj.register( - name=name, script=script, path=path, contentScript=content_script - ) + await self._impl_obj.register( + name=name, script=script, path=path, contentScript=content_script ) def set_test_id_attribute(self, attribute_name: str) -> None: @@ -7230,15 +7149,14 @@ def set_test_id_attribute(self, attribute_name: str) -> None: `"data-pw,data-ti"`. """ - return mapping.from_maybe_impl( - self._impl_obj.set_test_id_attribute(attributeName=attribute_name) - ) + self._impl_obj.set_test_id_attribute(attributeName=attribute_name) mapping.register(SelectorsImpl, Selectors) class Clock(AsyncBase): + _impl_obj: ClockImpl async def install( self, @@ -7270,7 +7188,7 @@ async def install( Time to initialize with, current system time by default. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl(await self._impl_obj.install(time=time)) + await self._impl_obj.install(time=time) async def fast_forward(self, ticks: typing.Union[int, str]) -> None: """Clock.fast_forward @@ -7292,7 +7210,7 @@ async def fast_forward(self, ticks: typing.Union[int, str]) -> None: "08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds. """ - return mapping.from_maybe_impl(await self._impl_obj.fast_forward(ticks=ticks)) + await self._impl_obj.fast_forward(ticks=ticks) async def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> None: """Clock.pause_at @@ -7329,7 +7247,7 @@ async def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> N Time to pause at. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl(await self._impl_obj.pause_at(time=time)) + await self._impl_obj.pause_at(time=time) async def resume(self) -> None: """Clock.resume @@ -7337,7 +7255,7 @@ async def resume(self) -> None: Resumes timers. Once this method is called, time resumes flowing, timers are fired as usual. """ - return mapping.from_maybe_impl(await self._impl_obj.resume()) + await self._impl_obj.resume() async def run_for(self, ticks: typing.Union[int, str]) -> None: """Clock.run_for @@ -7358,7 +7276,7 @@ async def run_for(self, ticks: typing.Union[int, str]) -> None: "08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds. """ - return mapping.from_maybe_impl(await self._impl_obj.run_for(ticks=ticks)) + await self._impl_obj.run_for(ticks=ticks) async def set_fixed_time( self, time: typing.Union[float, str, datetime.datetime] @@ -7384,7 +7302,7 @@ async def set_fixed_time( Time to be set. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl(await self._impl_obj.set_fixed_time(time=time)) + await self._impl_obj.set_fixed_time(time=time) async def set_system_time( self, time: typing.Union[float, str, datetime.datetime] @@ -7408,13 +7326,14 @@ async def set_system_time( Time to be set. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl(await self._impl_obj.set_system_time(time=time)) + await self._impl_obj.set_system_time(time=time) mapping.register(ClockImpl, Clock) class Credentials(AsyncBase): + _impl_obj: CredentialsImpl async def install(self) -> None: """Credentials.install @@ -7428,7 +7347,7 @@ async def install(self) -> None: installing populates the authenticator, but the page will never see those credentials. """ - return mapping.from_maybe_impl(await self._impl_obj.install()) + await self._impl_obj.install() async def create( self, @@ -7500,7 +7419,7 @@ async def delete(self, id: str) -> None: Base64url-encoded credential id. """ - return mapping.from_maybe_impl(await self._impl_obj.delete(id=id)) + await self._impl_obj.delete(id=id) async def get( self, *, rp_id: typing.Optional[str] = None, id: typing.Optional[str] = None @@ -7534,6 +7453,7 @@ async def get( class ConsoleMessage(AsyncBase): + _impl_obj: ConsoleMessageImpl @property def type( @@ -7643,6 +7563,7 @@ def worker(self) -> typing.Optional["Worker"]: class Debugger(AsyncBase): + _impl_obj: DebuggerImpl @typing.overload def on( @@ -7715,7 +7636,7 @@ async def request_pause(self) -> None: configures the debugger to pause before the next action is executed. """ - return mapping.from_maybe_impl(await self._impl_obj.request_pause()) + await self._impl_obj.request_pause() async def resume(self) -> None: """Debugger.resume @@ -7723,7 +7644,7 @@ async def resume(self) -> None: Resumes script execution. Throws if the debugger is not paused. """ - return mapping.from_maybe_impl(await self._impl_obj.resume()) + await self._impl_obj.resume() async def next(self) -> None: """Debugger.next @@ -7731,7 +7652,7 @@ async def next(self) -> None: Resumes script execution and pauses again before the next action. Throws if the debugger is not paused. """ - return mapping.from_maybe_impl(await self._impl_obj.next()) + await self._impl_obj.next() async def run_to(self, location: DebuggerLocation) -> None: """Debugger.run_to @@ -7745,13 +7666,14 @@ async def run_to(self, location: DebuggerLocation) -> None: The source location to pause at. """ - return mapping.from_maybe_impl(await self._impl_obj.run_to(location=location)) + await self._impl_obj.run_to(location=location) mapping.register(DebuggerImpl, Debugger) class Dialog(AsyncBase): + _impl_obj: DialogImpl @property def type(self) -> str: @@ -7812,9 +7734,7 @@ async def accept(self, prompt_text: typing.Optional[str] = None) -> None: A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional. """ - return mapping.from_maybe_impl( - await self._impl_obj.accept(promptText=prompt_text) - ) + await self._impl_obj.accept(promptText=prompt_text) async def dismiss(self) -> None: """Dialog.dismiss @@ -7822,13 +7742,14 @@ async def dismiss(self) -> None: Returns when the dialog has been dismissed. """ - return mapping.from_maybe_impl(await self._impl_obj.dismiss()) + await self._impl_obj.dismiss() mapping.register(DialogImpl, Dialog) class Download(AsyncBase): + _impl_obj: DownloadImpl @property def page(self) -> "Page": @@ -7875,7 +7796,7 @@ async def delete(self) -> None: Deletes the downloaded file. Will wait for the download to finish if necessary. """ - return mapping.from_maybe_impl(await self._impl_obj.delete()) + await self._impl_obj.delete() async def failure(self) -> typing.Optional[str]: """Download.failure @@ -7923,7 +7844,7 @@ async def save_as(self, path: typing.Union[str, pathlib.Path]) -> None: Path where the download should be copied. """ - return mapping.from_maybe_impl(await self._impl_obj.save_as(path=path)) + await self._impl_obj.save_as(path=path) async def cancel(self) -> None: """Download.cancel @@ -7932,13 +7853,14 @@ async def cancel(self) -> None: `download.failure()` would resolve to `'canceled'`. """ - return mapping.from_maybe_impl(await self._impl_obj.cancel()) + await self._impl_obj.cancel() mapping.register(DownloadImpl, Download) class Screencast(AsyncBase): + _impl_obj: ScreencastImpl async def start( self, @@ -8000,7 +7922,7 @@ async def stop(self) -> None: in `screencast.start()`. """ - return mapping.from_maybe_impl(await self._impl_obj.stop()) + await self._impl_obj.stop() async def show_actions( self, @@ -8057,7 +7979,7 @@ async def hide_actions(self) -> None: Removes action decorations. """ - return mapping.from_maybe_impl(await self._impl_obj.hide_actions()) + await self._impl_obj.hide_actions() async def show_overlay( self, html: str, *, duration: typing.Optional[float] = None @@ -8106,10 +8028,8 @@ async def show_chapter( Duration in milliseconds after which the overlay is automatically removed. Defaults to `2000`. """ - return mapping.from_maybe_impl( - await self._impl_obj.show_chapter( - title=title, description=description, duration=duration - ) + await self._impl_obj.show_chapter( + title=title, description=description, duration=duration ) async def show_overlays(self) -> None: @@ -8118,7 +8038,7 @@ async def show_overlays(self) -> None: Shows overlays. """ - return mapping.from_maybe_impl(await self._impl_obj.show_overlays()) + await self._impl_obj.show_overlays() async def hide_overlays(self) -> None: """Screencast.hide_overlays @@ -8126,13 +8046,14 @@ async def hide_overlays(self) -> None: Hides overlays without removing them. """ - return mapping.from_maybe_impl(await self._impl_obj.hide_overlays()) + await self._impl_obj.hide_overlays() mapping.register(ScreencastImpl, Screencast) class Video(AsyncBase): + _impl_obj: VideoImpl async def path(self) -> pathlib.Path: """Video.path @@ -8159,7 +8080,7 @@ async def save_as(self, path: typing.Union[str, pathlib.Path]) -> None: Path where the video should be saved. """ - return mapping.from_maybe_impl(await self._impl_obj.save_as(path=path)) + await self._impl_obj.save_as(path=path) async def delete(self) -> None: """Video.delete @@ -8167,13 +8088,14 @@ async def delete(self) -> None: Deletes the video file. Will wait for the video to finish if necessary. """ - return mapping.from_maybe_impl(await self._impl_obj.delete()) + await self._impl_obj.delete() mapping.register(VideoImpl, Video) class WebMCP(AsyncBase): + _impl_obj: WebMCPImpl async def tools( self, @@ -8244,6 +8166,7 @@ async def call_tool( class Page(AsyncContextManager): + _impl_obj: PageImpl @typing.overload def on( @@ -9071,11 +8994,7 @@ def set_default_navigation_timeout( Maximum navigation time in milliseconds """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_navigation_timeout( - timeout=to_milliseconds(timeout) - ) - ) + self._impl_obj.set_default_navigation_timeout(timeout=to_milliseconds(timeout)) def set_default_timeout( self, timeout: typing.Union[float, datetime.timedelta] @@ -9092,9 +9011,7 @@ def set_default_timeout( Maximum time in milliseconds. Pass `0` to disable timeout. """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) - ) + self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) async def query_selector( self, selector: str, *, strict: typing.Optional[bool] = None @@ -9485,14 +9402,12 @@ async def dispatch_event( element, the call throws an exception. """ - return mapping.from_maybe_impl( - await self._impl_obj.dispatch_event( - selector=selector, - type=type, - eventInit=mapping.to_impl(event_init), - timeout=to_milliseconds(timeout), - strict=strict, - ) + await self._impl_obj.dispatch_event( + selector=selector, + type=type, + eventInit=mapping.to_impl(event_init), + timeout=to_milliseconds(timeout), + strict=strict, ) async def evaluate( @@ -9910,11 +9825,7 @@ async def set_extra_http_headers(self, headers: typing.Dict[str, str]) -> None: An object containing additional HTTP headers to be sent with every request. All header values must be strings. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_extra_http_headers( - headers=mapping.to_impl(headers) - ) - ) + await self._impl_obj.set_extra_http_headers(headers=mapping.to_impl(headers)) async def content(self, *, include_shadow: typing.Optional[bool] = None) -> str: """Page.content @@ -9971,10 +9882,8 @@ async def set_content( loading. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_content( - html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until - ) + await self._impl_obj.set_content( + html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until ) async def goto( @@ -10138,10 +10047,8 @@ async def wait_for_load_state( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_load_state( - state=state, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.wait_for_load_state( + state=state, timeout=to_milliseconds(timeout) ) async def wait_for_url( @@ -10185,12 +10092,10 @@ async def wait_for_url( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_url( - url=self._wrap_handler(url), - waitUntil=wait_until, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.wait_for_url( + url=self._wrap_handler(url), + waitUntil=wait_until, + timeout=to_milliseconds(timeout), ) @typing.overload @@ -10536,7 +10441,7 @@ async def request_gc(self) -> None: ``` """ - return mapping.from_maybe_impl(await self._impl_obj.request_gc()) + await self._impl_obj.request_gc() async def emulate_media( self, @@ -10601,14 +10506,12 @@ async def emulate_media( contrast : Union["more", "no-preference", "null", None] """ - return mapping.from_maybe_impl( - await self._impl_obj.emulate_media( - media=media, - colorScheme=color_scheme, - reducedMotion=reduced_motion, - forcedColors=forced_colors, - contrast=contrast, - ) + await self._impl_obj.emulate_media( + media=media, + colorScheme=color_scheme, + reducedMotion=reduced_motion, + forcedColors=forced_colors, + contrast=contrast, ) async def set_viewport_size(self, viewport_size: ViewportSize) -> None: @@ -10635,9 +10538,7 @@ async def set_viewport_size(self, viewport_size: ViewportSize) -> None: viewport_size : {width: int, height: int} """ - return mapping.from_maybe_impl( - await self._impl_obj.set_viewport_size(viewportSize=viewport_size) - ) + await self._impl_obj.set_viewport_size(viewportSize=viewport_size) async def bring_to_front(self) -> None: """Page.bring_to_front @@ -10645,7 +10546,7 @@ async def bring_to_front(self) -> None: Brings page to front (activates tab). """ - return mapping.from_maybe_impl(await self._impl_obj.bring_to_front()) + await self._impl_obj.bring_to_front() async def hide_highlight(self) -> None: """Page.hide_highlight @@ -10653,7 +10554,7 @@ async def hide_highlight(self) -> None: Hide all locator highlight overlays previously added by `locator.highlight()` on this page. """ - return mapping.from_maybe_impl(await self._impl_obj.hide_highlight()) + await self._impl_obj.hide_highlight() async def add_init_script( self, @@ -10814,10 +10715,8 @@ async def unroute( Optional handler function to route the request. """ - return mapping.from_maybe_impl( - await self._impl_obj.unroute( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + await self._impl_obj.unroute( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) async def route_web_socket( @@ -10857,10 +10756,8 @@ def handler(ws: WebSocketRoute): Handler function to route the WebSocket. """ - return mapping.from_maybe_impl( - await self._impl_obj.route_web_socket( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + await self._impl_obj.route_web_socket( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) async def unroute_all( @@ -10883,9 +10780,7 @@ async def unroute_all( after unrouting are silently caught """ - return mapping.from_maybe_impl( - await self._impl_obj.unroute_all(behavior=behavior) - ) + await self._impl_obj.unroute_all(behavior=behavior) async def route_from_har( self, @@ -10931,15 +10826,13 @@ async def route_from_har( `minimal`. """ - return mapping.from_maybe_impl( - await self._impl_obj.route_from_har( - har=har, - url=url, - notFound=not_found, - update=update, - updateContent=update_content, - updateMode=update_mode, - ) + await self._impl_obj.route_from_har( + har=har, + url=url, + notFound=not_found, + update=update, + updateContent=update_content, + updateMode=update_mode, ) async def screenshot( @@ -11113,9 +11006,7 @@ async def close( The reason to be reported to the operations interrupted by the page closure. """ - return mapping.from_maybe_impl( - await self._impl_obj.close(runBeforeUnload=run_before_unload, reason=reason) - ) + await self._impl_obj.close(runBeforeUnload=run_before_unload, reason=reason) def is_closed(self) -> bool: """Page.is_closed @@ -11203,21 +11094,19 @@ async def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.click( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - strict=strict, - scroll=scroll, - ) + await self._impl_obj.click( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + strict=strict, + scroll=scroll, ) async def dblclick( @@ -11290,20 +11179,18 @@ async def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.dblclick( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.dblclick( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def tap( @@ -11370,18 +11257,16 @@ async def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.tap( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.tap( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def fill( @@ -11427,15 +11312,13 @@ async def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - await self._impl_obj.fill( - selector=selector, - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - force=force, - ) + await self._impl_obj.fill( + selector=selector, + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, + force=force, ) def locator( @@ -12057,10 +11940,8 @@ async def focus( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.focus( - selector=selector, strict=strict, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.focus( + selector=selector, strict=strict, timeout=to_milliseconds(timeout) ) async def text_content( @@ -12267,18 +12148,16 @@ async def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.hover( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.hover( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + strict=strict, + trial=trial, + scroll=scroll, ) async def drag_and_drop( @@ -12352,20 +12231,18 @@ async def drag_and_drop( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.drag_and_drop( - source=source, - target=target, - sourcePosition=source_position, - targetPosition=target_position, - force=force, - noWaitAfter=no_wait_after, - timeout=to_milliseconds(timeout), - strict=strict, - trial=trial, - steps=steps, - scroll=scroll, - ) + await self._impl_obj.drag_and_drop( + source=source, + target=target, + sourcePosition=source_position, + targetPosition=target_position, + force=force, + noWaitAfter=no_wait_after, + timeout=to_milliseconds(timeout), + strict=strict, + trial=trial, + steps=steps, + scroll=scroll, ) async def select_option( @@ -12535,14 +12412,12 @@ async def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_input_files( - selector=selector, - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - strict=strict, - noWaitAfter=no_wait_after, - ) + await self._impl_obj.set_input_files( + selector=selector, + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + strict=strict, + noWaitAfter=no_wait_after, ) async def type( @@ -12584,15 +12459,13 @@ async def type( element, the call throws an exception. """ - return mapping.from_maybe_impl( - await self._impl_obj.type( - selector=selector, - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - ) + await self._impl_obj.type( + selector=selector, + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, ) async def press( @@ -12665,15 +12538,13 @@ async def press( element, the call throws an exception. """ - return mapping.from_maybe_impl( - await self._impl_obj.press( - selector=selector, - key=key, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - ) + await self._impl_obj.press( + selector=selector, + key=key, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, ) async def check( @@ -12732,17 +12603,15 @@ async def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.check( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.check( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def uncheck( @@ -12801,17 +12670,15 @@ async def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.uncheck( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.uncheck( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def wait_for_timeout( @@ -12837,9 +12704,7 @@ async def wait_for_timeout( A timeout to wait for """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout)) async def wait_for_function( self, @@ -12924,7 +12789,7 @@ async def pause(self) -> None: **NOTE** This method requires Playwright to be started in a headed mode, with a falsy `headless` option. """ - return mapping.from_maybe_impl(await self._impl_obj.pause()) + await self._impl_obj.pause() async def pdf( self, @@ -13743,18 +13608,16 @@ async def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_checked( - selector=selector, - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.set_checked( + selector=selector, + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) async def add_locator_handler( @@ -13871,13 +13734,11 @@ async def handler(locator): Specifies the maximum number of times this handler should be called. Unlimited by default. """ - return mapping.from_maybe_impl( - await self._impl_obj.add_locator_handler( - locator=locator._impl_obj, - handler=self._wrap_handler(handler), - noWaitAfter=no_wait_after, - times=times, - ) + await self._impl_obj.add_locator_handler( + locator=locator._impl_obj, + handler=self._wrap_handler(handler), + noWaitAfter=no_wait_after, + times=times, ) async def remove_locator_handler(self, locator: "Locator") -> None: @@ -13891,9 +13752,7 @@ async def remove_locator_handler(self, locator: "Locator") -> None: Locator passed to `page.add_locator_handler()`. """ - return mapping.from_maybe_impl( - await self._impl_obj.remove_locator_handler(locator=locator._impl_obj) - ) + await self._impl_obj.remove_locator_handler(locator=locator._impl_obj) async def requests(self) -> typing.List["Request"]: """Page.requests @@ -13961,7 +13820,7 @@ async def clear_console_messages(self) -> None: return messages logged after the clear. """ - return mapping.from_maybe_impl(await self._impl_obj.clear_console_messages()) + await self._impl_obj.clear_console_messages() async def clear_page_errors(self) -> None: """Page.clear_page_errors @@ -13970,7 +13829,7 @@ async def clear_page_errors(self) -> None: errors thrown after the clear. """ - return mapping.from_maybe_impl(await self._impl_obj.clear_page_errors()) + await self._impl_obj.clear_page_errors() async def pick_locator(self) -> "Locator": """Page.pick_locator @@ -13999,13 +13858,14 @@ async def cancel_pick_locator(self) -> None: active, this method is a no-op. """ - return mapping.from_maybe_impl(await self._impl_obj.cancel_pick_locator()) + await self._impl_obj.cancel_pick_locator() mapping.register(PageImpl, Page) class WebError(AsyncBase): + _impl_obj: WebErrorImpl @property def page(self) -> typing.Optional["Page"]: @@ -14046,6 +13906,7 @@ def location(self) -> WebErrorLocation: class WebStorage(AsyncBase): + _impl_obj: WebStorageImpl async def items(self) -> typing.List[NameValue]: """WebStorage.items @@ -14089,9 +13950,7 @@ async def set_item(self, name: str, value: str) -> None: New value for the item. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_item(name=name, value=value) - ) + await self._impl_obj.set_item(name=name, value=value) async def remove_item(self, name: str) -> None: """WebStorage.remove_item @@ -14104,7 +13963,7 @@ async def remove_item(self, name: str) -> None: Name of the item to remove. """ - return mapping.from_maybe_impl(await self._impl_obj.remove_item(name=name)) + await self._impl_obj.remove_item(name=name) async def clear(self) -> None: """WebStorage.clear @@ -14112,13 +13971,14 @@ async def clear(self) -> None: Removes all items from the storage. """ - return mapping.from_maybe_impl(await self._impl_obj.clear()) + await self._impl_obj.clear() mapping.register(WebStorageImpl, WebStorage) class BrowserContext(AsyncContextManager): + _impl_obj: BrowserContextImpl @typing.overload def on( @@ -14748,11 +14608,7 @@ def set_default_navigation_timeout( Maximum navigation time in milliseconds """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_navigation_timeout( - timeout=to_milliseconds(timeout) - ) - ) + self._impl_obj.set_default_navigation_timeout(timeout=to_milliseconds(timeout)) def set_default_timeout( self, timeout: typing.Union[float, datetime.timedelta] @@ -14771,9 +14627,7 @@ def set_default_timeout( Maximum time in milliseconds. Pass `0` to disable timeout. """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) - ) + self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) async def new_page(self) -> "Page": """BrowserContext.new_page @@ -14826,9 +14680,7 @@ async def add_cookies(self, cookies: typing.Sequence[SetCookieParam]) -> None: cookies : Sequence[{name: str, value: str, url: Union[str, None], domain: Union[str, None], path: Union[str, None], expires: Union[float, None], httpOnly: Union[bool, None], secure: Union[bool, None], sameSite: Union["Lax", "None", "Strict", None], partitionKey: Union[str, None]}] """ - return mapping.from_maybe_impl( - await self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies)) - ) + await self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies)) async def clear_cookies( self, @@ -14861,9 +14713,7 @@ async def clear_cookies( Only removes cookies with the given path. """ - return mapping.from_maybe_impl( - await self._impl_obj.clear_cookies(name=name, domain=domain, path=path) - ) + await self._impl_obj.clear_cookies(name=name, domain=domain, path=path) async def grant_permissions( self, permissions: typing.Sequence[str], *, origin: typing.Optional[str] = None @@ -14904,10 +14754,8 @@ async def grant_permissions( The [origin] to grant permissions to, e.g. "https://example.com". """ - return mapping.from_maybe_impl( - await self._impl_obj.grant_permissions( - permissions=mapping.to_impl(permissions), origin=origin - ) + await self._impl_obj.grant_permissions( + permissions=mapping.to_impl(permissions), origin=origin ) async def clear_permissions(self) -> None: @@ -14925,7 +14773,7 @@ async def clear_permissions(self) -> None: ``` """ - return mapping.from_maybe_impl(await self._impl_obj.clear_permissions()) + await self._impl_obj.clear_permissions() async def set_geolocation( self, geolocation: typing.Optional[Geolocation] = None @@ -14948,9 +14796,7 @@ async def set_geolocation( geolocation : Union[{latitude: float, longitude: float, accuracy: Union[float, None]}, None] """ - return mapping.from_maybe_impl( - await self._impl_obj.set_geolocation(geolocation=geolocation) - ) + await self._impl_obj.set_geolocation(geolocation=geolocation) async def set_extra_http_headers(self, headers: typing.Dict[str, str]) -> None: """BrowserContext.set_extra_http_headers @@ -14968,11 +14814,7 @@ async def set_extra_http_headers(self, headers: typing.Dict[str, str]) -> None: An object containing additional HTTP headers to be sent with every request. All header values must be strings. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_extra_http_headers( - headers=mapping.to_impl(headers) - ) - ) + await self._impl_obj.set_extra_http_headers(headers=mapping.to_impl(headers)) async def set_offline(self, offline: bool) -> None: """BrowserContext.set_offline @@ -14989,9 +14831,7 @@ async def set_offline(self, offline: bool) -> None: """ - return mapping.from_maybe_impl( - await self._impl_obj.set_offline(offline=offline) - ) + await self._impl_obj.set_offline(offline=offline) async def add_init_script( self, @@ -15277,10 +15117,8 @@ async def unroute( Optional handler function used to register a routing with `browser_context.route()`. """ - return mapping.from_maybe_impl( - await self._impl_obj.unroute( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + await self._impl_obj.unroute( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) async def route_web_socket( @@ -15322,10 +15160,8 @@ async def handler(ws: WebSocketRoute): Handler function to route the WebSocket. """ - return mapping.from_maybe_impl( - await self._impl_obj.route_web_socket( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + await self._impl_obj.route_web_socket( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) async def unroute_all( @@ -15348,9 +15184,7 @@ async def unroute_all( after unrouting are silently caught """ - return mapping.from_maybe_impl( - await self._impl_obj.unroute_all(behavior=behavior) - ) + await self._impl_obj.unroute_all(behavior=behavior) async def route_from_har( self, @@ -15396,15 +15230,13 @@ async def route_from_har( `minimal`. """ - return mapping.from_maybe_impl( - await self._impl_obj.route_from_har( - har=har, - url=url, - notFound=not_found, - update=update, - updateContent=update_content, - updateMode=update_mode, - ) + await self._impl_obj.route_from_har( + har=har, + url=url, + notFound=not_found, + update=update, + updateContent=update_content, + updateMode=update_mode, ) @typing.overload @@ -15646,7 +15478,7 @@ async def close(self, *, reason: typing.Optional[str] = None) -> None: The reason to be reported to the operations interrupted by the context closure. """ - return mapping.from_maybe_impl(await self._impl_obj.close(reason=reason)) + await self._impl_obj.close(reason=reason) async def storage_state( self, @@ -15722,9 +15554,7 @@ async def set_storage_state( information obtained via `browser_context.storage_state()`. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_storage_state(storageState=storage_state) - ) + await self._impl_obj.set_storage_state(storageState=storage_state) @typing.overload async def wait_for_event( @@ -16029,6 +15859,7 @@ async def new_cdp_session( class CDPSession(AsyncBase): + _impl_obj: CDPSessionImpl @typing.overload def on( @@ -16110,13 +15941,14 @@ async def detach(self) -> None: used to send messages. """ - return mapping.from_maybe_impl(await self._impl_obj.detach()) + await self._impl_obj.detach() mapping.register(CDPSessionImpl, CDPSession) class Browser(AsyncContextManager): + _impl_obj: BrowserImpl @typing.overload def on( @@ -16762,7 +16594,7 @@ async def close(self, *, reason: typing.Optional[str] = None) -> None: The reason to be reported to the operations interrupted by the browser closure. """ - return mapping.from_maybe_impl(await self._impl_obj.close(reason=reason)) + await self._impl_obj.close(reason=reason) async def new_browser_cdp_session(self) -> "CDPSession": """Browser.new_browser_cdp_session @@ -16819,7 +16651,7 @@ async def unbind(self) -> None: Unbinds the browser server previously bound with `browser.bind()`. """ - return mapping.from_maybe_impl(await self._impl_obj.unbind()) + await self._impl_obj.unbind() async def start_tracing( self, @@ -16859,13 +16691,11 @@ async def start_tracing( specify custom categories to use instead of default. """ - return mapping.from_maybe_impl( - await self._impl_obj.start_tracing( - page=page._impl_obj if page else None, - path=path, - screenshots=screenshots, - categories=mapping.to_impl(categories), - ) + await self._impl_obj.start_tracing( + page=page._impl_obj if page else None, + path=path, + screenshots=screenshots, + categories=mapping.to_impl(categories), ) async def stop_tracing(self) -> bytes: @@ -16890,6 +16720,7 @@ async def stop_tracing(self) -> bytes: class BrowserType(AsyncBase): + _impl_obj: BrowserTypeImpl @property def name(self) -> str: @@ -17538,6 +17369,7 @@ async def connect( class Playwright(AsyncBase): + _impl_obj: PlaywrightImpl @property def devices(self) -> typing.Dict: @@ -17657,13 +17489,14 @@ async def stop(self) -> None: ``` """ - return mapping.from_maybe_impl(await self._impl_obj.stop()) + await self._impl_obj.stop() mapping.register(PlaywrightImpl, Playwright) class Tracing(AsyncBase): + _impl_obj: TracingImpl async def start( self, @@ -17800,7 +17633,7 @@ async def stop_chunk( Export trace collected since the last `tracing.start_chunk()` call into the file with the given path. """ - return mapping.from_maybe_impl(await self._impl_obj.stop_chunk(path=path)) + await self._impl_obj.stop_chunk(path=path) async def stop( self, *, path: typing.Optional[typing.Union[pathlib.Path, str]] = None @@ -17815,7 +17648,7 @@ async def stop( Export trace into the file with the given path. """ - return mapping.from_maybe_impl(await self._impl_obj.stop(path=path)) + await self._impl_obj.stop(path=path) async def group( self, name: str, *, location: typing.Optional[TracingGroupLocation] = None @@ -17861,7 +17694,7 @@ async def group_end(self) -> None: Closes the last group created by `tracing.group()`. """ - return mapping.from_maybe_impl(await self._impl_obj.group_end()) + await self._impl_obj.group_end() async def start_har( self, @@ -17920,13 +17753,14 @@ async def stop_har(self) -> None: Stop HAR recording and save the HAR file to the path given to `tracing.start_har()`. """ - return mapping.from_maybe_impl(await self._impl_obj.stop_har()) + await self._impl_obj.stop_har() mapping.register(TracingImpl, Tracing) class Locator(AsyncBase): + _impl_obj: LocatorImpl @property def page(self) -> "Page": @@ -18155,15 +17989,13 @@ async def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.check( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.check( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def click( @@ -18256,20 +18088,18 @@ async def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.click( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + await self._impl_obj.click( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) async def dblclick( @@ -18342,19 +18172,17 @@ async def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.dblclick( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + await self._impl_obj.dblclick( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) async def dispatch_event( @@ -18413,12 +18241,10 @@ async def dispatch_event( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.dispatch_event( - type=type, - eventInit=mapping.to_impl(event_init), - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.dispatch_event( + type=type, + eventInit=mapping.to_impl(event_init), + timeout=to_milliseconds(timeout), ) async def evaluate( @@ -18610,13 +18436,11 @@ async def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - await self._impl_obj.fill( - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - ) + await self._impl_obj.fill( + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, ) async def clear( @@ -18658,10 +18482,8 @@ async def clear( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - await self._impl_obj.clear( - timeout=to_milliseconds(timeout), noWaitAfter=no_wait_after, force=force - ) + await self._impl_obj.clear( + timeout=to_milliseconds(timeout), noWaitAfter=no_wait_after, force=force ) def locator( @@ -19474,9 +19296,7 @@ async def focus( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.focus(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.focus(timeout=to_milliseconds(timeout)) async def blur( self, @@ -19494,9 +19314,7 @@ async def blur( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.blur(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.blur(timeout=to_milliseconds(timeout)) async def all(self) -> typing.List["Locator"]: """Locator.all @@ -19616,18 +19434,16 @@ async def drag_to( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.drag_to( - target=target._impl_obj, - force=force, - noWaitAfter=no_wait_after, - timeout=to_milliseconds(timeout), - trial=trial, - sourcePosition=source_position, - targetPosition=target_position, - steps=steps, - scroll=scroll, - ) + await self._impl_obj.drag_to( + target=target._impl_obj, + force=force, + noWaitAfter=no_wait_after, + timeout=to_milliseconds(timeout), + trial=trial, + sourcePosition=source_position, + targetPosition=target_position, + steps=steps, + scroll=scroll, ) async def drop( @@ -19669,10 +19485,8 @@ async def drop( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.drop( - payload=payload, position=position, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.drop( + payload=payload, position=position, timeout=to_milliseconds(timeout) ) async def get_attribute( @@ -19771,16 +19585,14 @@ async def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.hover( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.hover( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + trial=trial, + scroll=scroll, ) async def inner_html( @@ -20130,13 +19942,11 @@ async def press( Deprecated: This option will default to `true` in the future. """ - return mapping.from_maybe_impl( - await self._impl_obj.press( - key=key, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.press( + key=key, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def screenshot( @@ -20376,10 +20186,8 @@ async def scroll_into_view_if_needed( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.scroll_into_view_if_needed( - timeout=to_milliseconds(timeout) - ) + await self._impl_obj.scroll_into_view_if_needed( + timeout=to_milliseconds(timeout) ) async def select_option( @@ -20494,11 +20302,7 @@ async def select_text( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.select_text( - force=force, timeout=to_milliseconds(timeout) - ) - ) + await self._impl_obj.select_text(force=force, timeout=to_milliseconds(timeout)) async def set_input_files( self, @@ -20562,12 +20366,10 @@ async def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_input_files( - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.set_input_files( + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def tap( @@ -20631,16 +20433,14 @@ async def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.tap( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.tap( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def text_content( @@ -20701,13 +20501,11 @@ async def type( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.type( - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.type( + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def press_sequentially( @@ -20757,13 +20555,11 @@ async def press_sequentially( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - await self._impl_obj.press_sequentially( - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + await self._impl_obj.press_sequentially( + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) async def uncheck( @@ -20824,15 +20620,13 @@ async def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.uncheck( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.uncheck( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def all_inner_texts(self) -> typing.List[str]: @@ -20914,9 +20708,7 @@ async def wait_for( `visibility:hidden`. This is opposite to the `'visible'` option. """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for(timeout=to_milliseconds(timeout), state=state) - ) + await self._impl_obj.wait_for(timeout=to_milliseconds(timeout), state=state) async def wait_for_function( self, @@ -20956,12 +20748,10 @@ async def wait_for_function( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - await self._impl_obj.wait_for_function( - expression=expression, - arg=mapping.to_impl(arg), - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.wait_for_function( + expression=expression, + arg=mapping.to_impl(arg), + timeout=to_milliseconds(timeout), ) async def set_checked( @@ -21024,16 +20814,14 @@ async def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - await self._impl_obj.set_checked( - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + await self._impl_obj.set_checked( + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) async def highlight(self, *, style: typing.Optional[str] = None) -> None: @@ -21048,7 +20836,7 @@ async def highlight(self, *, style: typing.Optional[str] = None) -> None: Additional inline CSS applied to the highlight overlay, e.g. `"outline: 2px dashed red"`. """ - return mapping.from_maybe_impl(await self._impl_obj.highlight(style=style)) + await self._impl_obj.highlight(style=style) async def hide_highlight(self) -> None: """Locator.hide_highlight @@ -21056,13 +20844,14 @@ async def hide_highlight(self) -> None: Hides the element highlight previously added by `locator.highlight()`. """ - return mapping.from_maybe_impl(await self._impl_obj.hide_highlight()) + await self._impl_obj.hide_highlight() mapping.register(LocatorImpl, Locator) class APIResponse(AsyncBase): + _impl_obj: APIResponseImpl @property def ok(self) -> bool: @@ -21222,13 +21011,14 @@ async def dispose(self) -> None: Disposes the body of this response. If not called then the body will stay in memory until the context closes. """ - return mapping.from_maybe_impl(await self._impl_obj.dispose()) + await self._impl_obj.dispose() mapping.register(APIResponseImpl, APIResponse) class APIRequestContext(AsyncBase): + _impl_obj: APIRequestContextImpl @property def tracing(self) -> "Tracing": @@ -21255,7 +21045,7 @@ async def dispose(self, *, reason: typing.Optional[str] = None) -> None: The reason to be reported to the operations interrupted by the context disposal. """ - return mapping.from_maybe_impl(await self._impl_obj.dispose(reason=reason)) + await self._impl_obj.dispose(reason=reason) async def cookies( self, urls: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None @@ -21298,9 +21088,7 @@ async def add_cookies(self, cookies: typing.Sequence[SetCookieParam]) -> None: cookies : Sequence[{name: str, value: str, url: Union[str, None], domain: Union[str, None], path: Union[str, None], expires: Union[float, None], httpOnly: Union[bool, None], secure: Union[bool, None], sameSite: Union["Lax", "None", "Strict", None], partitionKey: Union[str, None]}] """ - return mapping.from_maybe_impl( - await self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies)) - ) + await self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies)) async def clear_cookies( self, @@ -21335,9 +21123,7 @@ async def clear_cookies( Only removes cookies with the given path. """ - return mapping.from_maybe_impl( - await self._impl_obj.clear_cookies(name=name, domain=domain, path=path) - ) + await self._impl_obj.clear_cookies(name=name, domain=domain, path=path) async def delete( self, @@ -22075,6 +21861,7 @@ async def storage_state( class APIRequest(AsyncBase): + _impl_obj: APIRequestImpl async def new_context( self, @@ -22183,6 +21970,7 @@ async def new_context( class PageAssertions(AsyncBase): + _impl_obj: PageAssertionsImpl async def to_have_title( self, @@ -22213,10 +22001,8 @@ async def to_have_title( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_title( - titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_have_title( + titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) ) async def not_to_have_title( @@ -22238,10 +22024,8 @@ async def not_to_have_title( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_title( - titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_title( + titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) ) async def to_have_url( @@ -22277,12 +22061,10 @@ async def to_have_url( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_url( - urlOrRegExp=url_or_reg_exp, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + await self._impl_obj.to_have_url( + urlOrRegExp=url_or_reg_exp, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) async def not_to_have_url( @@ -22308,12 +22090,10 @@ async def not_to_have_url( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_url( - urlOrRegExp=url_or_reg_exp, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + await self._impl_obj.not_to_have_url( + urlOrRegExp=url_or_reg_exp, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) async def to_match_aria_snapshot( @@ -22344,10 +22124,8 @@ async def to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) async def not_to_match_aria_snapshot( @@ -22368,10 +22146,8 @@ async def not_to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) @@ -22379,6 +22155,7 @@ async def not_to_match_aria_snapshot( class LocatorAssertions(AsyncBase): + _impl_obj: LocatorAssertionsImpl async def to_contain_text( self, @@ -22463,13 +22240,11 @@ async def to_contain_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_contain_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + await self._impl_obj.to_contain_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) async def not_to_contain_text( @@ -22504,13 +22279,11 @@ async def not_to_contain_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_contain_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + await self._impl_obj.not_to_contain_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) async def to_have_attribute( @@ -22550,13 +22323,11 @@ async def to_have_attribute( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_attribute( - name=name, - value=value, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.to_have_attribute( + name=name, + value=value, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) async def not_to_have_attribute( @@ -22585,13 +22356,11 @@ async def not_to_have_attribute( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_attribute( - name=name, - value=value, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.not_to_have_attribute( + name=name, + value=value, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) async def to_have_class( @@ -22645,10 +22414,8 @@ async def to_have_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_have_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) async def not_to_have_class( @@ -22676,10 +22443,8 @@ async def not_to_have_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) async def to_contain_class( @@ -22737,10 +22502,8 @@ async def to_contain_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_contain_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_contain_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) async def not_to_contain_class( @@ -22762,10 +22525,8 @@ async def not_to_contain_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_contain_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_contain_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) async def to_have_count( @@ -22796,10 +22557,8 @@ async def to_have_count( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_count( - count=count, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_have_count( + count=count, timeout=to_milliseconds(timeout) ) async def not_to_have_count( @@ -22821,10 +22580,8 @@ async def not_to_have_count( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_count( - count=count, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_count( + count=count, timeout=to_milliseconds(timeout) ) async def to_have_css( @@ -22861,10 +22618,8 @@ async def to_have_css( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_css( - name=name, value=value, timeout=to_milliseconds(timeout), pseudo=pseudo - ) + await self._impl_obj.to_have_css( + name=name, value=value, timeout=to_milliseconds(timeout), pseudo=pseudo ) async def not_to_have_css( @@ -22889,10 +22644,8 @@ async def not_to_have_css( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_css( - name=name, value=value, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_css( + name=name, value=value, timeout=to_milliseconds(timeout) ) async def to_have_id( @@ -22923,9 +22676,7 @@ async def to_have_id( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_id(id=id, timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.to_have_id(id=id, timeout=to_milliseconds(timeout)) async def not_to_have_id( self, @@ -22946,9 +22697,7 @@ async def not_to_have_id( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_id(id=id, timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.not_to_have_id(id=id, timeout=to_milliseconds(timeout)) async def to_have_js_property( self, @@ -22982,12 +22731,8 @@ async def to_have_js_property( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_js_property( - name=name, - value=mapping.to_impl(value), - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.to_have_js_property( + name=name, value=mapping.to_impl(value), timeout=to_milliseconds(timeout) ) async def not_to_have_js_property( @@ -23012,12 +22757,8 @@ async def not_to_have_js_property( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_js_property( - name=name, - value=mapping.to_impl(value), - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.not_to_have_js_property( + name=name, value=mapping.to_impl(value), timeout=to_milliseconds(timeout) ) async def to_have_value( @@ -23050,10 +22791,8 @@ async def to_have_value( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_value( - value=value, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_have_value( + value=value, timeout=to_milliseconds(timeout) ) async def not_to_have_value( @@ -23075,10 +22814,8 @@ async def not_to_have_value( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_value( - value=value, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_value( + value=value, timeout=to_milliseconds(timeout) ) async def to_have_values( @@ -23126,10 +22863,8 @@ async def to_have_values( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_values( - values=mapping.to_impl(values), timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_have_values( + values=mapping.to_impl(values), timeout=to_milliseconds(timeout) ) async def not_to_have_values( @@ -23155,10 +22890,8 @@ async def not_to_have_values( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_values( - values=mapping.to_impl(values), timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_values( + values=mapping.to_impl(values), timeout=to_milliseconds(timeout) ) async def to_have_text( @@ -23243,13 +22976,11 @@ async def to_have_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + await self._impl_obj.to_have_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) async def not_to_have_text( @@ -23284,13 +23015,11 @@ async def not_to_have_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + await self._impl_obj.not_to_have_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) async def to_be_attached( @@ -23318,10 +23047,8 @@ async def to_be_attached( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_attached( - attached=attached, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_be_attached( + attached=attached, timeout=to_milliseconds(timeout) ) async def to_be_checked( @@ -23357,12 +23084,10 @@ async def to_be_checked( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_checked( - timeout=to_milliseconds(timeout), - checked=checked, - indeterminate=indeterminate, - ) + await self._impl_obj.to_be_checked( + timeout=to_milliseconds(timeout), + checked=checked, + indeterminate=indeterminate, ) async def not_to_be_attached( @@ -23383,10 +23108,8 @@ async def not_to_be_attached( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_attached( - attached=attached, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_be_attached( + attached=attached, timeout=to_milliseconds(timeout) ) async def not_to_be_checked( @@ -23405,9 +23128,7 @@ async def not_to_be_checked( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_checked(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.not_to_be_checked(timeout=to_milliseconds(timeout)) async def to_be_disabled( self, @@ -23438,9 +23159,7 @@ async def to_be_disabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_disabled(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.to_be_disabled(timeout=to_milliseconds(timeout)) async def not_to_be_disabled( self, @@ -23458,9 +23177,7 @@ async def not_to_be_disabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_disabled(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.not_to_be_disabled(timeout=to_milliseconds(timeout)) async def to_be_editable( self, @@ -23489,10 +23206,8 @@ async def to_be_editable( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_editable( - editable=editable, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_be_editable( + editable=editable, timeout=to_milliseconds(timeout) ) async def not_to_be_editable( @@ -23513,10 +23228,8 @@ async def not_to_be_editable( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_editable( - editable=editable, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_be_editable( + editable=editable, timeout=to_milliseconds(timeout) ) async def to_be_empty( @@ -23544,9 +23257,7 @@ async def to_be_empty( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_empty(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.to_be_empty(timeout=to_milliseconds(timeout)) async def not_to_be_empty( self, @@ -23564,9 +23275,7 @@ async def not_to_be_empty( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_empty(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.not_to_be_empty(timeout=to_milliseconds(timeout)) async def to_be_enabled( self, @@ -23595,10 +23304,8 @@ async def to_be_enabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_enabled( - enabled=enabled, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_be_enabled( + enabled=enabled, timeout=to_milliseconds(timeout) ) async def not_to_be_enabled( @@ -23619,10 +23326,8 @@ async def not_to_be_enabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_enabled( - enabled=enabled, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_be_enabled( + enabled=enabled, timeout=to_milliseconds(timeout) ) async def to_be_hidden( @@ -23651,9 +23356,7 @@ async def to_be_hidden( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_hidden(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.to_be_hidden(timeout=to_milliseconds(timeout)) async def not_to_be_hidden( self, @@ -23671,9 +23374,7 @@ async def not_to_be_hidden( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_hidden(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.not_to_be_hidden(timeout=to_milliseconds(timeout)) async def to_be_visible( self, @@ -23712,10 +23413,8 @@ async def to_be_visible( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_visible( - visible=visible, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_be_visible( + visible=visible, timeout=to_milliseconds(timeout) ) async def not_to_be_visible( @@ -23736,10 +23435,8 @@ async def not_to_be_visible( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_visible( - visible=visible, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_be_visible( + visible=visible, timeout=to_milliseconds(timeout) ) async def to_be_focused( @@ -23767,9 +23464,7 @@ async def to_be_focused( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_focused(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.to_be_focused(timeout=to_milliseconds(timeout)) async def not_to_be_focused( self, @@ -23787,9 +23482,7 @@ async def not_to_be_focused( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_focused(timeout=to_milliseconds(timeout)) - ) + await self._impl_obj.not_to_be_focused(timeout=to_milliseconds(timeout)) async def to_be_in_viewport( self, @@ -23826,10 +23519,8 @@ async def to_be_in_viewport( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_be_in_viewport( - ratio=ratio, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_be_in_viewport( + ratio=ratio, timeout=to_milliseconds(timeout) ) async def not_to_be_in_viewport( @@ -23850,10 +23541,8 @@ async def not_to_be_in_viewport( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_be_in_viewport( - ratio=ratio, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_be_in_viewport( + ratio=ratio, timeout=to_milliseconds(timeout) ) async def to_have_accessible_description( @@ -23887,12 +23576,10 @@ async def to_have_accessible_description( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_accessible_description( - description=description, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.to_have_accessible_description( + description=description, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) async def not_to_have_accessible_description( @@ -23918,10 +23605,8 @@ async def not_to_have_accessible_description( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_accessible_description( - name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_accessible_description( + name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) ) async def to_have_accessible_name( @@ -23955,10 +23640,8 @@ async def to_have_accessible_name( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_accessible_name( - name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_have_accessible_name( + name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) ) async def not_to_have_accessible_name( @@ -23984,10 +23667,8 @@ async def not_to_have_accessible_name( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_accessible_name( - name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_accessible_name( + name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) ) async def to_have_role( @@ -24102,11 +23783,7 @@ async def to_have_role( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_role( - role=role, timeout=to_milliseconds(timeout) - ) - ) + await self._impl_obj.to_have_role(role=role, timeout=to_milliseconds(timeout)) async def to_have_accessible_error_message( self, @@ -24139,12 +23816,10 @@ async def to_have_accessible_error_message( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_have_accessible_error_message( - errorMessage=error_message, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.to_have_accessible_error_message( + errorMessage=error_message, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) async def not_to_have_accessible_error_message( @@ -24170,12 +23845,10 @@ async def not_to_have_accessible_error_message( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_accessible_error_message( - errorMessage=error_message, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + await self._impl_obj.not_to_have_accessible_error_message( + errorMessage=error_message, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) async def not_to_have_role( @@ -24280,10 +23953,8 @@ async def not_to_have_role( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_have_role( - role=role, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_have_role( + role=role, timeout=to_milliseconds(timeout) ) async def to_match_aria_snapshot( @@ -24314,10 +23985,8 @@ async def to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) async def not_to_match_aria_snapshot( @@ -24338,10 +24007,8 @@ async def not_to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - await self._impl_obj.not_to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + await self._impl_obj.not_to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) @@ -24349,6 +24016,7 @@ async def not_to_match_aria_snapshot( class APIResponseAssertions(AsyncBase): + _impl_obj: APIResponseAssertionsImpl async def to_be_ok(self) -> None: """APIResponseAssertions.to_be_ok @@ -24366,7 +24034,7 @@ async def to_be_ok(self) -> None: """ __tracebackhide__ = True - return mapping.from_maybe_impl(await self._impl_obj.to_be_ok()) + await self._impl_obj.to_be_ok() async def not_to_be_ok(self) -> None: """APIResponseAssertions.not_to_be_ok @@ -24375,13 +24043,14 @@ async def not_to_be_ok(self) -> None: """ __tracebackhide__ = True - return mapping.from_maybe_impl(await self._impl_obj.not_to_be_ok()) + await self._impl_obj.not_to_be_ok() mapping.register(APIResponseAssertionsImpl, APIResponseAssertions) class Disposable(AsyncContextManager): + _impl_obj: DisposableImpl async def dispose(self) -> None: """Disposable.dispose @@ -24390,11 +24059,11 @@ async def dispose(self) -> None: or `browser_context.add_init_script()`. """ - return mapping.from_maybe_impl(await self._impl_obj.dispose()) + await self._impl_obj.dispose() async def close(self) -> None: - return mapping.from_maybe_impl(await self._impl_obj.close()) + await self._impl_obj.close() mapping.register(DisposableImpl, Disposable) diff --git a/playwright/sync_api/_generated.py b/playwright/sync_api/_generated.py index 006b69b30..dd252b480 100644 --- a/playwright/sync_api/_generated.py +++ b/playwright/sync_api/_generated.py @@ -104,6 +104,7 @@ class Request(SyncBase): + _impl_obj: RequestImpl @property def url(self) -> str: @@ -440,6 +441,7 @@ def header_value(self, name: str) -> typing.Optional[str]: class Response(SyncBase): + _impl_obj: ResponseImpl @property def url(self) -> str: @@ -649,7 +651,7 @@ def finished(self) -> None: Waits for this response to finish, returns always `null`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.finished())) + self._sync(self._impl_obj.finished()) def body(self) -> bytes: """Response.body @@ -694,6 +696,7 @@ def json(self) -> typing.Any: class Route(SyncBase): + _impl_obj: RouteImpl @property def request(self) -> "Request": @@ -734,9 +737,7 @@ def abort(self, error_code: typing.Optional[str] = None) -> None: - `'failed'` - A generic failure occurred. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.abort(errorCode=error_code)) - ) + self._sync(self._impl_obj.abort(errorCode=error_code)) def fulfill( self, @@ -790,17 +791,15 @@ def fulfill( overridden using fulfill options. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.fulfill( - status=status, - headers=mapping.to_impl(headers), - body=body, - json=mapping.to_impl(json), - path=path, - contentType=content_type, - response=response._impl_obj if response else None, - ) + self._sync( + self._impl_obj.fulfill( + status=status, + headers=mapping.to_impl(headers), + body=body, + json=mapping.to_impl(json), + path=path, + contentType=content_type, + response=response._impl_obj if response else None, ) ) @@ -960,14 +959,12 @@ def handle(route, request): If set changes the post data of request. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.fallback( - url=url, - method=method, - headers=mapping.to_impl(headers), - postData=mapping.to_impl(post_data), - ) + self._sync( + self._impl_obj.fallback( + url=url, + method=method, + headers=mapping.to_impl(headers), + postData=mapping.to_impl(post_data), ) ) @@ -1025,14 +1022,12 @@ def handle(route, request): If set changes the post data of request. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.continue_( - url=url, - method=method, - headers=mapping.to_impl(headers), - postData=mapping.to_impl(post_data), - ) + self._sync( + self._impl_obj.continue_( + url=url, + method=method, + headers=mapping.to_impl(headers), + postData=mapping.to_impl(post_data), ) ) @@ -1041,6 +1036,7 @@ def handle(route, request): class WebSocket(SyncBase): + _impl_obj: WebSocketImpl @typing.overload def on( @@ -1314,6 +1310,7 @@ def is_closed(self) -> bool: class WebSocketRoute(SyncBase): + _impl_obj: WebSocketRouteImpl @property def url(self) -> str: @@ -1370,9 +1367,7 @@ def close( Optional [close reason](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#reason). """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.close(code=code, reason=reason)) - ) + self._sync(self._impl_obj.close(code=code, reason=reason)) def connect_to_server(self) -> "WebSocketRoute": """WebSocketRoute.connect_to_server @@ -1410,7 +1405,7 @@ def send(self, message: typing.Union[str, bytes]) -> None: Message to send. """ - return mapping.from_maybe_impl(self._impl_obj.send(message=message)) + self._impl_obj.send(message=message) def on_message( self, handler: typing.Callable[[typing.Union[str, bytes]], typing.Any] @@ -1434,9 +1429,7 @@ def on_message( Function that will handle messages. """ - return mapping.from_maybe_impl( - self._impl_obj.on_message(handler=self._wrap_handler(handler)) - ) + self._impl_obj.on_message(handler=self._wrap_handler(handler)) def on_close( self, @@ -1460,15 +1453,14 @@ def on_close( [close reason](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close#reason). """ - return mapping.from_maybe_impl( - self._impl_obj.on_close(handler=self._wrap_handler(handler)) - ) + self._impl_obj.on_close(handler=self._wrap_handler(handler)) mapping.register(WebSocketRouteImpl, WebSocketRoute) class Keyboard(SyncBase): + _impl_obj: KeyboardImpl def down(self, key: str) -> None: """Keyboard.down @@ -1507,7 +1499,7 @@ def down(self, key: str) -> None: Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.down(key=key))) + self._sync(self._impl_obj.down(key=key)) def up(self, key: str) -> None: """Keyboard.up @@ -1520,7 +1512,7 @@ def up(self, key: str) -> None: Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.up(key=key))) + self._sync(self._impl_obj.up(key=key)) def insert_text(self, text: str) -> None: """Keyboard.insert_text @@ -1542,9 +1534,7 @@ def insert_text(self, text: str) -> None: Sets input to the specified text value. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.insert_text(text=text)) - ) + self._sync(self._impl_obj.insert_text(text=text)) def type(self, text: str, *, delay: typing.Optional[float] = None) -> None: """Keyboard.type @@ -1575,9 +1565,7 @@ def type(self, text: str, *, delay: typing.Optional[float] = None) -> None: Time to wait between key presses in milliseconds. Defaults to 0. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.type(text=text, delay=delay)) - ) + self._sync(self._impl_obj.type(text=text, delay=delay)) def press(self, key: str, *, delay: typing.Optional[float] = None) -> None: """Keyboard.press @@ -1628,15 +1616,14 @@ def press(self, key: str, *, delay: typing.Optional[float] = None) -> None: Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.press(key=key, delay=delay)) - ) + self._sync(self._impl_obj.press(key=key, delay=delay)) mapping.register(KeyboardImpl, Keyboard) class Mouse(SyncBase): + _impl_obj: MouseImpl def move(self, x: float, y: float, *, steps: typing.Optional[int] = None) -> None: """Mouse.move @@ -1654,9 +1641,7 @@ def move(self, x: float, y: float, *, steps: typing.Optional[int] = None) -> Non position and the provided destination. When set to 1, emits a single `mousemove` event at the destination location. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.move(x=x, y=y, steps=steps)) - ) + self._sync(self._impl_obj.move(x=x, y=y, steps=steps)) def down( self, @@ -1676,9 +1661,7 @@ def down( defaults to 1. See [UIEvent.detail]. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.down(button=button, clickCount=click_count)) - ) + self._sync(self._impl_obj.down(button=button, clickCount=click_count)) def up( self, @@ -1698,9 +1681,7 @@ def up( defaults to 1. See [UIEvent.detail]. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.up(button=button, clickCount=click_count)) - ) + self._sync(self._impl_obj.up(button=button, clickCount=click_count)) def click( self, @@ -1729,11 +1710,9 @@ def click( defaults to 1. See [UIEvent.detail]. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.click( - x=x, y=y, delay=delay, button=button, clickCount=click_count - ) + self._sync( + self._impl_obj.click( + x=x, y=y, delay=delay, button=button, clickCount=click_count ) ) @@ -1762,9 +1741,7 @@ def dblclick( Defaults to `left`. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.dblclick(x=x, y=y, delay=delay, button=button)) - ) + self._sync(self._impl_obj.dblclick(x=x, y=y, delay=delay, button=button)) def wheel(self, delta_x: float, delta_y: float) -> None: """Mouse.wheel @@ -1783,15 +1760,14 @@ def wheel(self, delta_x: float, delta_y: float) -> None: Pixels to scroll vertically. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.wheel(deltaX=delta_x, deltaY=delta_y)) - ) + self._sync(self._impl_obj.wheel(deltaX=delta_x, deltaY=delta_y)) mapping.register(MouseImpl, Mouse) class Touchscreen(SyncBase): + _impl_obj: TouchscreenImpl def tap(self, x: float, y: float) -> None: """Touchscreen.tap @@ -1808,13 +1784,14 @@ def tap(self, x: float, y: float) -> None: Y coordinate relative to the main frame's viewport in CSS pixels. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.tap(x=x, y=y))) + self._sync(self._impl_obj.tap(x=x, y=y)) mapping.register(TouchscreenImpl, Touchscreen) class JSHandle(SyncBase): + _impl_obj: JSHandleImpl def evaluate( self, expression: str, arg: typing.Optional[typing.Any] = None @@ -1951,7 +1928,7 @@ def dispose(self) -> None: The `jsHandle.dispose` method stops referencing the element handle. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.dispose())) + self._sync(self._impl_obj.dispose()) def json_value(self) -> typing.Any: """JSHandle.json_value @@ -1973,6 +1950,7 @@ def json_value(self) -> typing.Any: class ElementHandle(JSHandle): + _impl_obj: ElementHandleImpl def owner_frame(self) -> typing.Optional["Frame"]: """ElementHandle.owner_frame @@ -2171,11 +2149,9 @@ def dispatch_event( Optional event-specific initialization properties. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dispatch_event( - type=type, eventInit=mapping.to_impl(event_init) - ) + self._sync( + self._impl_obj.dispatch_event( + type=type, eventInit=mapping.to_impl(event_init) ) ) @@ -2202,12 +2178,8 @@ def scroll_into_view_if_needed( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.scroll_into_view_if_needed( - timeout=to_milliseconds(timeout) - ) - ) + self._sync( + self._impl_obj.scroll_into_view_if_needed(timeout=to_milliseconds(timeout)) ) def hover( @@ -2262,17 +2234,15 @@ def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.hover( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.hover( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + trial=trial, + scroll=scroll, ) ) @@ -2344,21 +2314,19 @@ def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.click( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + self._sync( + self._impl_obj.click( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) ) @@ -2426,20 +2394,18 @@ def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dblclick( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + self._sync( + self._impl_obj.dblclick( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) ) @@ -2575,17 +2541,15 @@ def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.tap( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.tap( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -2623,14 +2587,12 @@ def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.fill( - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - ) + self._sync( + self._impl_obj.fill( + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, ) ) @@ -2658,12 +2620,8 @@ def select_text( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.select_text( - force=force, timeout=to_milliseconds(timeout) - ) - ) + self._sync( + self._impl_obj.select_text(force=force, timeout=to_milliseconds(timeout)) ) def input_value( @@ -2728,13 +2686,11 @@ def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_input_files( - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.set_input_files( + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -2744,7 +2700,7 @@ def focus(self) -> None: Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.focus())) + self._sync(self._impl_obj.focus()) def type( self, @@ -2777,14 +2733,12 @@ def type( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.type( - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.type( + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -2836,14 +2790,12 @@ def press( Deprecated: This option will default to `true` in the future. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.press( - key=key, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.press( + key=key, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -2897,17 +2849,15 @@ def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_checked( - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.set_checked( + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -2959,16 +2909,14 @@ def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.check( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.check( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -3020,16 +2968,14 @@ def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.uncheck( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.uncheck( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -3326,11 +3272,9 @@ def wait_for_element_state( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_element_state( - state=state, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.wait_for_element_state( + state=state, timeout=to_milliseconds(timeout) ) ) @@ -3405,6 +3349,7 @@ def wait_for_selector( class FileChooser(SyncBase): + _impl_obj: FileChooserImpl @property def page(self) -> "Page": @@ -3471,13 +3416,11 @@ def set_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_files( - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.set_files( + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -3486,6 +3429,7 @@ def set_files( class Frame(SyncBase): + _impl_obj: FrameImpl @property def page(self) -> "Page": @@ -3736,13 +3680,11 @@ def wait_for_url( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_url( - url=self._wrap_handler(url), - waitUntil=wait_until, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.wait_for_url( + url=self._wrap_handler(url), + waitUntil=wait_until, + timeout=to_milliseconds(timeout), ) ) @@ -3788,11 +3730,9 @@ def wait_for_load_state( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_load_state( - state=state, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.wait_for_load_state( + state=state, timeout=to_milliseconds(timeout) ) ) @@ -4319,15 +4259,13 @@ def dispatch_event( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dispatch_event( - selector=selector, - type=type, - eventInit=mapping.to_impl(event_init), - strict=strict, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.dispatch_event( + selector=selector, + type=type, + eventInit=mapping.to_impl(event_init), + strict=strict, + timeout=to_milliseconds(timeout), ) ) @@ -4483,11 +4421,9 @@ def set_content( loading. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_content( - html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until - ) + self._sync( + self._impl_obj.set_content( + html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until ) ) @@ -4652,22 +4588,20 @@ def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.click( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.click( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -4742,21 +4676,19 @@ def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dblclick( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.dblclick( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -4824,19 +4756,17 @@ def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.tap( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.tap( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -4883,16 +4813,14 @@ def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.fill( - selector=selector, - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - force=force, - ) + self._sync( + self._impl_obj.fill( + selector=selector, + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, + force=force, ) ) @@ -5490,11 +5418,9 @@ def focus( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.focus( - selector=selector, strict=strict, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.focus( + selector=selector, strict=strict, timeout=to_milliseconds(timeout) ) ) @@ -5710,19 +5636,17 @@ def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.hover( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.hover( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -5781,21 +5705,19 @@ def drag_and_drop( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.drag_and_drop( - source=source, - target=target, - sourcePosition=source_position, - targetPosition=target_position, - force=force, - noWaitAfter=no_wait_after, - strict=strict, - timeout=to_milliseconds(timeout), - trial=trial, - steps=steps, - scroll=scroll, - ) + self._sync( + self._impl_obj.drag_and_drop( + source=source, + target=target, + sourcePosition=source_position, + targetPosition=target_position, + force=force, + noWaitAfter=no_wait_after, + strict=strict, + timeout=to_milliseconds(timeout), + trial=trial, + steps=steps, + scroll=scroll, ) ) @@ -5968,15 +5890,13 @@ def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_input_files( - selector=selector, - files=mapping.to_impl(files), - strict=strict, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.set_input_files( + selector=selector, + files=mapping.to_impl(files), + strict=strict, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -6019,16 +5939,14 @@ def type( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.type( - selector=selector, - text=text, - delay=delay, - strict=strict, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.type( + selector=selector, + text=text, + delay=delay, + strict=strict, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -6086,16 +6004,14 @@ def press( Deprecated: This option will default to `true` in the future. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.press( - selector=selector, - key=key, - delay=delay, - strict=strict, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.press( + selector=selector, + key=key, + delay=delay, + strict=strict, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -6155,18 +6071,16 @@ def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.check( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.check( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -6226,18 +6140,16 @@ def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.uncheck( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.uncheck( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -6257,11 +6169,7 @@ def wait_for_timeout( A timeout to wait for """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout)) - ) - ) + self._sync(self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout))) def wait_for_function( self, @@ -6404,19 +6312,17 @@ def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_checked( - selector=selector, - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.set_checked( + selector=selector, + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -6425,6 +6331,7 @@ def set_checked( class FrameLocator(SyncBase): + _impl_obj: FrameLocatorImpl @property def first(self) -> "FrameLocator": @@ -7041,6 +6948,7 @@ def nth(self, index: int) -> "FrameLocator": class Worker(SyncBase): + _impl_obj: WorkerImpl @typing.overload def on( @@ -7232,6 +7140,7 @@ def expect_event( class Selectors(SyncBase): + _impl_obj: SelectorsImpl def register( self, @@ -7300,11 +7209,9 @@ def run(playwright: Playwright): script is not guaranteed when this engine is used together with other registered engines. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.register( - name=name, script=script, path=path, contentScript=content_script - ) + self._sync( + self._impl_obj.register( + name=name, script=script, path=path, contentScript=content_script ) ) @@ -7320,15 +7227,14 @@ def set_test_id_attribute(self, attribute_name: str) -> None: `"data-pw,data-ti"`. """ - return mapping.from_maybe_impl( - self._impl_obj.set_test_id_attribute(attributeName=attribute_name) - ) + self._impl_obj.set_test_id_attribute(attributeName=attribute_name) mapping.register(SelectorsImpl, Selectors) class Clock(SyncBase): + _impl_obj: ClockImpl def install( self, @@ -7360,7 +7266,7 @@ def install( Time to initialize with, current system time by default. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.install(time=time))) + self._sync(self._impl_obj.install(time=time)) def fast_forward(self, ticks: typing.Union[int, str]) -> None: """Clock.fast_forward @@ -7382,9 +7288,7 @@ def fast_forward(self, ticks: typing.Union[int, str]) -> None: "08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.fast_forward(ticks=ticks)) - ) + self._sync(self._impl_obj.fast_forward(ticks=ticks)) def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> None: """Clock.pause_at @@ -7421,7 +7325,7 @@ def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> None: Time to pause at. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.pause_at(time=time))) + self._sync(self._impl_obj.pause_at(time=time)) def resume(self) -> None: """Clock.resume @@ -7429,7 +7333,7 @@ def resume(self) -> None: Resumes timers. Once this method is called, time resumes flowing, timers are fired as usual. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.resume())) + self._sync(self._impl_obj.resume()) def run_for(self, ticks: typing.Union[int, str]) -> None: """Clock.run_for @@ -7450,7 +7354,7 @@ def run_for(self, ticks: typing.Union[int, str]) -> None: "08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.run_for(ticks=ticks))) + self._sync(self._impl_obj.run_for(ticks=ticks)) def set_fixed_time(self, time: typing.Union[float, str, datetime.datetime]) -> None: """Clock.set_fixed_time @@ -7474,9 +7378,7 @@ def set_fixed_time(self, time: typing.Union[float, str, datetime.datetime]) -> N Time to be set. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.set_fixed_time(time=time)) - ) + self._sync(self._impl_obj.set_fixed_time(time=time)) def set_system_time( self, time: typing.Union[float, str, datetime.datetime] @@ -7500,15 +7402,14 @@ def set_system_time( Time to be set. Numeric values are Unix time in seconds. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.set_system_time(time=time)) - ) + self._sync(self._impl_obj.set_system_time(time=time)) mapping.register(ClockImpl, Clock) class Credentials(SyncBase): + _impl_obj: CredentialsImpl def install(self) -> None: """Credentials.install @@ -7522,7 +7423,7 @@ def install(self) -> None: installing populates the authenticator, but the page will never see those credentials. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.install())) + self._sync(self._impl_obj.install()) def create( self, @@ -7596,7 +7497,7 @@ def delete(self, id: str) -> None: Base64url-encoded credential id. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.delete(id=id))) + self._sync(self._impl_obj.delete(id=id)) def get( self, *, rp_id: typing.Optional[str] = None, id: typing.Optional[str] = None @@ -7630,6 +7531,7 @@ def get( class ConsoleMessage(SyncBase): + _impl_obj: ConsoleMessageImpl @property def type( @@ -7739,6 +7641,7 @@ def worker(self) -> typing.Optional["Worker"]: class Debugger(SyncBase): + _impl_obj: DebuggerImpl @typing.overload def on( @@ -7791,7 +7694,7 @@ def request_pause(self) -> None: configures the debugger to pause before the next action is executed. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.request_pause())) + self._sync(self._impl_obj.request_pause()) def resume(self) -> None: """Debugger.resume @@ -7799,7 +7702,7 @@ def resume(self) -> None: Resumes script execution. Throws if the debugger is not paused. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.resume())) + self._sync(self._impl_obj.resume()) def next(self) -> None: """Debugger.next @@ -7807,7 +7710,7 @@ def next(self) -> None: Resumes script execution and pauses again before the next action. Throws if the debugger is not paused. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.next())) + self._sync(self._impl_obj.next()) def run_to(self, location: DebuggerLocation) -> None: """Debugger.run_to @@ -7821,15 +7724,14 @@ def run_to(self, location: DebuggerLocation) -> None: The source location to pause at. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.run_to(location=location)) - ) + self._sync(self._impl_obj.run_to(location=location)) mapping.register(DebuggerImpl, Debugger) class Dialog(SyncBase): + _impl_obj: DialogImpl @property def type(self) -> str: @@ -7890,9 +7792,7 @@ def accept(self, prompt_text: typing.Optional[str] = None) -> None: A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.accept(promptText=prompt_text)) - ) + self._sync(self._impl_obj.accept(promptText=prompt_text)) def dismiss(self) -> None: """Dialog.dismiss @@ -7900,13 +7800,14 @@ def dismiss(self) -> None: Returns when the dialog has been dismissed. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.dismiss())) + self._sync(self._impl_obj.dismiss()) mapping.register(DialogImpl, Dialog) class Download(SyncBase): + _impl_obj: DownloadImpl @property def page(self) -> "Page": @@ -7953,7 +7854,7 @@ def delete(self) -> None: Deletes the downloaded file. Will wait for the download to finish if necessary. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.delete())) + self._sync(self._impl_obj.delete()) def failure(self) -> typing.Optional[str]: """Download.failure @@ -8001,7 +7902,7 @@ def save_as(self, path: typing.Union[str, pathlib.Path]) -> None: Path where the download should be copied. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.save_as(path=path))) + self._sync(self._impl_obj.save_as(path=path)) def cancel(self) -> None: """Download.cancel @@ -8010,13 +7911,14 @@ def cancel(self) -> None: `download.failure()` would resolve to `'canceled'`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.cancel())) + self._sync(self._impl_obj.cancel()) mapping.register(DownloadImpl, Download) class Screencast(SyncBase): + _impl_obj: ScreencastImpl def start( self, @@ -8080,7 +7982,7 @@ def stop(self) -> None: in `screencast.start()`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.stop())) + self._sync(self._impl_obj.stop()) def show_actions( self, @@ -8139,7 +8041,7 @@ def hide_actions(self) -> None: Removes action decorations. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.hide_actions())) + self._sync(self._impl_obj.hide_actions()) def show_overlay( self, html: str, *, duration: typing.Optional[float] = None @@ -8188,11 +8090,9 @@ def show_chapter( Duration in milliseconds after which the overlay is automatically removed. Defaults to `2000`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.show_chapter( - title=title, description=description, duration=duration - ) + self._sync( + self._impl_obj.show_chapter( + title=title, description=description, duration=duration ) ) @@ -8202,7 +8102,7 @@ def show_overlays(self) -> None: Shows overlays. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.show_overlays())) + self._sync(self._impl_obj.show_overlays()) def hide_overlays(self) -> None: """Screencast.hide_overlays @@ -8210,13 +8110,14 @@ def hide_overlays(self) -> None: Hides overlays without removing them. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.hide_overlays())) + self._sync(self._impl_obj.hide_overlays()) mapping.register(ScreencastImpl, Screencast) class Video(SyncBase): + _impl_obj: VideoImpl def path(self) -> pathlib.Path: """Video.path @@ -8243,7 +8144,7 @@ def save_as(self, path: typing.Union[str, pathlib.Path]) -> None: Path where the video should be saved. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.save_as(path=path))) + self._sync(self._impl_obj.save_as(path=path)) def delete(self) -> None: """Video.delete @@ -8251,13 +8152,14 @@ def delete(self) -> None: Deletes the video file. Will wait for the video to finish if necessary. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.delete())) + self._sync(self._impl_obj.delete()) mapping.register(VideoImpl, Video) class WebMCP(SyncBase): + _impl_obj: WebMCPImpl def tools( self, @@ -8330,6 +8232,7 @@ def call_tool( class Page(SyncContextManager): + _impl_obj: PageImpl @typing.overload def on(self, event: Literal["close"], f: typing.Callable[["Page"], "None"]) -> None: @@ -9049,11 +8952,7 @@ def set_default_navigation_timeout( Maximum navigation time in milliseconds """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_navigation_timeout( - timeout=to_milliseconds(timeout) - ) - ) + self._impl_obj.set_default_navigation_timeout(timeout=to_milliseconds(timeout)) def set_default_timeout( self, timeout: typing.Union[float, datetime.timedelta] @@ -9070,9 +8969,7 @@ def set_default_timeout( Maximum time in milliseconds. Pass `0` to disable timeout. """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) - ) + self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) def query_selector( self, selector: str, *, strict: typing.Optional[bool] = None @@ -9474,15 +9371,13 @@ def dispatch_event( element, the call throws an exception. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dispatch_event( - selector=selector, - type=type, - eventInit=mapping.to_impl(event_init), - timeout=to_milliseconds(timeout), - strict=strict, - ) + self._sync( + self._impl_obj.dispatch_event( + selector=selector, + type=type, + eventInit=mapping.to_impl(event_init), + timeout=to_milliseconds(timeout), + strict=strict, ) ) @@ -9909,10 +9804,8 @@ def set_extra_http_headers(self, headers: typing.Dict[str, str]) -> None: An object containing additional HTTP headers to be sent with every request. All header values must be strings. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_extra_http_headers(headers=mapping.to_impl(headers)) - ) + self._sync( + self._impl_obj.set_extra_http_headers(headers=mapping.to_impl(headers)) ) def content(self, *, include_shadow: typing.Optional[bool] = None) -> str: @@ -9970,11 +9863,9 @@ def set_content( loading. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_content( - html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until - ) + self._sync( + self._impl_obj.set_content( + html=html, timeout=to_milliseconds(timeout), waitUntil=wait_until ) ) @@ -10143,11 +10034,9 @@ def wait_for_load_state( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_load_state( - state=state, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.wait_for_load_state( + state=state, timeout=to_milliseconds(timeout) ) ) @@ -10192,13 +10081,11 @@ def wait_for_url( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_url( - url=self._wrap_handler(url), - waitUntil=wait_until, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.wait_for_url( + url=self._wrap_handler(url), + waitUntil=wait_until, + timeout=to_milliseconds(timeout), ) ) @@ -10551,7 +10438,7 @@ def request_gc(self) -> None: ``` """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.request_gc())) + self._sync(self._impl_obj.request_gc()) def emulate_media( self, @@ -10616,15 +10503,13 @@ def emulate_media( contrast : Union["more", "no-preference", "null", None] """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.emulate_media( - media=media, - colorScheme=color_scheme, - reducedMotion=reduced_motion, - forcedColors=forced_colors, - contrast=contrast, - ) + self._sync( + self._impl_obj.emulate_media( + media=media, + colorScheme=color_scheme, + reducedMotion=reduced_motion, + forcedColors=forced_colors, + contrast=contrast, ) ) @@ -10652,9 +10537,7 @@ def set_viewport_size(self, viewport_size: ViewportSize) -> None: viewport_size : {width: int, height: int} """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.set_viewport_size(viewportSize=viewport_size)) - ) + self._sync(self._impl_obj.set_viewport_size(viewportSize=viewport_size)) def bring_to_front(self) -> None: """Page.bring_to_front @@ -10662,7 +10545,7 @@ def bring_to_front(self) -> None: Brings page to front (activates tab). """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.bring_to_front())) + self._sync(self._impl_obj.bring_to_front()) def hide_highlight(self) -> None: """Page.hide_highlight @@ -10670,7 +10553,7 @@ def hide_highlight(self) -> None: Hide all locator highlight overlays previously added by `locator.highlight()` on this page. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.hide_highlight())) + self._sync(self._impl_obj.hide_highlight()) def add_init_script( self, @@ -10833,11 +10716,9 @@ def unroute( Optional handler function to route the request. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.unroute( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + self._sync( + self._impl_obj.unroute( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) ) @@ -10878,11 +10759,9 @@ def handler(ws: WebSocketRoute): Handler function to route the WebSocket. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.route_web_socket( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + self._sync( + self._impl_obj.route_web_socket( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) ) @@ -10906,9 +10785,7 @@ def unroute_all( after unrouting are silently caught """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.unroute_all(behavior=behavior)) - ) + self._sync(self._impl_obj.unroute_all(behavior=behavior)) def route_from_har( self, @@ -10954,16 +10831,14 @@ def route_from_har( `minimal`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.route_from_har( - har=har, - url=url, - notFound=not_found, - update=update, - updateContent=update_content, - updateMode=update_mode, - ) + self._sync( + self._impl_obj.route_from_har( + har=har, + url=url, + notFound=not_found, + update=update, + updateContent=update_content, + updateMode=update_mode, ) ) @@ -11145,10 +11020,8 @@ def close( The reason to be reported to the operations interrupted by the page closure. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.close(runBeforeUnload=run_before_unload, reason=reason) - ) + self._sync( + self._impl_obj.close(runBeforeUnload=run_before_unload, reason=reason) ) def is_closed(self) -> bool: @@ -11237,22 +11110,20 @@ def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.click( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - strict=strict, - scroll=scroll, - ) + self._sync( + self._impl_obj.click( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + strict=strict, + scroll=scroll, ) ) @@ -11326,21 +11197,19 @@ def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dblclick( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.dblclick( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -11408,19 +11277,17 @@ def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.tap( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.tap( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -11467,16 +11334,14 @@ def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.fill( - selector=selector, - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - force=force, - ) + self._sync( + self._impl_obj.fill( + selector=selector, + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, + force=force, ) ) @@ -12099,11 +11964,9 @@ def focus( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.focus( - selector=selector, strict=strict, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.focus( + selector=selector, strict=strict, timeout=to_milliseconds(timeout) ) ) @@ -12319,19 +12182,17 @@ def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.hover( - selector=selector, - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.hover( + selector=selector, + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -12406,21 +12267,19 @@ def drag_and_drop( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.drag_and_drop( - source=source, - target=target, - sourcePosition=source_position, - targetPosition=target_position, - force=force, - noWaitAfter=no_wait_after, - timeout=to_milliseconds(timeout), - strict=strict, - trial=trial, - steps=steps, - scroll=scroll, - ) + self._sync( + self._impl_obj.drag_and_drop( + source=source, + target=target, + sourcePosition=source_position, + targetPosition=target_position, + force=force, + noWaitAfter=no_wait_after, + timeout=to_milliseconds(timeout), + strict=strict, + trial=trial, + steps=steps, + scroll=scroll, ) ) @@ -12595,15 +12454,13 @@ def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_input_files( - selector=selector, - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - strict=strict, - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.set_input_files( + selector=selector, + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + strict=strict, + noWaitAfter=no_wait_after, ) ) @@ -12646,16 +12503,14 @@ def type( element, the call throws an exception. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.type( - selector=selector, - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - ) + self._sync( + self._impl_obj.type( + selector=selector, + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, ) ) @@ -12729,16 +12584,14 @@ def press( element, the call throws an exception. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.press( - selector=selector, - key=key, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - strict=strict, - ) + self._sync( + self._impl_obj.press( + selector=selector, + key=key, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + strict=strict, ) ) @@ -12798,18 +12651,16 @@ def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.check( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.check( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -12869,18 +12720,16 @@ def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.uncheck( - selector=selector, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.uncheck( + selector=selector, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -12907,11 +12756,7 @@ def wait_for_timeout( A timeout to wait for """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout)) - ) - ) + self._sync(self._impl_obj.wait_for_timeout(timeout=to_milliseconds(timeout))) def wait_for_function( self, @@ -12995,7 +12840,7 @@ def pause(self) -> None: **NOTE** This method requires Playwright to be started in a headed mode, with a falsy `headless` option. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.pause())) + self._sync(self._impl_obj.pause()) def pdf( self, @@ -13812,19 +13657,17 @@ def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_checked( - selector=selector, - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - strict=strict, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.set_checked( + selector=selector, + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + strict=strict, + trial=trial, + scroll=scroll, ) ) @@ -13942,14 +13785,12 @@ def handler(locator): Specifies the maximum number of times this handler should be called. Unlimited by default. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.add_locator_handler( - locator=locator._impl_obj, - handler=self._wrap_handler(handler), - noWaitAfter=no_wait_after, - times=times, - ) + self._sync( + self._impl_obj.add_locator_handler( + locator=locator._impl_obj, + handler=self._wrap_handler(handler), + noWaitAfter=no_wait_after, + times=times, ) ) @@ -13964,9 +13805,7 @@ def remove_locator_handler(self, locator: "Locator") -> None: Locator passed to `page.add_locator_handler()`. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.remove_locator_handler(locator=locator._impl_obj)) - ) + self._sync(self._impl_obj.remove_locator_handler(locator=locator._impl_obj)) def requests(self) -> typing.List["Request"]: """Page.requests @@ -14036,9 +13875,7 @@ def clear_console_messages(self) -> None: return messages logged after the clear. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.clear_console_messages()) - ) + self._sync(self._impl_obj.clear_console_messages()) def clear_page_errors(self) -> None: """Page.clear_page_errors @@ -14047,7 +13884,7 @@ def clear_page_errors(self) -> None: errors thrown after the clear. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.clear_page_errors())) + self._sync(self._impl_obj.clear_page_errors()) def pick_locator(self) -> "Locator": """Page.pick_locator @@ -14076,13 +13913,14 @@ def cancel_pick_locator(self) -> None: active, this method is a no-op. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.cancel_pick_locator())) + self._sync(self._impl_obj.cancel_pick_locator()) mapping.register(PageImpl, Page) class WebError(SyncBase): + _impl_obj: WebErrorImpl @property def page(self) -> typing.Optional["Page"]: @@ -14123,6 +13961,7 @@ def location(self) -> WebErrorLocation: class WebStorage(SyncBase): + _impl_obj: WebStorageImpl def items(self) -> typing.List[NameValue]: """WebStorage.items @@ -14166,9 +14005,7 @@ def set_item(self, name: str, value: str) -> None: New value for the item. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.set_item(name=name, value=value)) - ) + self._sync(self._impl_obj.set_item(name=name, value=value)) def remove_item(self, name: str) -> None: """WebStorage.remove_item @@ -14181,9 +14018,7 @@ def remove_item(self, name: str) -> None: Name of the item to remove. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.remove_item(name=name)) - ) + self._sync(self._impl_obj.remove_item(name=name)) def clear(self) -> None: """WebStorage.clear @@ -14191,13 +14026,14 @@ def clear(self) -> None: Removes all items from the storage. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.clear())) + self._sync(self._impl_obj.clear()) mapping.register(WebStorageImpl, WebStorage) class BrowserContext(SyncContextManager): + _impl_obj: BrowserContextImpl @typing.overload def on( @@ -14733,11 +14569,7 @@ def set_default_navigation_timeout( Maximum navigation time in milliseconds """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_navigation_timeout( - timeout=to_milliseconds(timeout) - ) - ) + self._impl_obj.set_default_navigation_timeout(timeout=to_milliseconds(timeout)) def set_default_timeout( self, timeout: typing.Union[float, datetime.timedelta] @@ -14756,9 +14588,7 @@ def set_default_timeout( Maximum time in milliseconds. Pass `0` to disable timeout. """ - return mapping.from_maybe_impl( - self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) - ) + self._impl_obj.set_default_timeout(timeout=to_milliseconds(timeout)) def new_page(self) -> "Page": """BrowserContext.new_page @@ -14811,9 +14641,7 @@ def add_cookies(self, cookies: typing.Sequence[SetCookieParam]) -> None: cookies : Sequence[{name: str, value: str, url: Union[str, None], domain: Union[str, None], path: Union[str, None], expires: Union[float, None], httpOnly: Union[bool, None], secure: Union[bool, None], sameSite: Union["Lax", "None", "Strict", None], partitionKey: Union[str, None]}] """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies))) - ) + self._sync(self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies))) def clear_cookies( self, @@ -14846,11 +14674,7 @@ def clear_cookies( Only removes cookies with the given path. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.clear_cookies(name=name, domain=domain, path=path) - ) - ) + self._sync(self._impl_obj.clear_cookies(name=name, domain=domain, path=path)) def grant_permissions( self, permissions: typing.Sequence[str], *, origin: typing.Optional[str] = None @@ -14891,11 +14715,9 @@ def grant_permissions( The [origin] to grant permissions to, e.g. "https://example.com". """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.grant_permissions( - permissions=mapping.to_impl(permissions), origin=origin - ) + self._sync( + self._impl_obj.grant_permissions( + permissions=mapping.to_impl(permissions), origin=origin ) ) @@ -14914,7 +14736,7 @@ def clear_permissions(self) -> None: ``` """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.clear_permissions())) + self._sync(self._impl_obj.clear_permissions()) def set_geolocation(self, geolocation: typing.Optional[Geolocation] = None) -> None: """BrowserContext.set_geolocation @@ -14935,9 +14757,7 @@ def set_geolocation(self, geolocation: typing.Optional[Geolocation] = None) -> N geolocation : Union[{latitude: float, longitude: float, accuracy: Union[float, None]}, None] """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.set_geolocation(geolocation=geolocation)) - ) + self._sync(self._impl_obj.set_geolocation(geolocation=geolocation)) def set_extra_http_headers(self, headers: typing.Dict[str, str]) -> None: """BrowserContext.set_extra_http_headers @@ -14955,10 +14775,8 @@ def set_extra_http_headers(self, headers: typing.Dict[str, str]) -> None: An object containing additional HTTP headers to be sent with every request. All header values must be strings. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_extra_http_headers(headers=mapping.to_impl(headers)) - ) + self._sync( + self._impl_obj.set_extra_http_headers(headers=mapping.to_impl(headers)) ) def set_offline(self, offline: bool) -> None: @@ -14976,9 +14794,7 @@ def set_offline(self, offline: bool) -> None: """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.set_offline(offline=offline)) - ) + self._sync(self._impl_obj.set_offline(offline=offline)) def add_init_script( self, @@ -15265,11 +15081,9 @@ def unroute( Optional handler function used to register a routing with `browser_context.route()`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.unroute( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + self._sync( + self._impl_obj.unroute( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) ) @@ -15312,11 +15126,9 @@ def handler(ws: WebSocketRoute): Handler function to route the WebSocket. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.route_web_socket( - url=self._wrap_handler(url), handler=self._wrap_handler(handler) - ) + self._sync( + self._impl_obj.route_web_socket( + url=self._wrap_handler(url), handler=self._wrap_handler(handler) ) ) @@ -15340,9 +15152,7 @@ def unroute_all( after unrouting are silently caught """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.unroute_all(behavior=behavior)) - ) + self._sync(self._impl_obj.unroute_all(behavior=behavior)) def route_from_har( self, @@ -15388,16 +15198,14 @@ def route_from_har( `minimal`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.route_from_har( - har=har, - url=url, - notFound=not_found, - update=update, - updateContent=update_content, - updateMode=update_mode, - ) + self._sync( + self._impl_obj.route_from_har( + har=har, + url=url, + notFound=not_found, + update=update, + updateContent=update_content, + updateMode=update_mode, ) ) @@ -15640,7 +15448,7 @@ def close(self, *, reason: typing.Optional[str] = None) -> None: The reason to be reported to the operations interrupted by the context closure. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.close(reason=reason))) + self._sync(self._impl_obj.close(reason=reason)) def storage_state( self, @@ -15718,9 +15526,7 @@ def set_storage_state( information obtained via `browser_context.storage_state()`. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.set_storage_state(storageState=storage_state)) - ) + self._sync(self._impl_obj.set_storage_state(storageState=storage_state)) @typing.overload def wait_for_event( @@ -16025,6 +15831,7 @@ def new_cdp_session(self, page: typing.Union["Page", "Frame"]) -> "CDPSession": class CDPSession(SyncBase): + _impl_obj: CDPSessionImpl @typing.overload def on( @@ -16084,13 +15891,14 @@ def detach(self) -> None: used to send messages. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.detach())) + self._sync(self._impl_obj.detach()) mapping.register(CDPSessionImpl, CDPSession) class Browser(SyncContextManager): + _impl_obj: BrowserImpl @typing.overload def on( @@ -16720,7 +16528,7 @@ def close(self, *, reason: typing.Optional[str] = None) -> None: The reason to be reported to the operations interrupted by the browser closure. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.close(reason=reason))) + self._sync(self._impl_obj.close(reason=reason)) def new_browser_cdp_session(self) -> "CDPSession": """Browser.new_browser_cdp_session @@ -16779,7 +16587,7 @@ def unbind(self) -> None: Unbinds the browser server previously bound with `browser.bind()`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.unbind())) + self._sync(self._impl_obj.unbind()) def start_tracing( self, @@ -16819,14 +16627,12 @@ def start_tracing( specify custom categories to use instead of default. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.start_tracing( - page=page._impl_obj if page else None, - path=path, - screenshots=screenshots, - categories=mapping.to_impl(categories), - ) + self._sync( + self._impl_obj.start_tracing( + page=page._impl_obj if page else None, + path=path, + screenshots=screenshots, + categories=mapping.to_impl(categories), ) ) @@ -16852,6 +16658,7 @@ def stop_tracing(self) -> bytes: class BrowserType(SyncBase): + _impl_obj: BrowserTypeImpl @property def name(self) -> str: @@ -17508,6 +17315,7 @@ def connect( class Playwright(SyncBase): + _impl_obj: PlaywrightImpl @property def devices(self) -> typing.Dict: @@ -17624,13 +17432,14 @@ def stop(self) -> None: ``` """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.stop())) + self._sync(self._impl_obj.stop()) mapping.register(PlaywrightImpl, Playwright) class Tracing(SyncBase): + _impl_obj: TracingImpl def start( self, @@ -17769,7 +17578,7 @@ def stop_chunk( Export trace collected since the last `tracing.start_chunk()` call into the file with the given path. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.stop_chunk(path=path))) + self._sync(self._impl_obj.stop_chunk(path=path)) def stop( self, *, path: typing.Optional[typing.Union[pathlib.Path, str]] = None @@ -17784,7 +17593,7 @@ def stop( Export trace into the file with the given path. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.stop(path=path))) + self._sync(self._impl_obj.stop(path=path)) def group( self, name: str, *, location: typing.Optional[TracingGroupLocation] = None @@ -17830,7 +17639,7 @@ def group_end(self) -> None: Closes the last group created by `tracing.group()`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.group_end())) + self._sync(self._impl_obj.group_end()) def start_har( self, @@ -17891,13 +17700,14 @@ def stop_har(self) -> None: Stop HAR recording and save the HAR file to the path given to `tracing.start_har()`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.stop_har())) + self._sync(self._impl_obj.stop_har()) mapping.register(TracingImpl, Tracing) class Locator(SyncBase): + _impl_obj: LocatorImpl @property def page(self) -> "Page": @@ -18126,16 +17936,14 @@ def check( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.check( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.check( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -18229,21 +18037,19 @@ def click( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.click( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - clickCount=click_count, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + self._sync( + self._impl_obj.click( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + clickCount=click_count, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) ) @@ -18317,20 +18123,18 @@ def dblclick( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dblclick( - modifiers=mapping.to_impl(modifiers), - position=position, - delay=delay, - button=button, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - steps=steps, - scroll=scroll, - ) + self._sync( + self._impl_obj.dblclick( + modifiers=mapping.to_impl(modifiers), + position=position, + delay=delay, + button=button, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + steps=steps, + scroll=scroll, ) ) @@ -18390,13 +18194,11 @@ def dispatch_event( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.dispatch_event( - type=type, - eventInit=mapping.to_impl(event_init), - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.dispatch_event( + type=type, + eventInit=mapping.to_impl(event_init), + timeout=to_milliseconds(timeout), ) ) @@ -18595,14 +18397,12 @@ def fill( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.fill( - value=value, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - ) + self._sync( + self._impl_obj.fill( + value=value, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, ) ) @@ -18645,13 +18445,9 @@ def clear( Whether to bypass the [actionability](../actionability.md) checks. Defaults to `false`. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.clear( - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - ) + self._sync( + self._impl_obj.clear( + timeout=to_milliseconds(timeout), noWaitAfter=no_wait_after, force=force ) ) @@ -19464,9 +19260,7 @@ def focus( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.focus(timeout=to_milliseconds(timeout))) - ) + self._sync(self._impl_obj.focus(timeout=to_milliseconds(timeout))) def blur( self, @@ -19484,9 +19278,7 @@ def blur( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.blur(timeout=to_milliseconds(timeout))) - ) + self._sync(self._impl_obj.blur(timeout=to_milliseconds(timeout))) def all(self) -> typing.List["Locator"]: """Locator.all @@ -19606,19 +19398,17 @@ def drag_to( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.drag_to( - target=target._impl_obj, - force=force, - noWaitAfter=no_wait_after, - timeout=to_milliseconds(timeout), - trial=trial, - sourcePosition=source_position, - targetPosition=target_position, - steps=steps, - scroll=scroll, - ) + self._sync( + self._impl_obj.drag_to( + target=target._impl_obj, + force=force, + noWaitAfter=no_wait_after, + timeout=to_milliseconds(timeout), + trial=trial, + sourcePosition=source_position, + targetPosition=target_position, + steps=steps, + scroll=scroll, ) ) @@ -19661,11 +19451,9 @@ def drop( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.drop( - payload=payload, position=position, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.drop( + payload=payload, position=position, timeout=to_milliseconds(timeout) ) ) @@ -19767,17 +19555,15 @@ def hover( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.hover( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - force=force, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.hover( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, + force=force, + trial=trial, + scroll=scroll, ) ) @@ -20128,14 +19914,12 @@ def press( Deprecated: This option will default to `true` in the future. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.press( - key=key, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.press( + key=key, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -20383,12 +20167,8 @@ def scroll_into_view_if_needed( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.scroll_into_view_if_needed( - timeout=to_milliseconds(timeout) - ) - ) + self._sync( + self._impl_obj.scroll_into_view_if_needed(timeout=to_milliseconds(timeout)) ) def select_option( @@ -20505,12 +20285,8 @@ def select_text( be changed by using the `browser_context.set_default_timeout()` or `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.select_text( - force=force, timeout=to_milliseconds(timeout) - ) - ) + self._sync( + self._impl_obj.select_text(force=force, timeout=to_milliseconds(timeout)) ) def set_input_files( @@ -20575,13 +20351,11 @@ def set_input_files( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_input_files( - files=mapping.to_impl(files), - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.set_input_files( + files=mapping.to_impl(files), + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -20646,17 +20420,15 @@ def tap( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.tap( - modifiers=mapping.to_impl(modifiers), - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.tap( + modifiers=mapping.to_impl(modifiers), + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -20718,14 +20490,12 @@ def type( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.type( - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.type( + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -20776,14 +20546,12 @@ def press_sequentially( Deprecated: This option has no effect. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.press_sequentially( - text=text, - delay=delay, - timeout=to_milliseconds(timeout), - noWaitAfter=no_wait_after, - ) + self._sync( + self._impl_obj.press_sequentially( + text=text, + delay=delay, + timeout=to_milliseconds(timeout), + noWaitAfter=no_wait_after, ) ) @@ -20845,16 +20613,14 @@ def uncheck( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.uncheck( - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.uncheck( + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -20937,10 +20703,8 @@ def wait_for( `visibility:hidden`. This is opposite to the `'visible'` option. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for(timeout=to_milliseconds(timeout), state=state) - ) + self._sync( + self._impl_obj.wait_for(timeout=to_milliseconds(timeout), state=state) ) def wait_for_function( @@ -20981,13 +20745,11 @@ def wait_for_function( `page.set_default_timeout()` methods. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.wait_for_function( - expression=expression, - arg=mapping.to_impl(arg), - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.wait_for_function( + expression=expression, + arg=mapping.to_impl(arg), + timeout=to_milliseconds(timeout), ) ) @@ -21051,17 +20813,15 @@ def set_checked( viewport. This is useful to assert that an element is reachable by the user without additional scrolling. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.set_checked( - checked=checked, - position=position, - timeout=to_milliseconds(timeout), - force=force, - noWaitAfter=no_wait_after, - trial=trial, - scroll=scroll, - ) + self._sync( + self._impl_obj.set_checked( + checked=checked, + position=position, + timeout=to_milliseconds(timeout), + force=force, + noWaitAfter=no_wait_after, + trial=trial, + scroll=scroll, ) ) @@ -21077,9 +20837,7 @@ def highlight(self, *, style: typing.Optional[str] = None) -> None: Additional inline CSS applied to the highlight overlay, e.g. `"outline: 2px dashed red"`. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.highlight(style=style)) - ) + self._sync(self._impl_obj.highlight(style=style)) def hide_highlight(self) -> None: """Locator.hide_highlight @@ -21087,13 +20845,14 @@ def hide_highlight(self) -> None: Hides the element highlight previously added by `locator.highlight()`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.hide_highlight())) + self._sync(self._impl_obj.hide_highlight()) mapping.register(LocatorImpl, Locator) class APIResponse(SyncBase): + _impl_obj: APIResponseImpl @property def ok(self) -> bool: @@ -21253,13 +21012,14 @@ def dispose(self) -> None: Disposes the body of this response. If not called then the body will stay in memory until the context closes. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.dispose())) + self._sync(self._impl_obj.dispose()) mapping.register(APIResponseImpl, APIResponse) class APIRequestContext(SyncBase): + _impl_obj: APIRequestContextImpl @property def tracing(self) -> "Tracing": @@ -21286,9 +21046,7 @@ def dispose(self, *, reason: typing.Optional[str] = None) -> None: The reason to be reported to the operations interrupted by the context disposal. """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.dispose(reason=reason)) - ) + self._sync(self._impl_obj.dispose(reason=reason)) def cookies( self, urls: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None @@ -21331,9 +21089,7 @@ def add_cookies(self, cookies: typing.Sequence[SetCookieParam]) -> None: cookies : Sequence[{name: str, value: str, url: Union[str, None], domain: Union[str, None], path: Union[str, None], expires: Union[float, None], httpOnly: Union[bool, None], secure: Union[bool, None], sameSite: Union["Lax", "None", "Strict", None], partitionKey: Union[str, None]}] """ - return mapping.from_maybe_impl( - self._sync(self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies))) - ) + self._sync(self._impl_obj.add_cookies(cookies=mapping.to_impl(cookies))) def clear_cookies( self, @@ -21368,11 +21124,7 @@ def clear_cookies( Only removes cookies with the given path. """ - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.clear_cookies(name=name, domain=domain, path=path) - ) - ) + self._sync(self._impl_obj.clear_cookies(name=name, domain=domain, path=path)) def delete( self, @@ -22124,6 +21876,7 @@ def storage_state( class APIRequest(SyncBase): + _impl_obj: APIRequestImpl def new_context( self, @@ -22234,6 +21987,7 @@ def new_context( class PageAssertions(SyncBase): + _impl_obj: PageAssertionsImpl def to_have_title( self, @@ -22264,11 +22018,9 @@ def to_have_title( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_title( - titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_have_title( + titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) ) ) @@ -22291,11 +22043,9 @@ def not_to_have_title( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_title( - titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_title( + titleOrRegExp=title_or_reg_exp, timeout=to_milliseconds(timeout) ) ) @@ -22332,13 +22082,11 @@ def to_have_url( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_url( - urlOrRegExp=url_or_reg_exp, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + self._sync( + self._impl_obj.to_have_url( + urlOrRegExp=url_or_reg_exp, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) ) @@ -22365,13 +22113,11 @@ def not_to_have_url( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_url( - urlOrRegExp=url_or_reg_exp, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + self._sync( + self._impl_obj.not_to_have_url( + urlOrRegExp=url_or_reg_exp, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) ) @@ -22403,11 +22149,9 @@ def to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) ) @@ -22429,11 +22173,9 @@ def not_to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) ) @@ -22442,6 +22184,7 @@ def not_to_match_aria_snapshot( class LocatorAssertions(SyncBase): + _impl_obj: LocatorAssertionsImpl def to_contain_text( self, @@ -22526,14 +22269,12 @@ def to_contain_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_contain_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + self._sync( + self._impl_obj.to_contain_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) ) @@ -22569,14 +22310,12 @@ def not_to_contain_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_contain_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + self._sync( + self._impl_obj.not_to_contain_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) ) @@ -22617,14 +22356,12 @@ def to_have_attribute( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_attribute( - name=name, - value=value, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.to_have_attribute( + name=name, + value=value, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) ) @@ -22654,14 +22391,12 @@ def not_to_have_attribute( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_attribute( - name=name, - value=value, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.not_to_have_attribute( + name=name, + value=value, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) ) @@ -22716,11 +22451,9 @@ def to_have_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_have_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) ) @@ -22749,11 +22482,9 @@ def not_to_have_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) ) @@ -22812,11 +22543,9 @@ def to_contain_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_contain_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_contain_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) ) @@ -22839,11 +22568,9 @@ def not_to_contain_class( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_contain_class( - expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_contain_class( + expected=mapping.to_impl(expected), timeout=to_milliseconds(timeout) ) ) @@ -22875,12 +22602,8 @@ def to_have_count( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_count( - count=count, timeout=to_milliseconds(timeout) - ) - ) + self._sync( + self._impl_obj.to_have_count(count=count, timeout=to_milliseconds(timeout)) ) def not_to_have_count( @@ -22902,11 +22625,9 @@ def not_to_have_count( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_count( - count=count, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_count( + count=count, timeout=to_milliseconds(timeout) ) ) @@ -22944,14 +22665,9 @@ def to_have_css( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_css( - name=name, - value=value, - timeout=to_milliseconds(timeout), - pseudo=pseudo, - ) + self._sync( + self._impl_obj.to_have_css( + name=name, value=value, timeout=to_milliseconds(timeout), pseudo=pseudo ) ) @@ -22977,11 +22693,9 @@ def not_to_have_css( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_css( - name=name, value=value, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_css( + name=name, value=value, timeout=to_milliseconds(timeout) ) ) @@ -23013,11 +22727,7 @@ def to_have_id( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_id(id=id, timeout=to_milliseconds(timeout)) - ) - ) + self._sync(self._impl_obj.to_have_id(id=id, timeout=to_milliseconds(timeout))) def not_to_have_id( self, @@ -23038,10 +22748,8 @@ def not_to_have_id( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_id(id=id, timeout=to_milliseconds(timeout)) - ) + self._sync( + self._impl_obj.not_to_have_id(id=id, timeout=to_milliseconds(timeout)) ) def to_have_js_property( @@ -23076,13 +22784,11 @@ def to_have_js_property( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_js_property( - name=name, - value=mapping.to_impl(value), - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.to_have_js_property( + name=name, + value=mapping.to_impl(value), + timeout=to_milliseconds(timeout), ) ) @@ -23108,13 +22814,11 @@ def not_to_have_js_property( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_js_property( - name=name, - value=mapping.to_impl(value), - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.not_to_have_js_property( + name=name, + value=mapping.to_impl(value), + timeout=to_milliseconds(timeout), ) ) @@ -23148,12 +22852,8 @@ def to_have_value( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_value( - value=value, timeout=to_milliseconds(timeout) - ) - ) + self._sync( + self._impl_obj.to_have_value(value=value, timeout=to_milliseconds(timeout)) ) def not_to_have_value( @@ -23175,11 +22875,9 @@ def not_to_have_value( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_value( - value=value, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_value( + value=value, timeout=to_milliseconds(timeout) ) ) @@ -23228,11 +22926,9 @@ def to_have_values( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_values( - values=mapping.to_impl(values), timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_have_values( + values=mapping.to_impl(values), timeout=to_milliseconds(timeout) ) ) @@ -23259,11 +22955,9 @@ def not_to_have_values( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_values( - values=mapping.to_impl(values), timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_values( + values=mapping.to_impl(values), timeout=to_milliseconds(timeout) ) ) @@ -23349,14 +23043,12 @@ def to_have_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + self._sync( + self._impl_obj.to_have_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) ) @@ -23392,14 +23084,12 @@ def not_to_have_text( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_text( - expected=mapping.to_impl(expected), - useInnerText=use_inner_text, - timeout=to_milliseconds(timeout), - ignoreCase=ignore_case, - ) + self._sync( + self._impl_obj.not_to_have_text( + expected=mapping.to_impl(expected), + useInnerText=use_inner_text, + timeout=to_milliseconds(timeout), + ignoreCase=ignore_case, ) ) @@ -23428,11 +23118,9 @@ def to_be_attached( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_be_attached( - attached=attached, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_be_attached( + attached=attached, timeout=to_milliseconds(timeout) ) ) @@ -23469,13 +23157,11 @@ def to_be_checked( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_be_checked( - timeout=to_milliseconds(timeout), - checked=checked, - indeterminate=indeterminate, - ) + self._sync( + self._impl_obj.to_be_checked( + timeout=to_milliseconds(timeout), + checked=checked, + indeterminate=indeterminate, ) ) @@ -23497,11 +23183,9 @@ def not_to_be_attached( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_attached( - attached=attached, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_be_attached( + attached=attached, timeout=to_milliseconds(timeout) ) ) @@ -23521,11 +23205,7 @@ def not_to_be_checked( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_checked(timeout=to_milliseconds(timeout)) - ) - ) + self._sync(self._impl_obj.not_to_be_checked(timeout=to_milliseconds(timeout))) def to_be_disabled( self, @@ -23556,9 +23236,7 @@ def to_be_disabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync(self._impl_obj.to_be_disabled(timeout=to_milliseconds(timeout))) - ) + self._sync(self._impl_obj.to_be_disabled(timeout=to_milliseconds(timeout))) def not_to_be_disabled( self, @@ -23576,11 +23254,7 @@ def not_to_be_disabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_disabled(timeout=to_milliseconds(timeout)) - ) - ) + self._sync(self._impl_obj.not_to_be_disabled(timeout=to_milliseconds(timeout))) def to_be_editable( self, @@ -23609,11 +23283,9 @@ def to_be_editable( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_be_editable( - editable=editable, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_be_editable( + editable=editable, timeout=to_milliseconds(timeout) ) ) @@ -23635,11 +23307,9 @@ def not_to_be_editable( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_editable( - editable=editable, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_be_editable( + editable=editable, timeout=to_milliseconds(timeout) ) ) @@ -23668,9 +23338,7 @@ def to_be_empty( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync(self._impl_obj.to_be_empty(timeout=to_milliseconds(timeout))) - ) + self._sync(self._impl_obj.to_be_empty(timeout=to_milliseconds(timeout))) def not_to_be_empty( self, @@ -23688,9 +23356,7 @@ def not_to_be_empty( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync(self._impl_obj.not_to_be_empty(timeout=to_milliseconds(timeout))) - ) + self._sync(self._impl_obj.not_to_be_empty(timeout=to_milliseconds(timeout))) def to_be_enabled( self, @@ -23719,11 +23385,9 @@ def to_be_enabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_be_enabled( - enabled=enabled, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_be_enabled( + enabled=enabled, timeout=to_milliseconds(timeout) ) ) @@ -23745,11 +23409,9 @@ def not_to_be_enabled( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_enabled( - enabled=enabled, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_be_enabled( + enabled=enabled, timeout=to_milliseconds(timeout) ) ) @@ -23779,9 +23441,7 @@ def to_be_hidden( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync(self._impl_obj.to_be_hidden(timeout=to_milliseconds(timeout))) - ) + self._sync(self._impl_obj.to_be_hidden(timeout=to_milliseconds(timeout))) def not_to_be_hidden( self, @@ -23799,11 +23459,7 @@ def not_to_be_hidden( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_hidden(timeout=to_milliseconds(timeout)) - ) - ) + self._sync(self._impl_obj.not_to_be_hidden(timeout=to_milliseconds(timeout))) def to_be_visible( self, @@ -23842,11 +23498,9 @@ def to_be_visible( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_be_visible( - visible=visible, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_be_visible( + visible=visible, timeout=to_milliseconds(timeout) ) ) @@ -23868,11 +23522,9 @@ def not_to_be_visible( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_visible( - visible=visible, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_be_visible( + visible=visible, timeout=to_milliseconds(timeout) ) ) @@ -23901,9 +23553,7 @@ def to_be_focused( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync(self._impl_obj.to_be_focused(timeout=to_milliseconds(timeout))) - ) + self._sync(self._impl_obj.to_be_focused(timeout=to_milliseconds(timeout))) def not_to_be_focused( self, @@ -23921,11 +23571,7 @@ def not_to_be_focused( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_focused(timeout=to_milliseconds(timeout)) - ) - ) + self._sync(self._impl_obj.not_to_be_focused(timeout=to_milliseconds(timeout))) def to_be_in_viewport( self, @@ -23962,11 +23608,9 @@ def to_be_in_viewport( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_be_in_viewport( - ratio=ratio, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_be_in_viewport( + ratio=ratio, timeout=to_milliseconds(timeout) ) ) @@ -23988,11 +23632,9 @@ def not_to_be_in_viewport( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_be_in_viewport( - ratio=ratio, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_be_in_viewport( + ratio=ratio, timeout=to_milliseconds(timeout) ) ) @@ -24027,13 +23669,11 @@ def to_have_accessible_description( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_accessible_description( - description=description, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.to_have_accessible_description( + description=description, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) ) @@ -24060,11 +23700,9 @@ def not_to_have_accessible_description( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_accessible_description( - name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_accessible_description( + name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) ) ) @@ -24099,11 +23737,9 @@ def to_have_accessible_name( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_accessible_name( - name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_have_accessible_name( + name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) ) ) @@ -24130,11 +23766,9 @@ def not_to_have_accessible_name( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_accessible_name( - name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_have_accessible_name( + name=name, ignoreCase=ignore_case, timeout=to_milliseconds(timeout) ) ) @@ -24250,10 +23884,8 @@ def to_have_role( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_role(role=role, timeout=to_milliseconds(timeout)) - ) + self._sync( + self._impl_obj.to_have_role(role=role, timeout=to_milliseconds(timeout)) ) def to_have_accessible_error_message( @@ -24287,13 +23919,11 @@ def to_have_accessible_error_message( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_have_accessible_error_message( - errorMessage=error_message, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.to_have_accessible_error_message( + errorMessage=error_message, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) ) @@ -24320,13 +23950,11 @@ def not_to_have_accessible_error_message( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_accessible_error_message( - errorMessage=error_message, - ignoreCase=ignore_case, - timeout=to_milliseconds(timeout), - ) + self._sync( + self._impl_obj.not_to_have_accessible_error_message( + errorMessage=error_message, + ignoreCase=ignore_case, + timeout=to_milliseconds(timeout), ) ) @@ -24432,12 +24060,8 @@ def not_to_have_role( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_have_role( - role=role, timeout=to_milliseconds(timeout) - ) - ) + self._sync( + self._impl_obj.not_to_have_role(role=role, timeout=to_milliseconds(timeout)) ) def to_match_aria_snapshot( @@ -24468,11 +24092,9 @@ def to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) ) @@ -24494,11 +24116,9 @@ def not_to_match_aria_snapshot( """ __tracebackhide__ = True - return mapping.from_maybe_impl( - self._sync( - self._impl_obj.not_to_match_aria_snapshot( - expected=expected, timeout=to_milliseconds(timeout) - ) + self._sync( + self._impl_obj.not_to_match_aria_snapshot( + expected=expected, timeout=to_milliseconds(timeout) ) ) @@ -24507,6 +24127,7 @@ def not_to_match_aria_snapshot( class APIResponseAssertions(SyncBase): + _impl_obj: APIResponseAssertionsImpl def to_be_ok(self) -> None: """APIResponseAssertions.to_be_ok @@ -24525,7 +24146,7 @@ def to_be_ok(self) -> None: """ __tracebackhide__ = True - return mapping.from_maybe_impl(self._sync(self._impl_obj.to_be_ok())) + self._sync(self._impl_obj.to_be_ok()) def not_to_be_ok(self) -> None: """APIResponseAssertions.not_to_be_ok @@ -24534,13 +24155,14 @@ def not_to_be_ok(self) -> None: """ __tracebackhide__ = True - return mapping.from_maybe_impl(self._sync(self._impl_obj.not_to_be_ok())) + self._sync(self._impl_obj.not_to_be_ok()) mapping.register(APIResponseAssertionsImpl, APIResponseAssertions) class Disposable(SyncContextManager): + _impl_obj: DisposableImpl def dispose(self) -> None: """Disposable.dispose @@ -24549,11 +24171,11 @@ def dispose(self) -> None: or `browser_context.add_init_script()`. """ - return mapping.from_maybe_impl(self._sync(self._impl_obj.dispose())) + self._sync(self._impl_obj.dispose()) def close(self) -> None: - return mapping.from_maybe_impl(self._sync(self._impl_obj.close())) + self._sync(self._impl_obj.close()) mapping.register(DisposableImpl, Disposable) diff --git a/scripts/codegen/generate_api.js b/scripts/codegen/generate_api.js index 29bdf887e..e6216b8cb 100644 --- a/scripts/codegen/generate_api.js +++ b/scripts/codegen/generate_api.js @@ -846,17 +846,13 @@ function orderedClasses() { // The file lists only the places where that order differs from the docs order. // It keeps the diff of the switch to this generator small enough to review. // -// The section also reproduces more habits of the old generator: +// The section also reproduces two more habits of the old generator: // - the order of the members of a union, from legacyOrder.unions; // - docstring lines wrapped before the member links were replaced with their -// Python form, so that the wrapped lines can be too long or too short; -// - `return mapping.from_maybe_impl(...)` around calls that return nothing; -// - no type on `_impl_obj`. So mypy does not check the generated calls -// against playwright/_impl yet. The type needs two annotation fixes in -// _impl/ (`_wrap_handler`, `to_milliseconds`); they land with its removal. +// Python form, so that the wrapped lines can be too long or too short. // // To remove it: delete legacy_order.json, this section, the calls to its -// functions, and the `legacyOrder ? ... : ...` choices. Every place is marked +// functions, and the `legacyOrder ? ... : ...` choice. Every place is marked // TEMPORARY. /** @@ -1171,8 +1167,6 @@ function emitMember(clazz, member, out) { expression = isAsync ? `await ${call}` : `self._sync(${call})`; if (member.returnType) out.push(` return ${wrapper}(${expression})`); - else if (legacyOrder) // TEMPORARY: the legacy order. - out.push(` return mapping.from_maybe_impl(${expression})`); else out.push(` ${expression}`); } @@ -1185,8 +1179,7 @@ function emitClass(clazz, out) { out.push(''); out.push(`class ${clazz.name}(${clazz.base}):`); // Typed, so that mypy checks every call below against the implementation. - if (!legacyOrder) // TEMPORARY: the legacy order. - out.push(` _impl_obj: ${clazz.name}Impl`); + out.push(` _impl_obj: ${clazz.name}Impl`); out.push(''); emitEvents(clazz, out); for (const member of clazz.members) { diff --git a/tests/sync/test_sync.py b/tests/sync/test_sync.py index c438c06a7..122c03cff 100644 --- a/tests/sync/test_sync.py +++ b/tests/sync/test_sync.py @@ -79,7 +79,7 @@ def test_browser_repr(browser: Browser) -> None: def test_browser_type_repr(browser: Browser) -> None: - browser_type = browser._impl_obj._browser_type + browser_type = browser.browser_type assert ( repr(browser_type) == f""