Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

docs: explicitly annotate methods and parameters #4771

Merged
merged 1 commit into from Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
976 changes: 501 additions & 475 deletions docs-src/api-body.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs-src/api-header.md
Expand Up @@ -77,7 +77,7 @@ This object can be used to launch or connect to Chromium, returning instances of
#### playwright.devices
- returns: <[Object]>

Returns a list of devices to be used with [`browser.newContext([options])`](#browsernewcontextoptions) or [`browser.newPage([options])`](#browsernewpageoptions). Actual list of devices can be found in [src/server/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/server/deviceDescriptors.ts).
Returns a list of devices to be used with [`method: Browser.newContext`]() or [`method: Browser.newPage`](). Actual list of devices can be found in [src/server/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/server/deviceDescriptors.ts).

```js
const { webkit, devices } = require('playwright');
Expand All @@ -99,7 +99,7 @@ const iPhone = devices['iPhone 6'];
- returns: <[Object]>
- `TimeoutError` <[function]> A class of [TimeoutError].

Playwright methods might throw errors if they are unable to fulfill a request. For example, [page.waitForSelector(selector[, options])](#pagewaitforselectorselector-options)
Playwright methods might throw errors if they are unable to fulfill a request. For example, [`method: Page.waitForSelector`]()
might fail if the selector doesn't match any nodes during the given timeframe.

For certain types of errors Playwright uses specific error classes.
Expand Down
30 changes: 15 additions & 15 deletions docs-src/api-params.md
Expand Up @@ -13,25 +13,25 @@ When to consider operation succeeded, defaults to `load`. Events can be either:

Maximum operation time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout.
The default value can be changed by using the
[browserContext.setDefaultNavigationTimeout()](),
[browserContext.setDefaultTimeout()](),
[page.setDefaultNavigationTimeout()]() or
[page.setDefaultTimeout()]() methods.
[`method: BrowserContext.setDefaultNavigationTimeout`](),
[`method: BrowserContext.setDefaultTimeout`](),
[`method: Page.setDefaultNavigationTimeout`]() or
[`method: Page.setDefaultTimeout`]() methods.

## wait-for-timeout

- `timeout` <[number]>

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 [browserContext.setDefaultTimeout()]().
value can be changed by using the [`method: BrowserContext.setDefaultTimeout`]().

## input-timeout

- `timeout` <[number]>

Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
using the [browserContext.setDefaultTimeout()]() or
[page.setDefaultTimeout()]() methods.
using the [`method: BrowserContext.setDefaultTimeout`]() or
[`method: Page.setDefaultTimeout`]() methods.

## input-no-wait-after

Expand Down Expand Up @@ -133,7 +133,7 @@ Defaults to `'visible'`. Can be either:
- `value` <[string]>

Populates context with given storage state. This method can be used to initialize context with logged-in information
obtained via [browserContext.storageState()](). Either a path to the file with saved storage, or an object with the following fields:
obtained via [`method: BrowserContext.storageState`](). Either a path to the file with saved storage, or an object with the following fields:

## context-option-acceptdownloads

Expand Down Expand Up @@ -218,7 +218,7 @@ request header value as well as number and date formatting rules.
- `permissions` <[Array]<[string]>>

A list of permissions to grant to all pages in this context. See
[browserContext.grantPermissions()]() for more details.
[`method: BrowserContext.grantPermissions`]() for more details.

## context-option-extrahttpheaders

Expand All @@ -245,7 +245,7 @@ Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/W
- `colorScheme` <"light"|"dark"|"no-preference">

Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See
[page.emulateMedia()]() for more details. Defaults to '`light`'.
[`method: Page.emulateMedia`]() for more details. Defaults to '`light`'.

## context-option-logger

Expand All @@ -257,17 +257,17 @@ Logger sink for Playwright logging.

- `videosPath` <[string]>

**NOTE** Use `recordVideo` instead, it takes precedence over `videosPath`. Enables video recording for all pages to
**NOTE** Use [`param: recordVideo`]() instead, it takes precedence over `videosPath`. Enables video recording for all pages to
`videosPath` directory. If not specified, videos are not recorded. Make sure to await
[browserContext.close()]() for videos to be saved.
[`method: BrowserContext.close`]() for videos to be saved.

## context-option-videosize

- `videoSize` <[Object]>
- `width` <[number]> Video frame width.
- `height` <[number]> Video frame height.

**NOTE** Use `recordVideo` instead, it takes precedence over `videoSize`. Specifies dimensions of the automatically
**NOTE** Use [`param: recordVideo`]() instead, it takes precedence over `videoSize`. Specifies dimensions of the automatically
recorded video. Can only be used if `videosPath` is set. If not specified the size will be equal to `viewport`. If
`viewport` is not configured explicitly the video size defaults to 1280x720. Actual picture of the page will be scaled
down if necessary to fit specified size.
Expand All @@ -280,7 +280,7 @@ down if necessary to fit specified size.
- `path` <[string]> Path on the filesystem to write the HAR file to.

Enables [HAR](http://www.softwareishard.com/blog/har-12-spec) recording for all pages into `recordHar.path` file. If not
specified, the HAR is not recorded. Make sure to await [browserContext.close()]() for the HAR to be
specified, the HAR is not recorded. Make sure to await [`method: BrowserContext.close`]() for the HAR to be
saved.

## context-option-recordvideo
Expand All @@ -294,7 +294,7 @@ saved.
- `height` <[number]> Video frame height.

Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make
sure to await [browserContext.close()]() for videos to be saved.
sure to await [`method: BrowserContext.close`]() for videos to be saved.

## context-option-proxy

Expand Down