diff --git a/playwright/async_api.py b/playwright/async_api.py index 8a0673e69..8e7b03004 100644 --- a/playwright/async_api.py +++ b/playwright/async_api.py @@ -260,7 +260,7 @@ def request(self) -> "Request": """ return mapping.from_impl(self._impl_obj.request) - async def abort(self, error_code: str = "failed") -> NoneType: + async def abort(self, errorCode: str = "failed") -> NoneType: """ - `errorCode` Optional error code. Defaults to `failed`, could be one of the following: @@ -283,9 +283,7 @@ async def abort(self, error_code: str = "failed") -> NoneType: Aborts the route's request. """ - return mapping.from_maybe_impl( - await self._impl_obj.abort(error_code=error_code) - ) + return mapping.from_maybe_impl(await self._impl_obj.abort(errorCode=errorCode)) async def fulfill( self, @@ -295,12 +293,11 @@ async def fulfill( contentType: str = None, ) -> NoneType: """ - - `response` Response that will fulfill this route's request. - - `status` Response status code, defaults to `200`. - - `headers` <[Dict]<[str], [str]>> Optional response headers. Header values will be converted to a str. - - `contentType` If set, equals to setting `Content-Type` response header. - - `body` <[str]|[bytes]> Optional response body. - - `path` Optional file path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). + - `status` Response status code, defaults to `200`. + - `headers` <[Dict]<[str], [str]>> Optional response headers. Header values will be converted to a str. + - `contentType` If set, equals to setting `Content-Type` response header. + - `body` <[str]|[bytes]> Optional response body. + - `path` Optional file path to respond with. The content type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). - returns: Fulfills route's request with given response. @@ -322,10 +319,9 @@ async def continue_( postData: typing.Union[str, bytes] = None, ) -> NoneType: """ - - `overrides` Optional request overrides, which can be one of the following: - - `method` If set changes the request method (e.g. GET or POST) - - `postData` <[str]|[bytes]> If set changes the post data of request - - `headers` <[Dict]<[str], [str]>> If set changes the request HTTP headers. Header values will be converted to a str. + - `method` If set changes the request method (e.g. GET or POST) + - `postData` <[str]|[bytes]> If set changes the post data of request + - `headers` <[Dict]<[str], [str]>> If set changes the request HTTP headers. Header values will be converted to a str. - returns: Continues route's request with optional overrides. @@ -392,8 +388,7 @@ async def insertText(self, text: str) -> NoneType: async def type(self, text: str, delay: int = None) -> NoneType: """ - `text` A text to type into a focused element. - - `options` - - `delay` Time to wait between key presses in milliseconds. Defaults to 0. + - `delay` Time to wait between key presses in milliseconds. Defaults to 0. - returns: Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. @@ -409,8 +404,7 @@ async def type(self, text: str, delay: int = None) -> NoneType: async def press(self, key: str, delay: int = None) -> NoneType: """ - `key` Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. - - `options` - - `delay` Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. + - `delay` Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0. - returns: `key` can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are: @@ -424,8 +418,6 @@ async def press(self, key: str, delay: int = None) -> NoneType: If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts. Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported as well. When speficied with the modifier, modifier is pressed and being held while the subsequent key is being pressed. - - Shortcut for [`keyboard.down`](#keyboarddownkey) and [`keyboard.up`](#keyboardupkey). """ return mapping.from_maybe_impl(await self._impl_obj.press(key=key, delay=delay)) @@ -441,8 +433,7 @@ async def move(self, x: float, y: float, steps: int = None) -> NoneType: """ - `x` - `y` - - `options` - - `steps` defaults to 1. Sends intermediate `mousemove` events. + - `steps` defaults to 1. Sends intermediate `mousemove` events. - returns: Dispatches a `mousemove` event. @@ -453,9 +444,8 @@ async def down( self, button: Literal["left", "right", "middle"] = None, clickCount: int = None ) -> NoneType: """ - - `options` - - `button` <"left"|"right"|"middle"> Defaults to `left`. - - `clickCount` defaults to 1. See [UIEvent.detail]. + - `button` <"left"|"right"|"middle"> Defaults to `left`. + - `clickCount` defaults to 1. See [UIEvent.detail]. - returns: Dispatches a `mousedown` event. @@ -468,9 +458,8 @@ async def up( self, button: Literal["left", "right", "middle"] = None, clickCount: int = None ) -> NoneType: """ - - `options` - - `button` <"left"|"right"|"middle"> Defaults to `left`. - - `clickCount` defaults to 1. See [UIEvent.detail]. + - `button` <"left"|"right"|"middle"> Defaults to `left`. + - `clickCount` defaults to 1. See [UIEvent.detail]. - returns: Dispatches a `mouseup` event. @@ -490,13 +479,10 @@ async def click( """ - `x` - `y` - - `options` - - `button` <"left"|"right"|"middle"> Defaults to `left`. - - `clickCount` defaults to 1. See [UIEvent.detail]. - - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. + - `button` <"left"|"right"|"middle"> Defaults to `left`. + - `clickCount` defaults to 1. See [UIEvent.detail]. + - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. - returns: - - Shortcut for [`mouse.move`](#mousemovex-y-options), [`mouse.down`](#mousedownoptions) and [`mouse.up`](#mouseupoptions). """ return mapping.from_maybe_impl( await self._impl_obj.click( @@ -514,12 +500,9 @@ async def dblclick( """ - `x` - `y` - - `options` - - `button` <"left"|"right"|"middle"> Defaults to `left`. - - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. + - `button` <"left"|"right"|"middle"> Defaults to `left`. + - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. - returns: - - Shortcut for [`mouse.move`](#mousemovex-y-options), [`mouse.down`](#mousedownoptions), [`mouse.up`](#mouseupoptions), [`mouse.down`](#mousedownoptions) and [`mouse.up`](#mouseupoptions). """ return mapping.from_maybe_impl( await self._impl_obj.dblclick(x=x, y=y, delay=delay, button=button) @@ -537,7 +520,8 @@ async def evaluate( self, expression: str, arg: typing.Any = None, force_expr: bool = False ) -> typing.Any: """ - - `pageFunction` <[function]\\([Dict]\\)> Function to be evaluated in browser context + - `expression` <[str]> Function to be evaluated in browser context + - `force_expr` <[bool]> Whether to treat given expression as JavaScript evaluate expression, even though it looks like an arrow function - `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction` - returns: Promise which resolves to the return value of `pageFunction` @@ -557,7 +541,8 @@ async def evaluateHandle( self, expression: str, arg: typing.Any = None, force_expr: bool = False ) -> "JSHandle": """ - - `pageFunction` <[function]|[str]> Function to be evaluated + - `expression` <[str]> Function to be evaluated + - `force_expr` <[bool]> Whether to treat given expression as JavaScript evaluate expression, even though it looks like an arrow function - `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction` - returns: Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle) @@ -575,14 +560,16 @@ async def evaluateHandle( ) ) - async def getProperty(self, name: str) -> "JSHandle": + async def getProperty(self, propertyName: str) -> "JSHandle": """ - `propertyName` property to get - returns: Fetches a single property from the referenced object. """ - return mapping.from_impl(await self._impl_obj.getProperty(name=name)) + return mapping.from_impl( + await self._impl_obj.getProperty(propertyName=propertyName) + ) async def getProperties(self) -> typing.Dict[str, "JSHandle"]: """ @@ -702,8 +689,7 @@ async def dispatchEvent(self, type: str, eventInit: typing.Dict = None) -> NoneT async def scrollIntoViewIfNeeded(self, timeout: int = None) -> NoneType: """ - - `options` - - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. + - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: """ return mapping.from_maybe_impl( @@ -720,13 +706,12 @@ async def hover( force: bool = None, ) -> NoneType: """ - - `options` - - `position` A point to hover relative to the top-left corner of element padding box. If not specified, hovers over some visible point of the element. - - x - - y - - `modifiers` <[List]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the hover, and then restores current modifiers back. If not specified, currently pressed modifiers are used. - - `force` Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`. - - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. + - `position` A point to hover relative to the top-left corner of element padding box. If not specified, hovers over some visible point of the element. + - x + - y + - `modifiers` <[List]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the hover, and then restores current modifiers back. If not specified, currently pressed modifiers are used. + - `force` Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`. + - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: Promise which resolves when the element is successfully hovered. This method scrolls element into view if needed, and then uses [page.mouse](#pagemouse) to hover over the center of the element. @@ -752,17 +737,16 @@ async def click( noWaitAfter: bool = None, ) -> NoneType: """ - - `options` - - `button` <"left"|"right"|"middle"> Defaults to `left`. - - `clickCount` defaults to 1. See [UIEvent.detail]. - - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. - - `position` A point to click relative to the top-left corner of element padding box. If not specified, clicks to some visible point of the element. - - x - - y - - `modifiers` <[List]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the click, and then restores current modifiers back. If not specified, currently pressed modifiers are used. - - `force` Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`. - - `noWaitAfter` Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. - - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. + - `button` <"left"|"right"|"middle"> Defaults to `left`. + - `clickCount` defaults to 1. See [UIEvent.detail]. + - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. + - `position` A point to click relative to the top-left corner of element padding box. If not specified, clicks to some visible point of the element. + - x + - y + - `modifiers` <[List]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the click, and then restores current modifiers back. If not specified, currently pressed modifiers are used. + - `force` Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`. + - `noWaitAfter` Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. + - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: Promise which resolves when the element is successfully clicked. Promise gets rejected if the element is detached from DOM. This method scrolls element into view if needed, and then uses [page.mouse](#pagemouse) to click in the center of the element. @@ -794,16 +778,15 @@ async def dblclick( noWaitAfter: bool = None, ) -> NoneType: """ - - `options` - - `button` <"left"|"right"|"middle"> Defaults to `left`. - - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. - - `position` A point to double click relative to the top-left corner of element padding box. If not specified, double clicks to some visible point of the element. - - x - - y - - `modifiers` <[List]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the double click, and then restores current modifiers back. If not specified, currently pressed modifiers are used. - - `force` Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`. - - `noWaitAfter` Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. - - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. + - `button` <"left"|"right"|"middle"> Defaults to `left`. + - `delay` Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0. + - `position` A point to double click relative to the top-left corner of element padding box. If not specified, double clicks to some visible point of the element. + - x + - y + - `modifiers` <[List]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the double click, and then restores current modifiers back. If not specified, currently pressed modifiers are used. + - `force` Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`. + - `noWaitAfter` Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. + - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: Promise which resolves when the element is successfully double clicked. Promise gets rejected if the element is detached from DOM. This method scrolls element into view if needed, and then uses [page.mouse](#pagemouse) to click in the center of the element. @@ -843,9 +826,8 @@ async def selectOption( - `value` Matches by `option.value`. - `label` Matches by `option.label`. - `index` Matches by the index. - - `options` - - `noWaitAfter` Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. - - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. + - `noWaitAfter` Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`. + - `timeout` Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](#pagesetdefaulttimeouttimeout) methods. - returns: An array of option values that have been successfully selected. Triggers a `change` and `input` event once all the provided options have been selected. @@ -862,9 +844,8 @@ async def fill( ) -> NoneType: """ - `value` Value to set for the ``, `