Skip to content

Commit 31ffeb3

Browse files
authored
doc: further align docs w/ playwright.dev (2) (microsoft#4871)
1 parent 3ff81fe commit 31ffeb3

21 files changed

Lines changed: 139 additions & 137 deletions

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ yarn.lock
1414
lib/
1515
jest-report.json
1616
drivers/
17-
/docs/api.json
1817
.android-sdk/
1918
.gradle/
20-
nohup.out
19+
nohup.out
20+
api.json

docs/out/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Playwright is a library to automate [Chromium](https://www.chromium.org/Home), [
3838
- [Page object models](./pom.md)
3939
1. Integrations
4040
- [Test runners](./test-runners.md)
41-
- [Docker](././docker.md)
41+
- [Docker](./docker.md)
4242
- [Continuous integration](./ci.md)
4343
1. Reference
4444
- [API Reference](./api/class-playwright.md)

docs/out/api/class-browsercontext.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ await context.close();
3131
- [browserContext.clearPermissions()](api/class-browsercontext.md#browsercontextclearpermissions)
3232
- [browserContext.close()](api/class-browsercontext.md#browsercontextclose)
3333
- [browserContext.cookies([urls])](api/class-browsercontext.md#browsercontextcookiesurls)
34-
- [browserContext.exposeBinding(name, playwrightBinding[, options])](api/class-browsercontext.md#browsercontextexposebindingname-playwrightbinding-options)
35-
- [browserContext.exposeFunction(name, playwrightFunction)](api/class-browsercontext.md#browsercontextexposefunctionname-playwrightfunction)
34+
- [browserContext.exposeBinding(name, callback[, options])](api/class-browsercontext.md#browsercontextexposebindingname-callback-options)
35+
- [browserContext.exposeFunction(name, callback)](api/class-browsercontext.md#browsercontextexposefunctionname-callback)
3636
- [browserContext.grantPermissions(permissions[, options])](api/class-browsercontext.md#browsercontextgrantpermissionspermissions-options)
3737
- [browserContext.newPage()](api/class-browsercontext.md#browsercontextnewpage)
3838
- [browserContext.pages()](api/class-browsercontext.md#browsercontextpages)
@@ -92,7 +92,7 @@ await browserContext.addCookies([cookieObject1, cookieObject2]);
9292

9393
## browserContext.addInitScript(script[, arg])
9494
- `script` <[function]|[string]|[Object]> Script to be evaluated in all pages in the browser context.
95-
- `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
95+
- `path` <[path]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
9696
- `content` <[string]> Raw script content. Optional.
9797
- `arg` <[Serializable]> Optional argument to pass to `script` (only supported when passing a function).
9898
- returns: <[Promise]>
@@ -162,18 +162,18 @@ Closes the browser context. All the pages that belong to the browser context wil
162162

163163
If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned.
164164

165-
## browserContext.exposeBinding(name, playwrightBinding[, options])
165+
## browserContext.exposeBinding(name, callback[, options])
166166
- `name` <[string]> Name of the function on the window object.
167-
- `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context.
167+
- `callback` <[function]> Callback function that will be called in the Playwright's context.
168168
- `options` <[Object]>
169169
- `handle` <[boolean]> Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is supported. When passing by value, multiple arguments are supported.
170170
- returns: <[Promise]>
171171

172-
The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `playwrightBinding` and returns a [Promise] which resolves to the return value of `playwrightBinding`. If the `playwrightBinding` returns a [Promise], it will be awaited.
172+
The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`. If the `callback` returns a [Promise], it will be awaited.
173173

174-
The first argument of the `playwrightBinding` function contains information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`.
174+
The first argument of the `callback` function contains information about the caller: `{ browserContext: BrowserContext, page: Page, frame: Frame }`.
175175

176-
See [page.exposeBinding(name, playwrightBinding[, options])](api/class-page.md#pageexposebindingname-playwrightbinding-options) for page-only version.
176+
See [page.exposeBinding(name, callback[, options])](api/class-page.md#pageexposebindingname-callback-options) for page-only version.
177177

178178
An example of exposing page URL to all frames in all pages in the context:
179179

@@ -213,16 +213,16 @@ await page.setContent(`
213213
`);
214214
```
215215

216-
## browserContext.exposeFunction(name, playwrightFunction)
216+
## browserContext.exposeFunction(name, callback)
217217
- `name` <[string]> Name of the function on the window object.
218-
- `playwrightFunction` <[function]> Callback function that will be called in the Playwright's context.
218+
- `callback` <[function]> Callback function that will be called in the Playwright's context.
219219
- returns: <[Promise]>
220220

221-
The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `playwrightFunction` and returns a [Promise] which resolves to the return value of `playwrightFunction`.
221+
The method adds a function called `name` on the `window` object of every frame in every page in the context. When called, the function executes `callback` and returns a [Promise] which resolves to the return value of `callback`.
222222

223-
If the `playwrightFunction` returns a [Promise], it will be awaited.
223+
If the `callback` returns a [Promise], it will be awaited.
224224

225-
See [page.exposeFunction(name, playwrightFunction)](api/class-page.md#pageexposefunctionname-playwrightfunction) for page-only version.
225+
See [page.exposeFunction(name, callback)](api/class-page.md#pageexposefunctionname-callback) for page-only version.
226226

227227
An example of adding an `md5` function to all pages in the context:
228228

@@ -372,7 +372,7 @@ Provide credentials for [HTTP authentication](https://developer.mozilla.org/en-U
372372

373373
## browserContext.storageState([options])
374374
- `options` <[Object]>
375-
- `path` <[string]> The file path to save the storage state to. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, storage state is still returned, but won't be saved to the disk.
375+
- `path` <[path]> The file path to save the storage state to. If `path` is a relative path, then it is resolved relative to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, storage state is still returned, but won't be saved to the disk.
376376
- returns: <[Promise]<[Object]>>
377377
- `cookies` <[Array]<[Object]>>
378378
- `name` <[string]>

docs/out/api/class-browsertype.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ A path where Playwright expects to find a bundled browser executable.
4646
- `args` <[Array]<[string]>> Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).
4747
- `chromiumSandbox` <[boolean]> Enable Chromium sandboxing. Defaults to `false`.
4848
- `devtools` <[boolean]> **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
49-
- `downloadsPath` <[string]> If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
49+
- `downloadsPath` <[path]> If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
5050
- `env` <[Object]<[string], [string]|[number]|[boolean]>> Specify environment variables that will be visible to the browser. Defaults to `process.env`.
51-
- `executablePath` <[string]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk.
51+
- `executablePath` <[path]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk.
5252
- `firefoxUserPrefs` <[Object]<[string], [string]|[number]|[boolean]>> Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).
5353
- `handleSIGHUP` <[boolean]> Close the browser process on SIGHUP. Defaults to `true`.
5454
- `handleSIGINT` <[boolean]> Close the browser process on Ctrl-C. Defaults to `true`.
@@ -84,7 +84,7 @@ const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.
8484
> See [`this article`](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for a description of the differences between Chromium and Chrome. [`This article`](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md) describes some differences for Linux users.
8585
8686
## browserType.launchPersistentContext(userDataDir[, options])
87-
- `userDataDir` <[string]> Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for [Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile).
87+
- `userDataDir` <[path]> Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for [Chromium](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) and [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile).
8888
- `options` <[Object]>
8989
- `acceptDownloads` <[boolean]> Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
9090
- `args` <[Array]<[string]>> Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).
@@ -93,9 +93,9 @@ const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.
9393
- `colorScheme` <"light"|"dark"|"no-preference"> Emulates `'prefers-colors-scheme'` media feature, supported values are `'light'`, `'dark'`, `'no-preference'`. See [page.emulateMedia(params)](api/class-page.md#pageemulatemediaparams) for more details. Defaults to '`light`'.
9494
- `deviceScaleFactor` <[number]> Specify device scale factor (can be thought of as dpr). Defaults to `1`.
9595
- `devtools` <[boolean]> **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
96-
- `downloadsPath` <[string]> If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
96+
- `downloadsPath` <[path]> If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
9797
- `env` <[Object]<[string], [string]|[number]|[boolean]>> Specify environment variables that will be visible to the browser. Defaults to `process.env`.
98-
- `executablePath` <[string]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk.
98+
- `executablePath` <[path]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk.
9999
- `extraHTTPHeaders` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings.
100100
- `geolocation` <[Object]>
101101
- `latitude` <[number]> Latitude between -90 and 90.
@@ -152,9 +152,9 @@ Launches browser that uses persistent storage located at `userDataDir` and retur
152152
- `args` <[Array]<[string]>> Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/).
153153
- `chromiumSandbox` <[boolean]> Enable Chromium sandboxing. Defaults to `true`.
154154
- `devtools` <[boolean]> **Chromium-only** Whether to auto-open a Developer Tools panel for each tab. If this option is `true`, the `headless` option will be set `false`.
155-
- `downloadsPath` <[string]> If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
155+
- `downloadsPath` <[path]> If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is deleted when browser is closed.
156156
- `env` <[Object]<[string], [string]|[number]|[boolean]>> Specify environment variables that will be visible to the browser. Defaults to `process.env`.
157-
- `executablePath` <[string]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk.
157+
- `executablePath` <[path]> Path to a browser executable to run instead of the bundled one. If `executablePath` is a relative path, then it is resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk.
158158
- `firefoxUserPrefs` <[Object]<[string], [string]|[number]|[boolean]>> Firefox user preferences. Learn more about the Firefox user preferences at [`about:config`](https://support.mozilla.org/en-US/kb/about-config-editor-firefox).
159159
- `handleSIGHUP` <[boolean]> Close the browser process on SIGHUP. Defaults to `true`.
160160
- `handleSIGINT` <[boolean]> Close the browser process on Ctrl-C. Defaults to `true`.

docs/out/api/class-chromiumbrowser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Returns the newly created browser session.
3434
- `page` <[Page]> Optional, if specified, tracing includes screenshots of the given page.
3535
- `options` <[Object]>
3636
- `categories` <[Array]<[string]>> specify custom categories to use instead of default.
37-
- `path` <[string]> A path to write the trace file to.
37+
- `path` <[path]> A path to write the trace file to.
3838
- `screenshots` <[boolean]> captures screenshots in the trace.
3939
- returns: <[Promise]>
4040

docs/out/api/class-chromiumbrowsercontext.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const backgroundPage = await context.waitForEvent('backgroundpage');
2626
- [browserContext.clearPermissions()](api/class-browsercontext.md#browsercontextclearpermissions)
2727
- [browserContext.close()](api/class-browsercontext.md#browsercontextclose)
2828
- [browserContext.cookies([urls])](api/class-browsercontext.md#browsercontextcookiesurls)
29-
- [browserContext.exposeBinding(name, playwrightBinding[, options])](api/class-browsercontext.md#browsercontextexposebindingname-playwrightbinding-options)
30-
- [browserContext.exposeFunction(name, playwrightFunction)](api/class-browsercontext.md#browsercontextexposefunctionname-playwrightfunction)
29+
- [browserContext.exposeBinding(name, callback[, options])](api/class-browsercontext.md#browsercontextexposebindingname-callback-options)
30+
- [browserContext.exposeFunction(name, callback)](api/class-browsercontext.md#browsercontextexposefunctionname-callback)
3131
- [browserContext.grantPermissions(permissions[, options])](api/class-browsercontext.md#browsercontextgrantpermissionspermissions-options)
3232
- [browserContext.newPage()](api/class-browsercontext.md#browsercontextnewpage)
3333
- [browserContext.pages()](api/class-browsercontext.md#browsercontextpages)

docs/out/api/class-download.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Returns download error if any.
5252
Returns path to the downloaded file in case of successful download.
5353

5454
## download.saveAs(path)
55-
- `path` <[string]> Path where the download should be saved.
55+
- `path` <[path]> Path where the download should be saved.
5656
- returns: <[Promise]>
5757

5858
Saves the download to a user-specified path.

docs/out/api/class-elementhandle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are supported a
323323
## elementHandle.screenshot([options])
324324
- `options` <[Object]>
325325
- `omitBackground` <[boolean]> Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`.
326-
- `path` <[string]> The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk.
326+
- `path` <[path]> The file path to save the image to. The screenshot type will be inferred from file extension. If `path` is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk.
327327
- `quality` <[number]> The quality of the image, between 0-100. Not applicable to `png` images.
328328
- `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(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
329329
- `type` <"png"|"jpeg"> Specify screenshot type, defaults to `png`.

0 commit comments

Comments
 (0)