From 114d586f071b767ad2f2bd7adf25001bb2566f24 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Fri, 8 Jan 2021 15:00:14 -0800 Subject: [PATCH] chore: add python aliases (#4949) --- docs/src/api/class-browsercontext.md | 1 + docs/src/api/class-elementhandle.md | 8 +++++++ docs/src/api/class-frame.md | 8 +++++++ docs/src/api/class-page.md | 10 ++++++++ docs/src/api/class-route.md | 2 ++ docs/src/api/class-websocket.md | 1 + docs/src/api/params.md | 13 +++++++++++ docs/src/api/python.md | 23 ++++++++++++++++++ docs/src/selectors.md | 12 ++++++---- utils/doclint/api_parser.js | 28 ++++++++++++++++------ utils/doclint/documentation.js | 32 ++++++++++++++++++-------- utils/doclint/generateApiJson.js | 8 +------ utils/doclint/missingDocs.js | 2 +- utils/doclint/test/missingDocs.spec.js | 1 - utils/markdown.js | 10 +++++--- 15 files changed, 125 insertions(+), 34 deletions(-) diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md index 8f4418464c654..8301c0dc31f5a 100644 --- a/docs/src/api/class-browsercontext.md +++ b/docs/src/api/class-browsercontext.md @@ -481,6 +481,7 @@ await context.grantPermissions(['geolocation']); Event name, same one would pass into `browserContext.on(event)`. ### param: BrowserContext.waitForEvent.optionsOrPredicate +* langs: js - `optionsOrPredicate` <[Function]|[Object]> - `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve. - `timeout` <[float]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]. diff --git a/docs/src/api/class-elementhandle.md b/docs/src/api/class-elementhandle.md index 0a52a917b07c8..223fa7aa5ea43 100644 --- a/docs/src/api/class-elementhandle.md +++ b/docs/src/api/class-elementhandle.md @@ -22,6 +22,8 @@ JSHandle.dispose`]. ElementHandles are auto-disposed when their origin frame get ElementHandle instances can be used as an argument in [`method: Page.$eval`] and [`method: Page.evaluate`] methods. ## async method: ElementHandle.$ +* langs: + - alias-python: query_selector - returns: <[null]|[ElementHandle]> The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See [Working with @@ -30,6 +32,8 @@ selectors](./selectors.md#working-with-selectors) for more details. If no elemen ### param: ElementHandle.$.selector = %%-query-selector-%% ## async method: ElementHandle.$$ +* langs: + - alias-python: query_selector_all - returns: <[Array]<[ElementHandle]>> The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See [Working with @@ -38,6 +42,8 @@ selectors](./selectors.md#working-with-selectors) for more details. If no elemen ### param: ElementHandle.$$.selector = %%-query-selector-%% ## async method: ElementHandle.$eval +* langs: + - alias-python: eval_on_selector - returns: <[Serializable]> Returns the return value of [`param: pageFunction`] @@ -70,6 +76,8 @@ Function to be evaluated in browser context Optional argument to pass to [`param: pageFunction`] ## async method: ElementHandle.$$eval +* langs: + - alias-python: eval_on_selector_all - returns: <[Serializable]> Returns the return value of [`param: pageFunction`] diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md index 86b884c9395b5..e51f30fe7e19a 100644 --- a/docs/src/api/class-frame.md +++ b/docs/src/api/class-frame.md @@ -38,6 +38,8 @@ console.log(text); ``` ## async method: Frame.$ +* langs: + - alias-python: query_selector - returns: <[null]|[ElementHandle]> Returns the ElementHandle pointing to the frame element. @@ -48,6 +50,8 @@ selectors](./selectors.md#working-with-selectors) for more details. If no elemen ### param: Frame.$.selector = %%-query-selector-%% ## async method: Frame.$$ +* langs: + - alias-python: query_selector_all - returns: <[Array]<[ElementHandle]>> Returns the ElementHandles pointing to the frame elements. @@ -58,6 +62,8 @@ selectors](./selectors.md#working-with-selectors) for more details. If no elemen ### param: Frame.$$.selector = %%-query-selector-%% ## async method: Frame.$eval +* langs: + - alias-python: eval_on_selector - returns: <[Serializable]> Returns the return value of [`param: pageFunction`] @@ -90,6 +96,8 @@ Function to be evaluated in browser context Optional argument to pass to [`param: pageFunction`] ## async method: Frame.$$eval +* langs: + - alias-python: eval_on_selector_all - returns: <[Serializable]> Returns the return value of [`param: pageFunction`] diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 11f680dfcd6e1..ea67a9e875a92 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -210,6 +210,8 @@ Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/We page. ## async method: Page.$ +* langs: + - alias-python: query_selector - returns: <[null]|[ElementHandle]> The method finds an element matching the specified selector within the page. If no elements match the selector, the @@ -220,6 +222,8 @@ Shortcut for main frame's [`method: Frame.$`]. ### param: Page.$.selector = %%-query-selector-%% ## async method: Page.$$ +* langs: + - alias-python: query_selector_all - returns: <[Array]<[ElementHandle]>> The method finds all elements matching the specified selector within the page. If no elements match the selector, the @@ -230,6 +234,8 @@ Shortcut for main frame's [`method: Frame.$$`]. ### param: Page.$$.selector = %%-query-selector-%% ## async method: Page.$eval +* langs: + - alias-python: eval_on_selector - returns: <[Serializable]> The method finds an element matching the specified selector within the page and passes it as a first argument to @@ -262,6 +268,8 @@ Function to be evaluated in browser context Optional argument to pass to [`param: pageFunction`] ## async method: Page.$$eval +* langs: + - alias-python: eval_on_selector_all - returns: <[Serializable]> The method finds all elements matching the specified selector within the page and passes an array of matched elements as @@ -560,6 +568,7 @@ await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').ma ``` ### param: Page.emulateMedia.params +* langs: js - `params` <[Object]> - `media` <[null]|"screen"|"print"> Changes the CSS media type of the page. The only allowed values are `'screen'`, `'print'` and `null`. Passing `null` disables CSS media emulation. Omitting `media` or passing `undefined` does not change the emulated value. Optional. - `colorScheme` <[null]|"light"|"dark"|"no-preference"> Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. Passing `null` disables color scheme emulation. Omitting `colorScheme` or passing `undefined` does not change the emulated value. Optional. @@ -1569,6 +1578,7 @@ value. Will throw an error if the page is closed before the event is fired. Event name, same one would pass into `page.on(event)`. ### param: Page.waitForEvent.optionsOrPredicate +* langs: js - `optionsOrPredicate` <[Function]|[Object]> - `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve. - `timeout` <[float]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]. diff --git a/docs/src/api/class-route.md b/docs/src/api/class-route.md index 159311dfbabda..0b21cd3a966d9 100644 --- a/docs/src/api/class-route.md +++ b/docs/src/api/class-route.md @@ -27,6 +27,8 @@ Optional error code. Defaults to `failed`, could be one of the following: * `'failed'` - A generic failure occurred. ## async method: Route.continue +* langs: + - alias-python: continue_ Continues route's request with optional overrides. diff --git a/docs/src/api/class-websocket.md b/docs/src/api/class-websocket.md index f51ae99f95544..c9574e3c77ba9 100644 --- a/docs/src/api/class-websocket.md +++ b/docs/src/api/class-websocket.md @@ -47,6 +47,7 @@ value. Will throw an error if the webSocket is closed before the event is fired. Event name, same one would pass into `webSocket.on(event)`. ### param: WebSocket.waitForEvent.optionsOrPredicate +* langs: js - `optionsOrPredicate` <[Function]|[Object]> - `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve. - `timeout` <[float]> maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]. diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 7f3464d54edc1..5c4661003fe65 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -303,6 +303,19 @@ only the first option matching one of the passed options is selected. Optional. Options to select by label. If the `