From edc6a6fc3e9dac9daa380638f5f75a8a781de87a Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 28 Jul 2020 23:00:18 +0200 Subject: [PATCH] feat: add docs to the generated API (#101) --- playwright/async_api.py | 2395 ++++++++++++++++++ playwright/sync_api.py | 2395 ++++++++++++++++++ scripts/documentation_provider.py | 93 + scripts/generate_async_api.py | 9 +- scripts/generate_sync_api.py | 8 +- tests/test_scripts_documentation_provider.py | 13 + 6 files changed, 4911 insertions(+), 2 deletions(-) create mode 100644 scripts/documentation_provider.py create mode 100644 tests/test_scripts_documentation_provider.py diff --git a/playwright/async_api.py b/playwright/async_api.py index d87e533da..8a0673e69 100644 --- a/playwright/async_api.py +++ b/playwright/async_api.py @@ -62,44 +62,96 @@ def __init__(self, obj: RequestImpl): @property def url(self) -> str: + """ + - returns: URL of the request. + """ return mapping.from_maybe_impl(self._impl_obj.url) @property def resourceType(self) -> str: + """ + - returns: + + Contains the request's resource type as it was perceived by the rendering engine. + ResourceType will be one of the following: `document`, `stylesheet`, `image`, `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`, `websocket`, `manifest`, `other`. + """ return mapping.from_maybe_impl(self._impl_obj.resourceType) @property def method(self) -> str: + """ + - returns: Request's method (GET, POST, etc.) + """ return mapping.from_maybe_impl(self._impl_obj.method) @property def postData(self) -> typing.Union[str, NoneType]: + """ + - returns: Request's post body, if any. + """ return mapping.from_maybe_impl(self._impl_obj.postData) @property def headers(self) -> typing.Dict[str, str]: + """ + - returns: <[Dict]<[str], [str]>> An object with HTTP headers associated with the request. All header names are lower-case. + """ return mapping.from_maybe_impl(self._impl_obj.headers) @property def frame(self) -> "Frame": + """ + - returns: A [Frame] that initiated this request. + """ return mapping.from_impl(self._impl_obj.frame) @property def redirectedFrom(self) -> typing.Union["Request", NoneType]: + """ + - returns: Request that was redirected by the server to this one, if any. + + When the server responds with a redirect, Playwright creates a new [Request] object. The two requests are connected by `redirectedFrom()` and `redirectedTo()` methods. When multiple server redirects has happened, it is possible to construct the whole redirect chain by repeatedly calling `redirectedFrom()`. + + For example, if the website `http://example.com` redirects to `https://example.com`: + + If the website `https://google.com` has no redirects: + """ return mapping.from_impl_nullable(self._impl_obj.redirectedFrom) @property def redirectedTo(self) -> typing.Union["Request", NoneType]: + """ + - returns: New request issued by the browser if the server responded with redirect. + + This method is the opposite of [request.redirectedFrom()](#requestredirectedfrom): + """ return mapping.from_impl_nullable(self._impl_obj.redirectedTo) @property def failure(self) -> typing.Union[str, NoneType]: + """ + - returns: Dict describing request failure, if any + - `errorText` Human-readable error message, e.g. `'net::ERR_FAILED'`. + + The method returns `null` unless this request has failed, as reported by + `requestfailed` event. + + Example of logging of all the failed requests: + """ return mapping.from_maybe_impl(self._impl_obj.failure) async def response(self) -> typing.Union["Response", NoneType]: + """ + - returns: A matching [Response] object, or `null` if the response was not received due to error. + """ return mapping.from_impl_nullable(await self._impl_obj.response()) def isNavigationRequest(self) -> bool: + """ + - returns: + + Whether this request is driving frame's navigation. + """ return mapping.from_maybe_impl(self._impl_obj.isNavigationRequest()) @@ -112,42 +164,85 @@ def __init__(self, obj: ResponseImpl): @property def url(self) -> str: + """ + - returns: + + Contains the URL of the response. + """ return mapping.from_maybe_impl(self._impl_obj.url) @property def ok(self) -> bool: + """ + - returns: + + Contains a bool stating whether the response was successful (status in the range 200-299) or not. + """ return mapping.from_maybe_impl(self._impl_obj.ok) @property def status(self) -> int: + """ + - returns: + + Contains the status code of the response (e.g., 200 for a success). + """ return mapping.from_maybe_impl(self._impl_obj.status) @property def statusText(self) -> str: + """ + - returns: + + Contains the status text of the response (e.g. usually an "OK" for a success). + """ return mapping.from_maybe_impl(self._impl_obj.statusText) @property def headers(self) -> typing.Dict[str, str]: + """ + - returns: An object with HTTP headers associated with the response. All header names are lower-case. + """ return mapping.from_maybe_impl(self._impl_obj.headers) @property def request(self) -> "Request": + """ + - returns: A matching [Request] object. + """ return mapping.from_impl(self._impl_obj.request) @property def frame(self) -> "Frame": + """ + - returns: A [Frame] that initiated this response. + """ return mapping.from_impl(self._impl_obj.frame) async def finished(self) -> typing.Union[Error, NoneType]: + """ + - returns: Waits for this response to finish, returns failure error if request failed. + """ return mapping.from_maybe_impl(await self._impl_obj.finished()) async def body(self) -> bytes: + """ + - returns: Promise which resolves to a buffer with response body. + """ return mapping.from_maybe_impl(await self._impl_obj.body()) async def text(self) -> str: + """ + - returns: Promise which resolves to a text representation of response body. + """ return mapping.from_maybe_impl(await self._impl_obj.text()) async def json(self) -> typing.Union[typing.Dict, typing.List]: + """ + - returns: Promise which resolves to a JSON representation of response body. + + This method will throw if the response body is not parsable via `JSON.parse`. + """ return mapping.from_maybe_impl(await self._impl_obj.json()) @@ -160,9 +255,34 @@ def __init__(self, obj: RouteImpl): @property def request(self) -> "Request": + """ + - returns: A request to be routed. + """ return mapping.from_impl(self._impl_obj.request) async def abort(self, error_code: str = "failed") -> NoneType: + """ + - `errorCode` Optional error code. Defaults to `failed`, could be + one of the following: + - `'aborted'` - An operation was aborted (due to user action) + - `'accessdenied'` - Permission to access a resource, other than the network, was denied + - `'addressunreachable'` - The IP address is unreachable. This usually means + that there is no route to the specified host or network. + - `'blockedbyclient'` - The client chose to block the request. + - `'blockedbyresponse'` - The request failed because the response was delivered along with requirements which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor checks, for instance). + - `'connectionaborted'` - A connection timed out as a result of not receiving an ACK for data sent. + - `'connectionclosed'` - A connection was closed (corresponding to a TCP FIN). + - `'connectionfailed'` - A connection attempt failed. + - `'connectionrefused'` - A connection attempt was refused. + - `'connectionreset'` - A connection was reset (corresponding to a TCP RST). + - `'internetdisconnected'` - The Internet connection has been lost. + - `'namenotresolved'` - The host name could not be resolved. + - `'timedout'` - An operation timed out. + - `'failed'` - A generic failure occurred. + - returns: + + Aborts the route's request. + """ return mapping.from_maybe_impl( await self._impl_obj.abort(error_code=error_code) ) @@ -174,6 +294,21 @@ async def fulfill( body: typing.Union[str, bytes] = None, 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). + - returns: + + Fulfills route's request with given response. + + An example of fulfilling all requests with 404 responses: + + An example of serving static file: + """ return mapping.from_maybe_impl( await self._impl_obj.fulfill( status=status, headers=headers, body=body, contentType=contentType @@ -186,6 +321,15 @@ async def continue_( headers: typing.Union[typing.Dict[str, str]] = None, 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. + - returns: + + Continues route's request with optional overrides. + """ return mapping.from_maybe_impl( await self._impl_obj.continue_( method=method, headers=headers, postData=postData @@ -201,20 +345,88 @@ def __init__(self, obj: KeyboardImpl): super().__init__(obj) async def down(self, key: str) -> NoneType: + """ + - `key` Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. + - returns: + + Dispatches a `keydown` event. + + `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: + + `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc. + + Following modification shortcuts are also suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`. + + Holding down `Shift` will type the text that corresponds to the `key` in the upper case. + + If `key` is a single character, it is case-sensitive, so the values `a` and `A` will generate different respective texts. + + If `key` is a modifier key, `Shift`, `Meta`, `Control`, or `Alt`, subsequent key presses will be sent with that modifier active. To release the modifier key, use [`keyboard.up`](#keyboardupkey). + + After the key is pressed once, subsequent calls to [`keyboard.down`](#keyboarddownkey) will have [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use [`keyboard.up`](#keyboardupkey). + + > **NOTE** Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case. + """ return mapping.from_maybe_impl(await self._impl_obj.down(key=key)) async def up(self, key: str) -> NoneType: + """ + - `key` Name of the key to press or a character to generate, such as `ArrowLeft` or `a`. + - returns: + + Dispatches a `keyup` event. + """ return mapping.from_maybe_impl(await self._impl_obj.up(key=key)) async def insertText(self, text: str) -> NoneType: + """ + - `text` Sets input to the specified text value. + - returns: + + Dispatches only `input` event, does not emit the `keydown`, `keyup` or `keypress` events. + + > **NOTE** Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case. + """ return mapping.from_maybe_impl(await self._impl_obj.insertText(text=text)) 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. + - returns: + + Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. + + To press a special key, like `Control` or `ArrowDown`, use [`keyboard.press`](#keyboardpresskey-options). + + > **NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case. + """ return mapping.from_maybe_impl( await self._impl_obj.type(text=text, delay=delay) ) 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. + - 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: + + `F1` - `F12`, `Digit0`- `Digit9`, `KeyA`- `KeyZ`, `Backquote`, `Minus`, `Equal`, `Backslash`, `Backspace`, `Tab`, `Delete`, `Escape`, `ArrowDown`, `End`, `Enter`, `Home`, `Insert`, `PageDown`, `PageUp`, `ArrowRight`, `ArrowUp`, etc. + + Following modification shortcuts are also suported: `Shift`, `Control`, `Alt`, `Meta`, `ShiftLeft`. + + Holding down `Shift` will type the text that corresponds to the `key` in the upper case. + + 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)) @@ -226,11 +438,28 @@ def __init__(self, obj: MouseImpl): super().__init__(obj) async def move(self, x: float, y: float, steps: int = None) -> NoneType: + """ + - `x` + - `y` + - `options` + - `steps` defaults to 1. Sends intermediate `mousemove` events. + - returns: + + Dispatches a `mousemove` event. + """ return mapping.from_maybe_impl(await self._impl_obj.move(x=x, y=y, steps=steps)) 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]. + - returns: + + Dispatches a `mousedown` event. + """ return mapping.from_maybe_impl( await self._impl_obj.down(button=button, clickCount=clickCount) ) @@ -238,6 +467,14 @@ async def down( 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]. + - returns: + + Dispatches a `mouseup` event. + """ return mapping.from_maybe_impl( await self._impl_obj.up(button=button, clickCount=clickCount) ) @@ -250,6 +487,17 @@ async def click( button: Literal["left", "right", "middle"] = None, clickCount: int = None, ) -> NoneType: + """ + - `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. + - 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( x=x, y=y, delay=delay, button=button, clickCount=clickCount @@ -263,6 +511,16 @@ async def dblclick( delay: int = None, button: Literal["left", "right", "middle"] = None, ) -> NoneType: + """ + - `x` + - `y` + - `options` + - `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) ) @@ -278,6 +536,17 @@ def __init__(self, obj: JSHandleImpl): 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 + - `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction` + - returns: Promise which resolves to the return value of `pageFunction` + + This method passes this handle as the first argument to `pageFunction`. + + If `pageFunction` returns a [Promise], then `handle.evaluate` would wait for the promise to resolve and return its value. + + Examples: + """ return mapping.from_maybe_impl( await self._impl_obj.evaluate( expression=expression, arg=mapping.to_impl(arg), force_expr=force_expr @@ -287,6 +556,19 @@ async def evaluate( async def evaluateHandle( self, expression: str, arg: typing.Any = None, force_expr: bool = False ) -> "JSHandle": + """ + - `pageFunction` <[function]|[str]> Function to be evaluated + - `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction` + - returns: Promise which resolves to the return value of `pageFunction` as in-page object (JSHandle) + + This method passes this handle as the first argument to `pageFunction`. + + The only difference between `jsHandle.evaluate` and `jsHandle.evaluateHandle` is that `jsHandle.evaluateHandle` returns in-page object (JSHandle). + + If the function passed to the `jsHandle.evaluateHandle` returns a [Promise], then `jsHandle.evaluateHandle` would wait for the promise to resolve and return its value. + + See [page.evaluateHandle()](#pageevaluatehandlepagefunction-arg) for more details. + """ return mapping.from_impl( await self._impl_obj.evaluateHandle( expression=expression, arg=mapping.to_impl(arg), force_expr=force_expr @@ -294,18 +576,48 @@ async def evaluateHandle( ) async def getProperty(self, name: 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)) async def getProperties(self) -> typing.Dict[str, "JSHandle"]: + """ + - returns: <[Map]<[str], [JSHandle]>> + + The method returns a map with **own property names** as keys and JSHandle instances for the property values. + """ return mapping.from_impl_dict(await self._impl_obj.getProperties()) def asElement(self) -> typing.Union["ElementHandle", NoneType]: + """ + - returns: + + Returns either `null` or the object handle itself, if the object handle is an instance of [ElementHandle]. + """ return mapping.from_impl_nullable(self._impl_obj.asElement()) async def dispose(self) -> NoneType: + """ + - returns: Promise which resolves when the object handle is successfully disposed. + + The `jsHandle.dispose` method stops referencing the element handle. + """ return mapping.from_maybe_impl(await self._impl_obj.dispose()) async def jsonValue(self) -> typing.Any: + """ + - returns: + + Returns a JSON representation of the object. If the object has a + [`toJSON`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Dicts/JSON/strify#toJSON()_behavior) + function, it **will not be called**. + + > **NOTE** The method will return an empty JSON object if the referenced object is not strifiable. It will throw an error if the object has circular references. + """ return mapping.from_maybe_impl(await self._impl_obj.jsonValue()) @@ -317,32 +629,83 @@ def __init__(self, obj: ElementHandleImpl): super().__init__(obj) def asElement(self) -> typing.Union["ElementHandle", NoneType]: + """ + - returns: + + Returns either `null` or the object handle itself, if the object handle is an instance of [ElementHandle]. + """ return mapping.from_impl_nullable(self._impl_obj.asElement()) async def ownerFrame(self) -> typing.Union["Frame", NoneType]: + """ + - returns: Returns the frame containing the given element. + """ return mapping.from_impl_nullable(await self._impl_obj.ownerFrame()) async def contentFrame(self) -> typing.Union["Frame", NoneType]: + """ + - returns: Resolves to the content frame for element handles referencing iframe nodes, or `null` otherwise + """ return mapping.from_impl_nullable(await self._impl_obj.contentFrame()) async def getAttribute(self, name: str) -> str: + """ + - `name` Attribute name to get the value for. + - returns: + + Returns element attribute value. + """ return mapping.from_maybe_impl(await self._impl_obj.getAttribute(name=name)) async def textContent(self) -> str: + """ + - returns: Resolves to the `node.textContent`. + """ return mapping.from_maybe_impl(await self._impl_obj.textContent()) async def innerText(self) -> str: + """ + - returns: Resolves to the `element.innerText`. + """ return mapping.from_maybe_impl(await self._impl_obj.innerText()) async def innerHTML(self) -> str: + """ + - returns: Resolves to the `element.innerHTML`. + """ return mapping.from_maybe_impl(await self._impl_obj.innerHTML()) async def dispatchEvent(self, type: str, eventInit: typing.Dict = None) -> NoneType: + """ + - `type` DOM event type: `"click"`, `"dragstart"`, etc. + - `eventInit` event-specific initialization properties. + - returns: + + The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the elment, `click` is dispatched. This is equivalend to calling [`element.click()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click). + + Under the hood, it creates an instance of an event based on the given `type`, initializes it with `eventInit` properties and dispatches it on the element. Events are `composed`, `cancelable` and bubble by default. + + Since `eventInit` is event-specific, please refer to the events documentation for the lists of initial properties: + - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent) + - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent) + - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent) + - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent) + - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent) + - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent) + - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event) + + You can also specify `JSHandle` as the property value if you want live objects to be passed into the event: + """ return mapping.from_maybe_impl( await self._impl_obj.dispatchEvent(type=type, eventInit=eventInit) ) 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. + - returns: + """ return mapping.from_maybe_impl( await self._impl_obj.scrollIntoViewIfNeeded(timeout=timeout) ) @@ -356,6 +719,19 @@ async def hover( timeout: int = None, 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. + - 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. + If the element is detached from DOM, the method throws an error. + """ return mapping.from_maybe_impl( await self._impl_obj.hover( modifiers=modifiers, position=position, timeout=timeout, force=force @@ -375,6 +751,23 @@ async def click( force: bool = None, 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. + - 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. + If the element is detached from DOM, the method throws an error. + """ return mapping.from_maybe_impl( await self._impl_obj.click( modifiers=modifiers, @@ -400,6 +793,26 @@ async def dblclick( force: bool = None, 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. + - 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. + If the element is detached from DOM, the method throws an error. + + Bear in mind that if the first click of the `dblclick()` triggers a navigation event, there will be an exception. + + > **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event. + """ return mapping.from_maybe_impl( await self._impl_obj.dblclick( modifiers=modifiers, @@ -425,6 +838,19 @@ async def selectOption( timeout: int = None, noWaitAfter: bool = None, ) -> typing.List[str]: + """ + - `values` |[Dict]|[List]|[List]> Options to select. If the `` element, the method throws an error. + """ return mapping.from_maybe_impl( await self._impl_obj.selectOption( values=mapping.to_impl(values), timeout=timeout, noWaitAfter=noWaitAfter @@ -434,6 +860,17 @@ async def selectOption( async def fill( self, value: str, timeout: int = None, noWaitAfter: bool = None ) -> NoneType: + """ + - `value` Value to set for the ``, `