doc: further align docs w/ playwright.dev (#4866)
This commit is contained in:
parent
e0e836cb6e
commit
ae935a43d9
|
@ -6,7 +6,7 @@ on:
|
||||||
- master
|
- master
|
||||||
- release-*
|
- release-*
|
||||||
paths:
|
paths:
|
||||||
- docs/docker/**
|
- utils/docker/**
|
||||||
- browsers.json
|
- browsers.json
|
||||||
- .github/workflows/publish_canary_docker.yml
|
- .github/workflows/publish_canary_docker.yml
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ jobs:
|
||||||
node-version: 10.15
|
node-version: 10.15
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: ./docs/docker/build.sh bionic playwright:localbuild-bionic
|
- run: ./utils/docker/build.sh bionic playwright:localbuild-bionic
|
||||||
- run: ./docs/docker/build.sh focal playwright:localbuild-focal
|
- run: ./utils/docker/build.sh focal playwright:localbuild-focal
|
||||||
- name: tag & publish
|
- name: tag & publish
|
||||||
run: |
|
run: |
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:next
|
./utils/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:next
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:next-bionic
|
./utils/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:next-bionic
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:sha-${{ github.sha }}
|
./utils/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:sha-${{ github.sha }}
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:next-focal
|
./utils/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:next-focal
|
||||||
|
|
||||||
|
|
|
@ -40,17 +40,17 @@ jobs:
|
||||||
node-version: 10.15
|
node-version: 10.15
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: ./docs/docker/build.sh bionic playwright:localbuild-bionic
|
- run: ./utils/docker/build.sh bionic playwright:localbuild-bionic
|
||||||
- run: ./docs/docker/build.sh focal playwright:localbuild-focal
|
- run: ./utils/docker/build.sh focal playwright:localbuild-focal
|
||||||
- name: tag & publish
|
- name: tag & publish
|
||||||
run: |
|
run: |
|
||||||
# GITHUB_REF has a form of `refs/tags/v1.3.0`.
|
# GITHUB_REF has a form of `refs/tags/v1.3.0`.
|
||||||
# TAG_NAME would be `v1.3.0`
|
# TAG_NAME would be `v1.3.0`
|
||||||
TAG_NAME=${GITHUB_REF#refs/tags/}
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:latest
|
./utils/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:latest
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:bionic
|
./utils/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:bionic
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:${TAG_NAME}
|
./utils/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:${TAG_NAME}
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:${TAG_NAME}-bionic
|
./utils/docker/tag_and_push.sh playwright:localbuild-bionic playwright.azurecr.io/public/playwright:${TAG_NAME}-bionic
|
||||||
|
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:focal
|
./utils/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:focal
|
||||||
./docs/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:${TAG_NAME}-focal
|
./utils/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:${TAG_NAME}-focal
|
||||||
|
|
|
@ -38,10 +38,10 @@ Playwright is a library to automate [Chromium](https://www.chromium.org/Home), [
|
||||||
- [Page object models](./pom.md)
|
- [Page object models](./pom.md)
|
||||||
1. Integrations
|
1. Integrations
|
||||||
- [Test runners](./test-runners.md)
|
- [Test runners](./test-runners.md)
|
||||||
- [Docker](./docker/README.md)
|
- [Docker](././docker.md)
|
||||||
- [Continuous integration](./ci.md)
|
- [Continuous integration](./ci.md)
|
||||||
1. Reference
|
1. Reference
|
||||||
- [API Reference](./api.md)
|
- [API Reference](./api/class-playwright.md)
|
||||||
- [Actionability](./actionability.md)
|
- [Actionability](./actionability.md)
|
||||||
- [Advanced installation](./installation.md)
|
- [Advanced installation](./installation.md)
|
||||||
- [Extensibility](./extensibility.md)
|
- [Extensibility](./extensibility.md)
|
||||||
|
@ -49,6 +49,7 @@ Playwright is a library to automate [Chromium](https://www.chromium.org/Home), [
|
||||||
- [Slack community](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg)
|
- [Slack community](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg)
|
||||||
- [Stack Overflow](https://stackoverflow.com/tags/playwright)
|
- [Stack Overflow](https://stackoverflow.com/tags/playwright)
|
||||||
- [GitHub](https://github.com/microsoft/playwright/issues)
|
- [GitHub](https://github.com/microsoft/playwright/issues)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -11,13 +11,13 @@ Some actions like `page.click()` support `{force: true}` option that disable non
|
||||||
|
|
||||||
| Actions | Performed checks |
|
| Actions | Performed checks |
|
||||||
| ------ | ------- |
|
| ------ | ------- |
|
||||||
| `check()`<br>`click()`<br>`dblclick()`<br>`tap()`<br>`uncheck()` | [Visible]<br>[Stable]<br>[Enabled]<br>[Receiving Events]<br>[Attached] |
|
| `check()`<br></br>`click()`<br></br>`dblclick()`<br></br>`tap()`<br></br>`uncheck()` | [Visible]<br></br>[Stable]<br></br>[Enabled]<br></br>[Receiving Events]<br></br>[Attached] |
|
||||||
| `hover()` | [Visible]<br>[Stable]<br>[Receiving Events]<br>[Attached] |
|
| `hover()` | [Visible]<br></br>[Stable]<br></br>[Receiving Events]<br></br>[Attached] |
|
||||||
| `fill()` | [Visible]<br>[Enabled]<br>[Editable]<br>[Attached] |
|
| `fill()` | [Visible]<br></br>[Enabled]<br></br>[Editable]<br></br>[Attached] |
|
||||||
| `dispatchEvent()`<br>`focus()`<br>`press()`<br>`setInputFiles()`<br>`selectOption()`<br>`type()` | [Attached] |
|
| `dispatchEvent()`<br></br>`focus()`<br></br>`press()`<br></br>`setInputFiles()`<br></br>`selectOption()`<br></br>`type()` | [Attached] |
|
||||||
| `scrollIntoViewIfNeeded()`<br>`screenshot()` | [Visible]<br>[Stable]<br>[Attached] |
|
| `scrollIntoViewIfNeeded()`<br></br>`screenshot()` | [Visible]<br></br>[Stable]<br></br>[Attached] |
|
||||||
| `selectText()` | [Visible]<br>[Attached] |
|
| `selectText()` | [Visible]<br></br>[Attached] |
|
||||||
| `getAttribute()`<br>`innerText()`<br>`innerHTML()`<br>`textContent()` | [Attached] |
|
| `getAttribute()`<br></br>`innerText()`<br></br>`innerHTML()`<br></br>`textContent()` | [Attached] |
|
||||||
|
|
||||||
### Visible
|
### Visible
|
||||||
|
|
||||||
|
@ -57,6 +57,7 @@ For example, consider a scenario where Playwright will click `Sign Up` button re
|
||||||
[Editable]: #editable "Editable"
|
[Editable]: #editable "Editable"
|
||||||
[Receiving Events]: #receiving-events "Receiving Events"
|
[Receiving Events]: #receiving-events "Receiving Events"
|
||||||
[Attached]: #attached "Attached"
|
[Attached]: #attached "Attached"
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-accessibility
|
id: class-accessibility
|
||||||
title: "class: Accessibility"
|
title: "Accessibility"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ Most of the accessibility tree gets filtered out when converting from Blink AX T
|
||||||
|
|
||||||
- [accessibility.snapshot([options])](api/class-accessibility.md#accessibilitysnapshotoptions)
|
- [accessibility.snapshot([options])](api/class-accessibility.md#accessibilitysnapshotoptions)
|
||||||
|
|
||||||
#### accessibility.snapshot([options])
|
## accessibility.snapshot([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `interestingOnly` <[boolean]> Prune uninteresting nodes from the tree. Defaults to `true`.
|
- `interestingOnly` <[boolean]> Prune uninteresting nodes from the tree. Defaults to `true`.
|
||||||
- `root` <[ElementHandle]> The root DOM element for the snapshot. Defaults to the whole page.
|
- `root` <[ElementHandle]> The root DOM element for the snapshot. Defaults to the whole page.
|
||||||
|
@ -76,6 +76,7 @@ function findFocusedNode(node) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-browser
|
id: class-browser
|
||||||
title: "class: Browser"
|
title: "Browser"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
||||||
|
@ -31,13 +31,13 @@ See [ChromiumBrowser], [FirefoxBrowser] and [WebKitBrowser] for browser-specific
|
||||||
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
||||||
- [browser.version()](api/class-browser.md#browserversion)
|
- [browser.version()](api/class-browser.md#browserversion)
|
||||||
|
|
||||||
#### browser.on('disconnected')
|
## browser.on('disconnected')
|
||||||
|
|
||||||
Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:
|
Emitted when Browser gets disconnected from the browser application. This might happen because of one of the following:
|
||||||
* Browser application is closed or crashed.
|
* Browser application is closed or crashed.
|
||||||
* The [browser.close()](api/class-browser.md#browserclose) method was called.
|
* The [browser.close()](api/class-browser.md#browserclose) method was called.
|
||||||
|
|
||||||
#### browser.close()
|
## browser.close()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
In case this browser is obtained using [browserType.launch([options])](api/class-browsertype.md#browsertypelaunchoptions), closes the browser and all of its pages (if any were opened).
|
In case this browser is obtained using [browserType.launch([options])](api/class-browsertype.md#browsertypelaunchoptions), closes the browser and all of its pages (if any were opened).
|
||||||
|
@ -46,7 +46,7 @@ In case this browser is obtained using [browserType.connect(params)](api/class-b
|
||||||
|
|
||||||
The [Browser] object itself is considered to be disposed and cannot be used anymore.
|
The [Browser] object itself is considered to be disposed and cannot be used anymore.
|
||||||
|
|
||||||
#### browser.contexts()
|
## browser.contexts()
|
||||||
- returns: <[Array]<[BrowserContext]>>
|
- returns: <[Array]<[BrowserContext]>>
|
||||||
|
|
||||||
Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.
|
Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.
|
||||||
|
@ -59,12 +59,12 @@ const context = await browser.newContext();
|
||||||
console.log(browser.contexts().length); // prints `1`
|
console.log(browser.contexts().length); // prints `1`
|
||||||
```
|
```
|
||||||
|
|
||||||
#### browser.isConnected()
|
## browser.isConnected()
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Indicates that the browser is connected.
|
Indicates that the browser is connected.
|
||||||
|
|
||||||
#### browser.newContext([options])
|
## browser.newContext([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `acceptDownloads` <[boolean]> Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
|
- `acceptDownloads` <[boolean]> Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
|
||||||
- `bypassCSP` <[boolean]> Toggles bypassing page's Content-Security-Policy.
|
- `bypassCSP` <[boolean]> Toggles bypassing page's Content-Security-Policy.
|
||||||
|
@ -139,7 +139,7 @@ Creates a new browser context. It won't share cookies/cache with other browser c
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### browser.newPage([options])
|
## browser.newPage([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `acceptDownloads` <[boolean]> Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
|
- `acceptDownloads` <[boolean]> Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
|
||||||
- `bypassCSP` <[boolean]> Toggles bypassing page's Content-Security-Policy.
|
- `bypassCSP` <[boolean]> Toggles bypassing page's Content-Security-Policy.
|
||||||
|
@ -205,10 +205,11 @@ Creates a new page in a new browser context. Closing this page will close the co
|
||||||
|
|
||||||
This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and testing frameworks should explicitly create [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions) followed by the [browserContext.newPage()](api/class-browsercontext.md#browsercontextnewpage) to control their exact life times.
|
This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and testing frameworks should explicitly create [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions) followed by the [browserContext.newPage()](api/class-browsercontext.md#browsercontextnewpage) to control their exact life times.
|
||||||
|
|
||||||
#### browser.version()
|
## browser.version()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Returns the browser version.
|
Returns the browser version.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-browsercontext
|
id: class-browsercontext
|
||||||
title: "class: BrowserContext"
|
title: "BrowserContext"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
||||||
|
@ -47,14 +47,14 @@ await context.close();
|
||||||
- [browserContext.unroute(url[, handler])](api/class-browsercontext.md#browsercontextunrouteurl-handler)
|
- [browserContext.unroute(url[, handler])](api/class-browsercontext.md#browsercontextunrouteurl-handler)
|
||||||
- [browserContext.waitForEvent(event[, optionsOrPredicate])](api/class-browsercontext.md#browsercontextwaitforeventevent-optionsorpredicate)
|
- [browserContext.waitForEvent(event[, optionsOrPredicate])](api/class-browsercontext.md#browsercontextwaitforeventevent-optionsorpredicate)
|
||||||
|
|
||||||
#### browserContext.on('close')
|
## browserContext.on('close')
|
||||||
|
|
||||||
Emitted when Browser context gets closed. This might happen because of one of the following:
|
Emitted when Browser context gets closed. This might happen because of one of the following:
|
||||||
* Browser context is closed.
|
* Browser context is closed.
|
||||||
* Browser application is closed or crashed.
|
* Browser application is closed or crashed.
|
||||||
* The [browser.close()](api/class-browser.md#browserclose) method was called.
|
* The [browser.close()](api/class-browser.md#browserclose) method was called.
|
||||||
|
|
||||||
#### browserContext.on('page')
|
## browserContext.on('page')
|
||||||
- type: <[Page]>
|
- type: <[Page]>
|
||||||
|
|
||||||
The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [page.on('popup')](api/class-page.md#pageonpopup) to receive events about popups relevant to a specific page.
|
The event is emitted when a new Page is created in the BrowserContext. The page may still be loading. The event will also fire for popup pages. See also [page.on('popup')](api/class-page.md#pageonpopup) to receive events about popups relevant to a specific page.
|
||||||
|
@ -71,7 +71,7 @@ console.log(await page.evaluate('location.href'));
|
||||||
|
|
||||||
> **NOTE** Use [page.waitForLoadState([state, options])](api/class-page.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).
|
> **NOTE** Use [page.waitForLoadState([state, options])](api/class-page.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).
|
||||||
|
|
||||||
#### browserContext.addCookies(cookies)
|
## browserContext.addCookies(cookies)
|
||||||
- `cookies` <[Array]<[Object]>>
|
- `cookies` <[Array]<[Object]>>
|
||||||
- `name` <[string]> **required**
|
- `name` <[string]> **required**
|
||||||
- `value` <[string]> **required**
|
- `value` <[string]> **required**
|
||||||
|
@ -90,7 +90,7 @@ Adds cookies into this browser context. All pages within this context will have
|
||||||
await browserContext.addCookies([cookieObject1, cookieObject2]);
|
await browserContext.addCookies([cookieObject1, cookieObject2]);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### browserContext.addInitScript(script[, arg])
|
## browserContext.addInitScript(script[, arg])
|
||||||
- `script` <[function]|[string]|[Object]> Script to be evaluated in all pages in the browser context.
|
- `script` <[function]|[string]|[Object]> Script to be evaluated in all pages in the browser context.
|
||||||
- `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
- `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
||||||
- `content` <[string]> Raw script content. Optional.
|
- `content` <[string]> Raw script content. Optional.
|
||||||
|
@ -119,17 +119,17 @@ await browserContext.addInitScript({
|
||||||
|
|
||||||
> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript(script[, arg])](api/class-browsercontext.md#browsercontextaddinitscriptscript-arg) and [page.addInitScript(script[, arg])](api/class-page.md#pageaddinitscriptscript-arg) is not defined.
|
> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript(script[, arg])](api/class-browsercontext.md#browsercontextaddinitscriptscript-arg) and [page.addInitScript(script[, arg])](api/class-page.md#pageaddinitscriptscript-arg) is not defined.
|
||||||
|
|
||||||
#### browserContext.browser()
|
## browserContext.browser()
|
||||||
- returns: <[null]|[Browser]>
|
- returns: <[null]|[Browser]>
|
||||||
|
|
||||||
Returns the browser instance of the context. If it was launched as a persistent context null gets returned.
|
Returns the browser instance of the context. If it was launched as a persistent context null gets returned.
|
||||||
|
|
||||||
#### browserContext.clearCookies()
|
## browserContext.clearCookies()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Clears context cookies.
|
Clears context cookies.
|
||||||
|
|
||||||
#### browserContext.clearPermissions()
|
## browserContext.clearPermissions()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Clears all permission overrides for the browser context.
|
Clears all permission overrides for the browser context.
|
||||||
|
@ -141,14 +141,14 @@ await context.grantPermissions(['clipboard-read']);
|
||||||
context.clearPermissions();
|
context.clearPermissions();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### browserContext.close()
|
## browserContext.close()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Closes the browser context. All the pages that belong to the browser context will be closed.
|
Closes the browser context. All the pages that belong to the browser context will be closed.
|
||||||
|
|
||||||
> **NOTE** the default browser context cannot be closed.
|
> **NOTE** the default browser context cannot be closed.
|
||||||
|
|
||||||
#### browserContext.cookies([urls])
|
## browserContext.cookies([urls])
|
||||||
- `urls` <[string]|[Array]<[string]>> Optional list of URLs.
|
- `urls` <[string]|[Array]<[string]>> Optional list of URLs.
|
||||||
- returns: <[Promise]<[Array]<[Object]>>>
|
- returns: <[Promise]<[Array]<[Object]>>>
|
||||||
- `name` <[string]>
|
- `name` <[string]>
|
||||||
|
@ -162,7 +162,7 @@ Closes the browser context. All the pages that belong to the browser context wil
|
||||||
|
|
||||||
If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned.
|
If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned.
|
||||||
|
|
||||||
#### browserContext.exposeBinding(name, playwrightBinding[, options])
|
## browserContext.exposeBinding(name, playwrightBinding[, options])
|
||||||
- `name` <[string]> Name of the function on the window object.
|
- `name` <[string]> Name of the function on the window object.
|
||||||
- `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context.
|
- `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -213,7 +213,7 @@ await page.setContent(`
|
||||||
`);
|
`);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### browserContext.exposeFunction(name, playwrightFunction)
|
## browserContext.exposeFunction(name, playwrightFunction)
|
||||||
- `name` <[string]> Name of the function on the window object.
|
- `name` <[string]> Name of the function on the window object.
|
||||||
- `playwrightFunction` <[function]> Callback function that will be called in the Playwright's context.
|
- `playwrightFunction` <[function]> Callback function that will be called in the Playwright's context.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
@ -248,7 +248,7 @@ const crypto = require('crypto');
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### browserContext.grantPermissions(permissions[, options])
|
## browserContext.grantPermissions(permissions[, options])
|
||||||
- `permissions` <[Array]<[string]>> A permission or an array of permissions to grant. Permissions can be one of the following values:
|
- `permissions` <[Array]<[string]>> A permission or an array of permissions to grant. Permissions can be one of the following values:
|
||||||
* `'geolocation'`
|
* `'geolocation'`
|
||||||
* `'midi'`
|
* `'midi'`
|
||||||
|
@ -272,17 +272,17 @@ const crypto = require('crypto');
|
||||||
|
|
||||||
Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if specified.
|
Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if specified.
|
||||||
|
|
||||||
#### browserContext.newPage()
|
## browserContext.newPage()
|
||||||
- returns: <[Promise]<[Page]>>
|
- returns: <[Promise]<[Page]>>
|
||||||
|
|
||||||
Creates a new page in the browser context.
|
Creates a new page in the browser context.
|
||||||
|
|
||||||
#### browserContext.pages()
|
## browserContext.pages()
|
||||||
- returns: <[Array]<[Page]>>
|
- returns: <[Array]<[Page]>>
|
||||||
|
|
||||||
Returns all open pages in the context. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using [chromiumBrowserContext.backgroundPages()](api/class-chromiumbrowsercontext.md#chromiumbrowsercontextbackgroundpages).
|
Returns all open pages in the context. Non visible pages, such as `"background_page"`, will not be listed here. You can find them using [chromiumBrowserContext.backgroundPages()](api/class-chromiumbrowsercontext.md#chromiumbrowsercontextbackgroundpages).
|
||||||
|
|
||||||
#### browserContext.route(url, handler)
|
## browserContext.route(url, handler)
|
||||||
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
|
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
|
||||||
- `handler` <[function]\([Route], [Request]\)> handler function to route the request.
|
- `handler` <[function]\([Route], [Request]\)> handler function to route the request.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
@ -313,7 +313,7 @@ Page routes (set up with [page.route(url, handler)](api/class-page.md#pagerouteu
|
||||||
|
|
||||||
> **NOTE** Enabling routing disables http cache.
|
> **NOTE** Enabling routing disables http cache.
|
||||||
|
|
||||||
#### browserContext.setDefaultNavigationTimeout(timeout)
|
## browserContext.setDefaultNavigationTimeout(timeout)
|
||||||
- `timeout` <[number]> Maximum navigation time in milliseconds
|
- `timeout` <[number]> Maximum navigation time in milliseconds
|
||||||
|
|
||||||
This setting will change the default maximum navigation time for the following methods and related shortcuts:
|
This setting will change the default maximum navigation time for the following methods and related shortcuts:
|
||||||
|
@ -326,14 +326,14 @@ This setting will change the default maximum navigation time for the following m
|
||||||
|
|
||||||
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) and [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) take priority over [browserContext.setDefaultNavigationTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout).
|
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) and [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) take priority over [browserContext.setDefaultNavigationTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout).
|
||||||
|
|
||||||
#### browserContext.setDefaultTimeout(timeout)
|
## browserContext.setDefaultTimeout(timeout)
|
||||||
- `timeout` <[number]> Maximum time in milliseconds
|
- `timeout` <[number]> Maximum time in milliseconds
|
||||||
|
|
||||||
This setting will change the default maximum time for all the methods accepting `timeout` option.
|
This setting will change the default maximum time for all the methods accepting `timeout` option.
|
||||||
|
|
||||||
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout), [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) and [browserContext.setDefaultNavigationTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout) take priority over [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout).
|
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout), [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) and [browserContext.setDefaultNavigationTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout) take priority over [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout).
|
||||||
|
|
||||||
#### browserContext.setExtraHTTPHeaders(headers)
|
## browserContext.setExtraHTTPHeaders(headers)
|
||||||
- `headers` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings.
|
- `headers` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ The extra HTTP headers will be sent with every request initiated by any page in
|
||||||
|
|
||||||
> **NOTE** `browserContext.setExtraHTTPHeaders` does not guarantee the order of headers in the outgoing requests.
|
> **NOTE** `browserContext.setExtraHTTPHeaders` does not guarantee the order of headers in the outgoing requests.
|
||||||
|
|
||||||
#### browserContext.setGeolocation(geolocation)
|
## browserContext.setGeolocation(geolocation)
|
||||||
- `geolocation` <[null]|[Object]>
|
- `geolocation` <[null]|[Object]>
|
||||||
- `latitude` <[number]> Latitude between -90 and 90. **required**
|
- `latitude` <[number]> Latitude between -90 and 90. **required**
|
||||||
- `longitude` <[number]> Longitude between -180 and 180. **required**
|
- `longitude` <[number]> Longitude between -180 and 180. **required**
|
||||||
|
@ -356,7 +356,7 @@ await browserContext.setGeolocation({latitude: 59.95, longitude: 30.31667});
|
||||||
|
|
||||||
> **NOTE** Consider using [browserContext.grantPermissions(permissions[, options])](api/class-browsercontext.md#browsercontextgrantpermissionspermissions-options) to grant permissions for the browser context pages to read its geolocation.
|
> **NOTE** Consider using [browserContext.grantPermissions(permissions[, options])](api/class-browsercontext.md#browsercontextgrantpermissionspermissions-options) to grant permissions for the browser context pages to read its geolocation.
|
||||||
|
|
||||||
#### browserContext.setHTTPCredentials(httpCredentials)
|
## browserContext.setHTTPCredentials(httpCredentials)
|
||||||
- `httpCredentials` <[null]|[Object]>
|
- `httpCredentials` <[null]|[Object]>
|
||||||
- `username` <[string]> **required**
|
- `username` <[string]> **required**
|
||||||
- `password` <[string]> **required**
|
- `password` <[string]> **required**
|
||||||
|
@ -366,11 +366,11 @@ Provide credentials for [HTTP authentication](https://developer.mozilla.org/en-U
|
||||||
|
|
||||||
> **NOTE** Browsers may cache credentials after successful authentication. Passing different credentials or passing `null` to disable authentication will be unreliable. To remove or replace credentials, create a new browser context instead.
|
> **NOTE** Browsers may cache credentials after successful authentication. Passing different credentials or passing `null` to disable authentication will be unreliable. To remove or replace credentials, create a new browser context instead.
|
||||||
|
|
||||||
#### browserContext.setOffline(offline)
|
## browserContext.setOffline(offline)
|
||||||
- `offline` <[boolean]> Whether to emulate network being offline for the browser context.
|
- `offline` <[boolean]> Whether to emulate network being offline for the browser context.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
#### browserContext.storageState([options])
|
## browserContext.storageState([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
- returns: <[Promise]<[Object]>>
|
- returns: <[Promise]<[Object]>>
|
||||||
|
@ -391,14 +391,14 @@ Provide credentials for [HTTP authentication](https://developer.mozilla.org/en-U
|
||||||
|
|
||||||
Returns storage state for this browser context, contains current cookies and local storage snapshot.
|
Returns storage state for this browser context, contains current cookies and local storage snapshot.
|
||||||
|
|
||||||
#### browserContext.unroute(url[, handler])
|
## browserContext.unroute(url[, handler])
|
||||||
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler).
|
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler).
|
||||||
- `handler` <[function]\([Route], [Request]\)> Optional handler function used to register a routing with [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler).
|
- `handler` <[function]\([Route], [Request]\)> Optional handler function used to register a routing with [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler).
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Removes a route created with [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler). When `handler` is not specified, removes all routes for the `url`.
|
Removes a route created with [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler). When `handler` is not specified, removes all routes for the `url`.
|
||||||
|
|
||||||
#### browserContext.waitForEvent(event[, optionsOrPredicate])
|
## browserContext.waitForEvent(event[, optionsOrPredicate])
|
||||||
- `event` <[string]> Event name, same one would pass into `browserContext.on(event)`.
|
- `event` <[string]> Event name, same one would pass into `browserContext.on(event)`.
|
||||||
- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.
|
- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.
|
||||||
- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.
|
- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.
|
||||||
|
@ -412,6 +412,7 @@ const context = await browser.newContext();
|
||||||
await context.grantPermissions(['geolocation']);
|
await context.grantPermissions(['geolocation']);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-browserserver
|
id: class-browserserver
|
||||||
title: "class: BrowserServer"
|
title: "BrowserServer"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,31 +11,32 @@ title: "class: BrowserServer"
|
||||||
- [browserServer.process()](api/class-browserserver.md#browserserverprocess)
|
- [browserServer.process()](api/class-browserserver.md#browserserverprocess)
|
||||||
- [browserServer.wsEndpoint()](api/class-browserserver.md#browserserverwsendpoint)
|
- [browserServer.wsEndpoint()](api/class-browserserver.md#browserserverwsendpoint)
|
||||||
|
|
||||||
#### browserServer.on('close')
|
## browserServer.on('close')
|
||||||
|
|
||||||
Emitted when the browser server closes.
|
Emitted when the browser server closes.
|
||||||
|
|
||||||
#### browserServer.close()
|
## browserServer.close()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Closes the browser gracefully and makes sure the process is terminated.
|
Closes the browser gracefully and makes sure the process is terminated.
|
||||||
|
|
||||||
#### browserServer.kill()
|
## browserServer.kill()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Kills the browser process and waits for the process to exit.
|
Kills the browser process and waits for the process to exit.
|
||||||
|
|
||||||
#### browserServer.process()
|
## browserServer.process()
|
||||||
- returns: <[ChildProcess]>
|
- returns: <[ChildProcess]>
|
||||||
|
|
||||||
Spawned browser application process.
|
Spawned browser application process.
|
||||||
|
|
||||||
#### browserServer.wsEndpoint()
|
## browserServer.wsEndpoint()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Browser websocket url.
|
Browser websocket url.
|
||||||
|
|
||||||
Browser websocket endpoint which can be used as an argument to [browserType.connect(params)](api/class-browsertype.md#browsertypeconnectparams) to establish connection to the browser.
|
Browser websocket endpoint which can be used as an argument to [browserType.connect(params)](api/class-browsertype.md#browsertypeconnectparams) to establish connection to the browser.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-browsertype
|
id: class-browsertype
|
||||||
title: "class: BrowserType"
|
title: "BrowserType"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
|
||||||
- [browserType.launchServer([options])](api/class-browsertype.md#browsertypelaunchserveroptions)
|
- [browserType.launchServer([options])](api/class-browsertype.md#browsertypelaunchserveroptions)
|
||||||
- [browserType.name()](api/class-browsertype.md#browsertypename)
|
- [browserType.name()](api/class-browsertype.md#browsertypename)
|
||||||
|
|
||||||
#### browserType.connect(params)
|
## browserType.connect(params)
|
||||||
- `params` <[Object]>
|
- `params` <[Object]>
|
||||||
- `wsEndpoint` <[string]> A browser websocket endpoint to connect to. **required**
|
- `wsEndpoint` <[string]> A browser websocket endpoint to connect to. **required**
|
||||||
- `slowMo` <[number]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.
|
- `slowMo` <[number]> Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. Defaults to 0.
|
||||||
|
@ -36,12 +36,12 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
|
||||||
|
|
||||||
This methods attaches Playwright to an existing browser instance.
|
This methods attaches Playwright to an existing browser instance.
|
||||||
|
|
||||||
#### browserType.executablePath()
|
## browserType.executablePath()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
A path where Playwright expects to find a bundled browser executable.
|
A path where Playwright expects to find a bundled browser executable.
|
||||||
|
|
||||||
#### browserType.launch([options])
|
## browserType.launch([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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/).
|
- `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/).
|
||||||
- `chromiumSandbox` <[boolean]> Enable Chromium sandboxing. Defaults to `false`.
|
- `chromiumSandbox` <[boolean]> Enable Chromium sandboxing. Defaults to `false`.
|
||||||
|
@ -83,7 +83,7 @@ const browser = await chromium.launch({ // Or 'firefox' or 'webkit'.
|
||||||
>
|
>
|
||||||
> 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.
|
> 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.
|
||||||
|
|
||||||
#### browserType.launchPersistentContext(userDataDir[, options])
|
## browserType.launchPersistentContext(userDataDir[, options])
|
||||||
- `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).
|
- `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).
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `acceptDownloads` <[boolean]> Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
|
- `acceptDownloads` <[boolean]> Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
|
||||||
|
@ -147,7 +147,7 @@ Returns the persistent browser context instance.
|
||||||
|
|
||||||
Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this context will automatically close the browser.
|
Launches browser that uses persistent storage located at `userDataDir` and returns the only context. Closing this context will automatically close the browser.
|
||||||
|
|
||||||
#### browserType.launchServer([options])
|
## browserType.launchServer([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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/).
|
- `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/).
|
||||||
- `chromiumSandbox` <[boolean]> Enable Chromium sandboxing. Defaults to `true`.
|
- `chromiumSandbox` <[boolean]> Enable Chromium sandboxing. Defaults to `true`.
|
||||||
|
@ -188,10 +188,11 @@ const { chromium } = require('playwright'); // Or 'webkit' or 'firefox'.
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### browserType.name()
|
## browserType.name()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
Returns browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-cdpsession
|
id: class-cdpsession
|
||||||
title: "class: CDPSession"
|
title: "CDPSession"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
||||||
|
@ -28,15 +28,16 @@ await client.send('Animation.setPlaybackRate', {
|
||||||
- [cdpSession.detach()](api/class-cdpsession.md#cdpsessiondetach)
|
- [cdpSession.detach()](api/class-cdpsession.md#cdpsessiondetach)
|
||||||
- [cdpSession.send(method[, params])](api/class-cdpsession.md#cdpsessionsendmethod-params)
|
- [cdpSession.send(method[, params])](api/class-cdpsession.md#cdpsessionsendmethod-params)
|
||||||
|
|
||||||
#### cdpSession.detach()
|
## cdpSession.detach()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages.
|
Detaches the CDPSession from the target. Once detached, the CDPSession object won't emit any events and can't be used to send messages.
|
||||||
|
|
||||||
#### cdpSession.send(method[, params])
|
## cdpSession.send(method[, params])
|
||||||
- `method` <[string]> protocol method name
|
- `method` <[string]> protocol method name
|
||||||
- `params` <[Object]> Optional method parameters
|
- `params` <[Object]> Optional method parameters
|
||||||
- returns: <[Promise]<[Object]>>
|
- returns: <[Promise]<[Object]>>
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-chromiumbrowser
|
id: class-chromiumbrowser
|
||||||
title: "class: ChromiumBrowser"
|
title: "ChromiumBrowser"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [Browser]
|
* extends: [Browser]
|
||||||
|
@ -25,12 +25,12 @@ await browser.stopTracing();
|
||||||
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
||||||
- [browser.version()](api/class-browser.md#browserversion)
|
- [browser.version()](api/class-browser.md#browserversion)
|
||||||
|
|
||||||
#### chromiumBrowser.newBrowserCDPSession()
|
## chromiumBrowser.newBrowserCDPSession()
|
||||||
- returns: <[Promise]<[CDPSession]>>
|
- returns: <[Promise]<[CDPSession]>>
|
||||||
|
|
||||||
Returns the newly created browser session.
|
Returns the newly created browser session.
|
||||||
|
|
||||||
#### chromiumBrowser.startTracing([page, options])
|
## chromiumBrowser.startTracing([page, options])
|
||||||
- `page` <[Page]> Optional, if specified, tracing includes screenshots of the given page.
|
- `page` <[Page]> Optional, if specified, tracing includes screenshots of the given page.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `categories` <[Array]<[string]>> specify custom categories to use instead of default.
|
- `categories` <[Array]<[string]>> specify custom categories to use instead of default.
|
||||||
|
@ -40,10 +40,11 @@ Returns the newly created browser session.
|
||||||
|
|
||||||
Only one trace can be active at a time per browser.
|
Only one trace can be active at a time per browser.
|
||||||
|
|
||||||
#### chromiumBrowser.stopTracing()
|
## chromiumBrowser.stopTracing()
|
||||||
- returns: <[Promise]<[Buffer]>>
|
- returns: <[Promise]<[Buffer]>>
|
||||||
|
|
||||||
Returns the buffer with trace data.
|
Returns the buffer with trace data.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-chromiumbrowsercontext
|
id: class-chromiumbrowsercontext
|
||||||
title: "class: ChromiumBrowserContext"
|
title: "ChromiumBrowserContext"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [BrowserContext]
|
* extends: [BrowserContext]
|
||||||
|
@ -42,33 +42,34 @@ const backgroundPage = await context.waitForEvent('backgroundpage');
|
||||||
- [browserContext.unroute(url[, handler])](api/class-browsercontext.md#browsercontextunrouteurl-handler)
|
- [browserContext.unroute(url[, handler])](api/class-browsercontext.md#browsercontextunrouteurl-handler)
|
||||||
- [browserContext.waitForEvent(event[, optionsOrPredicate])](api/class-browsercontext.md#browsercontextwaitforeventevent-optionsorpredicate)
|
- [browserContext.waitForEvent(event[, optionsOrPredicate])](api/class-browsercontext.md#browsercontextwaitforeventevent-optionsorpredicate)
|
||||||
|
|
||||||
#### chromiumBrowserContext.on('backgroundpage')
|
## chromiumBrowserContext.on('backgroundpage')
|
||||||
- type: <[Page]>
|
- type: <[Page]>
|
||||||
|
|
||||||
Emitted when new background page is created in the context.
|
Emitted when new background page is created in the context.
|
||||||
|
|
||||||
> **NOTE** Only works with persistent context.
|
> **NOTE** Only works with persistent context.
|
||||||
|
|
||||||
#### chromiumBrowserContext.on('serviceworker')
|
## chromiumBrowserContext.on('serviceworker')
|
||||||
- type: <[Worker]>
|
- type: <[Worker]>
|
||||||
|
|
||||||
Emitted when new service worker is created in the context.
|
Emitted when new service worker is created in the context.
|
||||||
|
|
||||||
#### chromiumBrowserContext.backgroundPages()
|
## chromiumBrowserContext.backgroundPages()
|
||||||
- returns: <[Array]<[Page]>>
|
- returns: <[Array]<[Page]>>
|
||||||
|
|
||||||
All existing background pages in the context.
|
All existing background pages in the context.
|
||||||
|
|
||||||
#### chromiumBrowserContext.newCDPSession(page)
|
## chromiumBrowserContext.newCDPSession(page)
|
||||||
- `page` <[Page]> Page to create new session for.
|
- `page` <[Page]> Page to create new session for.
|
||||||
- returns: <[Promise]<[CDPSession]>>
|
- returns: <[Promise]<[CDPSession]>>
|
||||||
|
|
||||||
Returns the newly created session.
|
Returns the newly created session.
|
||||||
|
|
||||||
#### chromiumBrowserContext.serviceWorkers()
|
## chromiumBrowserContext.serviceWorkers()
|
||||||
- returns: <[Array]<[Worker]>>
|
- returns: <[Array]<[Worker]>>
|
||||||
|
|
||||||
All existing service workers in the context.
|
All existing service workers in the context.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-chromiumcoverage
|
id: class-chromiumcoverage
|
||||||
title: "class: ChromiumCoverage"
|
title: "ChromiumCoverage"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,14 +34,14 @@ const v8toIstanbul = require('v8-to-istanbul');
|
||||||
- [chromiumCoverage.stopCSSCoverage()](api/class-chromiumcoverage.md#chromiumcoveragestopcsscoverage)
|
- [chromiumCoverage.stopCSSCoverage()](api/class-chromiumcoverage.md#chromiumcoveragestopcsscoverage)
|
||||||
- [chromiumCoverage.stopJSCoverage()](api/class-chromiumcoverage.md#chromiumcoveragestopjscoverage)
|
- [chromiumCoverage.stopJSCoverage()](api/class-chromiumcoverage.md#chromiumcoveragestopjscoverage)
|
||||||
|
|
||||||
#### chromiumCoverage.startCSSCoverage([options])
|
## chromiumCoverage.startCSSCoverage([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`.
|
- `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Returns coverage is started
|
Returns coverage is started
|
||||||
|
|
||||||
#### chromiumCoverage.startJSCoverage([options])
|
## chromiumCoverage.startJSCoverage([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `reportAnonymousScripts` <[boolean]> Whether anonymous scripts generated by the page should be reported. Defaults to `false`.
|
- `reportAnonymousScripts` <[boolean]> Whether anonymous scripts generated by the page should be reported. Defaults to `false`.
|
||||||
- `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`.
|
- `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`.
|
||||||
|
@ -51,7 +51,7 @@ Returns coverage is started
|
||||||
|
|
||||||
> **NOTE** Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on the page using `eval` or `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous scripts will have `__playwright_evaluation_script__` as their URL.
|
> **NOTE** Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on the page using `eval` or `new Function`. If `reportAnonymousScripts` is set to `true`, anonymous scripts will have `__playwright_evaluation_script__` as their URL.
|
||||||
|
|
||||||
#### chromiumCoverage.stopCSSCoverage()
|
## chromiumCoverage.stopCSSCoverage()
|
||||||
- returns: <[Promise]<[Array]<[Object]>>>
|
- returns: <[Promise]<[Array]<[Object]>>>
|
||||||
- `url` <[string]> StyleSheet URL
|
- `url` <[string]> StyleSheet URL
|
||||||
- `text` <[string]> StyleSheet content, if available.
|
- `text` <[string]> StyleSheet content, if available.
|
||||||
|
@ -63,7 +63,7 @@ Returns the array of coverage reports for all stylesheets
|
||||||
|
|
||||||
> **NOTE** CSS Coverage doesn't include dynamically injected style tags without sourceURLs.
|
> **NOTE** CSS Coverage doesn't include dynamically injected style tags without sourceURLs.
|
||||||
|
|
||||||
#### chromiumCoverage.stopJSCoverage()
|
## chromiumCoverage.stopJSCoverage()
|
||||||
- returns: <[Promise]<[Array]<[Object]>>>
|
- returns: <[Promise]<[Array]<[Object]>>>
|
||||||
- `url` <[string]> Script URL
|
- `url` <[string]> Script URL
|
||||||
- `scriptId` <[string]> Script ID
|
- `scriptId` <[string]> Script ID
|
||||||
|
@ -79,6 +79,7 @@ Returns the array of coverage reports for all stylesheets
|
||||||
Returns the array of coverage reports for all scripts
|
Returns the array of coverage reports for all scripts
|
||||||
|
|
||||||
> **NOTE** JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported.
|
> **NOTE** JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-consolemessage
|
id: class-consolemessage
|
||||||
title: "class: ConsoleMessage"
|
title: "ConsoleMessage"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,22 +12,23 @@ title: "class: ConsoleMessage"
|
||||||
- [consoleMessage.text()](api/class-consolemessage.md#consolemessagetext)
|
- [consoleMessage.text()](api/class-consolemessage.md#consolemessagetext)
|
||||||
- [consoleMessage.type()](api/class-consolemessage.md#consolemessagetype)
|
- [consoleMessage.type()](api/class-consolemessage.md#consolemessagetype)
|
||||||
|
|
||||||
#### consoleMessage.args()
|
## consoleMessage.args()
|
||||||
- returns: <[Array]<[JSHandle]>>
|
- returns: <[Array]<[JSHandle]>>
|
||||||
|
|
||||||
#### consoleMessage.location()
|
## consoleMessage.location()
|
||||||
- returns: <[Object]>
|
- returns: <[Object]>
|
||||||
- `url` <[string]> URL of the resource.
|
- `url` <[string]> URL of the resource.
|
||||||
- `lineNumber` <[number]> 0-based line number in the resource.
|
- `lineNumber` <[number]> 0-based line number in the resource.
|
||||||
- `columnNumber` <[number]> 0-based column number in the resource.
|
- `columnNumber` <[number]> 0-based column number in the resource.
|
||||||
|
|
||||||
#### consoleMessage.text()
|
## consoleMessage.text()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
#### consoleMessage.type()
|
## consoleMessage.type()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.
|
One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-dialog
|
id: class-dialog
|
||||||
title: "class: Dialog"
|
title: "Dialog"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,31 +30,32 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
|
||||||
- [dialog.message()](api/class-dialog.md#dialogmessage)
|
- [dialog.message()](api/class-dialog.md#dialogmessage)
|
||||||
- [dialog.type()](api/class-dialog.md#dialogtype)
|
- [dialog.type()](api/class-dialog.md#dialogtype)
|
||||||
|
|
||||||
#### dialog.accept([promptText])
|
## dialog.accept([promptText])
|
||||||
- `promptText` <[string]> A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional.
|
- `promptText` <[string]> A text to enter in prompt. Does not cause any effects if the dialog's `type` is not prompt. Optional.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Returns when the dialog has been accepted.
|
Returns when the dialog has been accepted.
|
||||||
|
|
||||||
#### dialog.defaultValue()
|
## dialog.defaultValue()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
|
If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
|
||||||
|
|
||||||
#### dialog.dismiss()
|
## dialog.dismiss()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Returns when the dialog has been dismissed.
|
Returns when the dialog has been dismissed.
|
||||||
|
|
||||||
#### dialog.message()
|
## dialog.message()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
A message displayed in the dialog.
|
A message displayed in the dialog.
|
||||||
|
|
||||||
#### dialog.type()
|
## dialog.type()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.
|
Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-download
|
id: class-download
|
||||||
title: "class: Download"
|
title: "Download"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,41 +31,42 @@ const path = await download.path();
|
||||||
- [download.suggestedFilename()](api/class-download.md#downloadsuggestedfilename)
|
- [download.suggestedFilename()](api/class-download.md#downloadsuggestedfilename)
|
||||||
- [download.url()](api/class-download.md#downloadurl)
|
- [download.url()](api/class-download.md#downloadurl)
|
||||||
|
|
||||||
#### download.createReadStream()
|
## download.createReadStream()
|
||||||
- returns: <[Promise]<[null]|[Readable]>>
|
- returns: <[Promise]<[null]|[Readable]>>
|
||||||
|
|
||||||
Returns readable stream for current download or `null` if download failed.
|
Returns readable stream for current download or `null` if download failed.
|
||||||
|
|
||||||
#### download.delete()
|
## download.delete()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Deletes the downloaded file.
|
Deletes the downloaded file.
|
||||||
|
|
||||||
#### download.failure()
|
## download.failure()
|
||||||
- returns: <[Promise]<[null]|[string]>>
|
- returns: <[Promise]<[null]|[string]>>
|
||||||
|
|
||||||
Returns download error if any.
|
Returns download error if any.
|
||||||
|
|
||||||
#### download.path()
|
## download.path()
|
||||||
- returns: <[Promise]<[null]|[string]>>
|
- returns: <[Promise]<[null]|[string]>>
|
||||||
|
|
||||||
Returns path to the downloaded file in case of successful download.
|
Returns path to the downloaded file in case of successful download.
|
||||||
|
|
||||||
#### download.saveAs(path)
|
## download.saveAs(path)
|
||||||
- `path` <[string]> Path where the download should be saved.
|
- `path` <[string]> Path where the download should be saved.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Saves the download to a user-specified path.
|
Saves the download to a user-specified path.
|
||||||
|
|
||||||
#### download.suggestedFilename()
|
## download.suggestedFilename()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Returns suggested filename for this download. It is typically computed by the browser from the [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different browsers can use different logic for computing it.
|
Returns suggested filename for this download. It is typically computed by the browser from the [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different browsers can use different logic for computing it.
|
||||||
|
|
||||||
#### download.url()
|
## download.url()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Returns downloaded url.
|
Returns downloaded url.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-elementhandle
|
id: class-elementhandle
|
||||||
title: "class: ElementHandle"
|
title: "ElementHandle"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [JSHandle]
|
* extends: [JSHandle]
|
||||||
|
@ -62,19 +62,19 @@ ElementHandle instances can be used as an argument in [page.$eval(selector, page
|
||||||
- [jsHandle.getProperty(propertyName)](api/class-jshandle.md#jshandlegetpropertypropertyname)
|
- [jsHandle.getProperty(propertyName)](api/class-jshandle.md#jshandlegetpropertypropertyname)
|
||||||
- [jsHandle.jsonValue()](api/class-jshandle.md#jshandlejsonvalue)
|
- [jsHandle.jsonValue()](api/class-jshandle.md#jshandlejsonvalue)
|
||||||
|
|
||||||
#### elementHandle.$(selector)
|
## elementHandle.$(selector)
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- returns: <[Promise]<[null]|[ElementHandle]>>
|
- returns: <[Promise]<[null]|[ElementHandle]>>
|
||||||
|
|
||||||
The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns `null`.
|
The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns `null`.
|
||||||
|
|
||||||
#### elementHandle.$$(selector)
|
## elementHandle.$$(selector)
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- returns: <[Promise]<[Array]<[ElementHandle]>>>
|
- returns: <[Promise]<[Array]<[ElementHandle]>>>
|
||||||
|
|
||||||
The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns empty array.
|
The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns empty array.
|
||||||
|
|
||||||
#### elementHandle.$eval(selector, pageFunction[, arg])
|
## elementHandle.$eval(selector, pageFunction[, arg])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
|
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
|
@ -94,7 +94,7 @@ expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');
|
||||||
expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
|
expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### elementHandle.$$eval(selector, pageFunction[, arg])
|
## elementHandle.$$eval(selector, pageFunction[, arg])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context
|
- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
|
@ -120,7 +120,7 @@ const feedHandle = await page.$('.feed');
|
||||||
expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);
|
expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### elementHandle.boundingBox()
|
## elementHandle.boundingBox()
|
||||||
- returns: <[Promise]<[null]|[Object]>>
|
- returns: <[Promise]<[null]|[Object]>>
|
||||||
- `x` <[number]> the x coordinate of the element in pixels.
|
- `x` <[number]> the x coordinate of the element in pixels.
|
||||||
- `y` <[number]> the y coordinate of the element in pixels.
|
- `y` <[number]> the y coordinate of the element in pixels.
|
||||||
|
@ -140,7 +140,7 @@ const box = await elementHandle.boundingBox();
|
||||||
await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
|
await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### elementHandle.check([options])
|
## elementHandle.check([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
- `noWaitAfter` <[boolean]> 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`.
|
- `noWaitAfter` <[boolean]> 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`.
|
||||||
|
@ -159,7 +159,7 @@ If the element is detached from the DOM at any moment during the action, this me
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### elementHandle.click([options])
|
## elementHandle.click([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
- `clickCount` <[number]> defaults to 1. See [UIEvent.detail].
|
- `clickCount` <[number]> defaults to 1. See [UIEvent.detail].
|
||||||
|
@ -183,12 +183,12 @@ If the element is detached from the DOM at any moment during the action, this me
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### elementHandle.contentFrame()
|
## elementHandle.contentFrame()
|
||||||
- returns: <[Promise]<[null]|[Frame]>>
|
- returns: <[Promise]<[null]|[Frame]>>
|
||||||
|
|
||||||
Returns the content frame for element handles referencing iframe nodes, or `null` otherwise
|
Returns the content frame for element handles referencing iframe nodes, or `null` otherwise
|
||||||
|
|
||||||
#### elementHandle.dblclick([options])
|
## elementHandle.dblclick([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
- `delay` <[number]> Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
|
- `delay` <[number]> Time to wait between `mousedown` and `mouseup` in milliseconds. Defaults to 0.
|
||||||
|
@ -213,7 +213,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
> **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.
|
> **NOTE** `elementHandle.dblclick()` dispatches two `click` events and a single `dblclick` event.
|
||||||
|
|
||||||
#### elementHandle.dispatchEvent(type[, eventInit])
|
## elementHandle.dispatchEvent(type[, eventInit])
|
||||||
- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.
|
- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.
|
||||||
- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.
|
- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
@ -243,7 +243,7 @@ const dataTransfer = await page.evaluateHandle(() => new DataTransfer());
|
||||||
await elementHandle.dispatchEvent('dragstart', { dataTransfer });
|
await elementHandle.dispatchEvent('dragstart', { dataTransfer });
|
||||||
```
|
```
|
||||||
|
|
||||||
#### elementHandle.fill(value[, options])
|
## elementHandle.fill(value[, options])
|
||||||
- `value` <[string]> Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
- `value` <[string]> Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `noWaitAfter` <[boolean]> 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`.
|
- `noWaitAfter` <[boolean]> 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`.
|
||||||
|
@ -252,18 +252,18 @@ await elementHandle.dispatchEvent('dragstart', { dataTransfer });
|
||||||
|
|
||||||
This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. If the element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.
|
This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. If the element is not an `<input>`, `<textarea>` or `[contenteditable]` element, this method throws an error. Note that you can pass an empty string to clear the input field.
|
||||||
|
|
||||||
#### elementHandle.focus()
|
## elementHandle.focus()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
||||||
|
|
||||||
#### elementHandle.getAttribute(name)
|
## elementHandle.getAttribute(name)
|
||||||
- `name` <[string]> Attribute name to get the value for.
|
- `name` <[string]> Attribute name to get the value for.
|
||||||
- returns: <[Promise]<[null]|[string]>>
|
- returns: <[Promise]<[null]|[string]>>
|
||||||
|
|
||||||
Returns element attribute value.
|
Returns element attribute value.
|
||||||
|
|
||||||
#### elementHandle.hover([options])
|
## elementHandle.hover([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
||||||
|
@ -283,22 +283,22 @@ If the element is detached from the DOM at any moment during the action, this me
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### elementHandle.innerHTML()
|
## elementHandle.innerHTML()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Returns the `element.innerHTML`.
|
Returns the `element.innerHTML`.
|
||||||
|
|
||||||
#### elementHandle.innerText()
|
## elementHandle.innerText()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Returns the `element.innerText`.
|
Returns the `element.innerText`.
|
||||||
|
|
||||||
#### elementHandle.ownerFrame()
|
## elementHandle.ownerFrame()
|
||||||
- returns: <[Promise]<[null]|[Frame]>>
|
- returns: <[Promise]<[null]|[Frame]>>
|
||||||
|
|
||||||
Returns the frame containing the given element.
|
Returns the frame containing the given element.
|
||||||
|
|
||||||
#### elementHandle.press(key[, options])
|
## elementHandle.press(key[, options])
|
||||||
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `delay` <[number]> Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
|
- `delay` <[number]> Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
|
||||||
|
@ -320,7 +320,7 @@ If `key` is a single character, it is case-sensitive, so the values `a` and `A`
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
#### elementHandle.screenshot([options])
|
## elementHandle.screenshot([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `omitBackground` <[boolean]> Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`.
|
- `omitBackground` <[boolean]> Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images. Defaults to `false`.
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -333,7 +333,7 @@ Returns the buffer with the captured screenshot.
|
||||||
|
|
||||||
This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
|
This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
|
||||||
|
|
||||||
#### elementHandle.scrollIntoViewIfNeeded([options])
|
## elementHandle.scrollIntoViewIfNeeded([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
@ -342,7 +342,7 @@ This method waits for [actionability](./actionability.md) checks, then tries to
|
||||||
|
|
||||||
Throws when `elementHandle` does not point to an element [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
|
Throws when `elementHandle` does not point to an element [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
|
||||||
|
|
||||||
#### elementHandle.selectOption(values[, options])
|
## elementHandle.selectOption(values[, options])
|
||||||
- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
||||||
- `value` <[string]> Matches by `option.value`. Optional.
|
- `value` <[string]> Matches by `option.value`. Optional.
|
||||||
- `label` <[string]> Matches by `option.label`. Optional.
|
- `label` <[string]> Matches by `option.label`. Optional.
|
||||||
|
@ -370,14 +370,14 @@ handle.selectOption('red', 'green', 'blue');
|
||||||
handle.selectOption({ value: 'blue' }, { index: 2 }, 'red');
|
handle.selectOption({ value: 'blue' }, { index: 2 }, 'red');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### elementHandle.selectText([options])
|
## elementHandle.selectText([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text content.
|
This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text content.
|
||||||
|
|
||||||
#### elementHandle.setInputFiles(files[, options])
|
## elementHandle.setInputFiles(files[, options])
|
||||||
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
||||||
- `name` <[string]> [File] name **required**
|
- `name` <[string]> [File] name **required**
|
||||||
- `mimeType` <[string]> [File] type **required**
|
- `mimeType` <[string]> [File] type **required**
|
||||||
|
@ -391,7 +391,7 @@ This method expects `elementHandle` to point to an [input element](https://devel
|
||||||
|
|
||||||
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
||||||
|
|
||||||
#### elementHandle.tap([options])
|
## elementHandle.tap([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
- `modifiers` <[Array]<"Alt"|"Control"|"Meta"|"Shift">> Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current modifiers back. If not specified, currently pressed modifiers are used.
|
||||||
|
@ -414,12 +414,12 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
> **NOTE** `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.
|
> **NOTE** `elementHandle.tap()` requires that the `hasTouch` option of the browser context be set to true.
|
||||||
|
|
||||||
#### elementHandle.textContent()
|
## elementHandle.textContent()
|
||||||
- returns: <[Promise]<[null]|[string]>>
|
- returns: <[Promise]<[null]|[string]>>
|
||||||
|
|
||||||
Returns the `node.textContent`.
|
Returns the `node.textContent`.
|
||||||
|
|
||||||
#### elementHandle.type(text[, options])
|
## elementHandle.type(text[, options])
|
||||||
- `text` <[string]> A text to type into a focused element.
|
- `text` <[string]> A text to type into a focused element.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.
|
- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.
|
||||||
|
@ -444,7 +444,7 @@ await elementHandle.type('some text');
|
||||||
await elementHandle.press('Enter');
|
await elementHandle.press('Enter');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### elementHandle.uncheck([options])
|
## elementHandle.uncheck([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
- `noWaitAfter` <[boolean]> 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`.
|
- `noWaitAfter` <[boolean]> 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`.
|
||||||
|
@ -463,7 +463,7 @@ If the element is detached from the DOM at any moment during the action, this me
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### elementHandle.waitForElementState(state[, options])
|
## elementHandle.waitForElementState(state[, options])
|
||||||
- `state` <"visible"|"hidden"|"stable"|"enabled"|"disabled"> A state to wait for, see below for more details.
|
- `state` <"visible"|"hidden"|"stable"|"enabled"|"disabled"> A state to wait for, see below for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -480,7 +480,7 @@ Depending on the `state` parameter, this method waits for one of the [actionabil
|
||||||
|
|
||||||
If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.
|
If the element does not satisfy the condition for the `timeout` milliseconds, this method will throw.
|
||||||
|
|
||||||
#### elementHandle.waitForSelector(selector[, options])
|
## elementHandle.waitForSelector(selector[, options])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:
|
- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:
|
||||||
|
@ -503,6 +503,7 @@ const span = await div.waitForSelector('span', { state: 'attached' });
|
||||||
```
|
```
|
||||||
|
|
||||||
> **NOTE** This method does not work across navigations, use [page.waitForSelector(selector[, options])](api/class-page.md#pagewaitforselectorselector-options) instead.
|
> **NOTE** This method does not work across navigations, use [page.waitForSelector(selector[, options])](api/class-page.md#pagewaitforselectorselector-options) instead.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-filechooser
|
id: class-filechooser
|
||||||
title: "class: FileChooser"
|
title: "FileChooser"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,22 +18,22 @@ page.on('filechooser', async (fileChooser) => {
|
||||||
- [fileChooser.page()](api/class-filechooser.md#filechooserpage)
|
- [fileChooser.page()](api/class-filechooser.md#filechooserpage)
|
||||||
- [fileChooser.setFiles(files[, options])](api/class-filechooser.md#filechoosersetfilesfiles-options)
|
- [fileChooser.setFiles(files[, options])](api/class-filechooser.md#filechoosersetfilesfiles-options)
|
||||||
|
|
||||||
#### fileChooser.element()
|
## fileChooser.element()
|
||||||
- returns: <[ElementHandle]>
|
- returns: <[ElementHandle]>
|
||||||
|
|
||||||
Returns input element associated with this file chooser.
|
Returns input element associated with this file chooser.
|
||||||
|
|
||||||
#### fileChooser.isMultiple()
|
## fileChooser.isMultiple()
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Returns whether this file chooser accepts multiple files.
|
Returns whether this file chooser accepts multiple files.
|
||||||
|
|
||||||
#### fileChooser.page()
|
## fileChooser.page()
|
||||||
- returns: <[Page]>
|
- returns: <[Page]>
|
||||||
|
|
||||||
Returns page this file chooser belongs to.
|
Returns page this file chooser belongs to.
|
||||||
|
|
||||||
#### fileChooser.setFiles(files[, options])
|
## fileChooser.setFiles(files[, options])
|
||||||
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
||||||
- `name` <[string]> [File] name **required**
|
- `name` <[string]> [File] name **required**
|
||||||
- `mimeType` <[string]> [File] type **required**
|
- `mimeType` <[string]> [File] type **required**
|
||||||
|
@ -44,6 +44,7 @@ Returns page this file chooser belongs to.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
Sets the value of the file input this chooser is associated with. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-firefoxbrowser
|
id: class-firefoxbrowser
|
||||||
title: "class: FirefoxBrowser"
|
title: "FirefoxBrowser"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [Browser]
|
* extends: [Browser]
|
||||||
|
@ -15,6 +15,7 @@ Firefox browser instance does not expose Firefox-specific features.
|
||||||
- [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions)
|
- [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions)
|
||||||
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
||||||
- [browser.version()](api/class-browser.md#browserversion)
|
- [browser.version()](api/class-browser.md#browserversion)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-frame
|
id: class-frame
|
||||||
title: "class: Frame"
|
title: "Frame"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ console.log(text);
|
||||||
- [frame.waitForSelector(selector[, options])](api/class-frame.md#framewaitforselectorselector-options)
|
- [frame.waitForSelector(selector[, options])](api/class-frame.md#framewaitforselectorselector-options)
|
||||||
- [frame.waitForTimeout(timeout)](api/class-frame.md#framewaitfortimeouttimeout)
|
- [frame.waitForTimeout(timeout)](api/class-frame.md#framewaitfortimeouttimeout)
|
||||||
|
|
||||||
#### frame.$(selector)
|
## frame.$(selector)
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- returns: <[Promise]<[null]|[ElementHandle]>>
|
- returns: <[Promise]<[null]|[ElementHandle]>>
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ Returns the ElementHandle pointing to the frame element.
|
||||||
|
|
||||||
The method finds an element matching the specified selector within the frame. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns `null`.
|
The method finds an element matching the specified selector within the frame. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns `null`.
|
||||||
|
|
||||||
#### frame.$$(selector)
|
## frame.$$(selector)
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- returns: <[Promise]<[Array]<[ElementHandle]>>>
|
- returns: <[Promise]<[Array]<[ElementHandle]>>>
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ Returns the ElementHandles pointing to the frame elements.
|
||||||
|
|
||||||
The method finds all elements matching the specified selector within the frame. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns empty array.
|
The method finds all elements matching the specified selector within the frame. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector, returns empty array.
|
||||||
|
|
||||||
#### frame.$eval(selector, pageFunction[, arg])
|
## frame.$eval(selector, pageFunction[, arg])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
|
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
|
@ -119,7 +119,7 @@ const preloadHref = await frame.$eval('link[rel=preload]', el => el.href);
|
||||||
const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');
|
const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + suffix, 'hello');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.$$eval(selector, pageFunction[, arg])
|
## frame.$$eval(selector, pageFunction[, arg])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context
|
- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
|
@ -137,7 +137,7 @@ Examples:
|
||||||
const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);
|
const divsCounts = await frame.$$eval('div', (divs, min) => divs.length >= min, 10);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.addScriptTag(params)
|
## frame.addScriptTag(params)
|
||||||
- `params` <[Object]>
|
- `params` <[Object]>
|
||||||
- `url` <[string]> URL of a script to be added. Optional.
|
- `url` <[string]> URL of a script to be added. Optional.
|
||||||
- `path` <[string]> Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
- `path` <[string]> Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
||||||
|
@ -149,7 +149,7 @@ Returns the added tag when the script's onload fires or when the script content
|
||||||
|
|
||||||
Adds a `<script>` tag into the page with the desired url or content.
|
Adds a `<script>` tag into the page with the desired url or content.
|
||||||
|
|
||||||
#### frame.addStyleTag(params)
|
## frame.addStyleTag(params)
|
||||||
- `params` <[Object]>
|
- `params` <[Object]>
|
||||||
- `url` <[string]> URL of the `<link>` tag. Optional.
|
- `url` <[string]> URL of the `<link>` tag. Optional.
|
||||||
- `path` <[string]> Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
- `path` <[string]> Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
||||||
|
@ -160,7 +160,7 @@ Returns the added tag when the stylesheet's onload fires or when the CSS content
|
||||||
|
|
||||||
Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the content.
|
Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the content.
|
||||||
|
|
||||||
#### frame.check(selector[, options])
|
## frame.check(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -179,10 +179,10 @@ This method checks an element matching `selector` by performing the following st
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### frame.childFrames()
|
## frame.childFrames()
|
||||||
- returns: <[Array]<[Frame]>>
|
- returns: <[Array]<[Frame]>>
|
||||||
|
|
||||||
#### frame.click(selector[, options])
|
## frame.click(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
|
@ -206,12 +206,12 @@ This method clicks an element matching `selector` by performing the following st
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### frame.content()
|
## frame.content()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Gets the full HTML contents of the frame, including the doctype.
|
Gets the full HTML contents of the frame, including the doctype.
|
||||||
|
|
||||||
#### frame.dblclick(selector[, options])
|
## frame.dblclick(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
|
@ -236,7 +236,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
> **NOTE** `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.
|
> **NOTE** `frame.dblclick()` dispatches two `click` events and a single `dblclick` event.
|
||||||
|
|
||||||
#### frame.dispatchEvent(selector, type[, eventInit, options])
|
## frame.dispatchEvent(selector, type[, eventInit, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.
|
- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.
|
||||||
- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.
|
- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.
|
||||||
|
@ -269,7 +269,7 @@ const dataTransfer = await frame.evaluateHandle(() => new DataTransfer());
|
||||||
await frame.dispatchEvent('#source', 'dragstart', { dataTransfer });
|
await frame.dispatchEvent('#source', 'dragstart', { dataTransfer });
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.evaluate(pageFunction[, arg])
|
## frame.evaluate(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in browser context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[Serializable]>>
|
- returns: <[Promise]<[Serializable]>>
|
||||||
|
@ -301,7 +301,7 @@ const html = await frame.evaluate(([body, suffix]) => body.innerHTML + suffix, [
|
||||||
await bodyHandle.dispose();
|
await bodyHandle.dispose();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.evaluateHandle(pageFunction[, arg])
|
## frame.evaluateHandle(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[JSHandle]>>
|
- returns: <[Promise]<[JSHandle]>>
|
||||||
|
@ -332,7 +332,7 @@ console.log(await resultHandle.jsonValue());
|
||||||
await resultHandle.dispose();
|
await resultHandle.dispose();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.fill(selector, value[, options])
|
## frame.fill(selector, value[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -344,7 +344,7 @@ This method waits for an element matching `selector`, waits for [actionability](
|
||||||
|
|
||||||
To send fine-grained keyboard events, use [frame.type(selector, text[, options])](api/class-frame.md#frametypeselector-text-options).
|
To send fine-grained keyboard events, use [frame.type(selector, text[, options])](api/class-frame.md#frametypeselector-text-options).
|
||||||
|
|
||||||
#### frame.focus(selector[, options])
|
## frame.focus(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -352,7 +352,7 @@ To send fine-grained keyboard events, use [frame.type(selector, text[, options])
|
||||||
|
|
||||||
This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM.
|
This method fetches an element with `selector` and focuses it. If there's no element matching `selector`, the method waits until a matching element appears in the DOM.
|
||||||
|
|
||||||
#### frame.frameElement()
|
## frame.frameElement()
|
||||||
- returns: <[Promise]<[ElementHandle]>>
|
- returns: <[Promise]<[ElementHandle]>>
|
||||||
|
|
||||||
Returns the `frame` or `iframe` element handle which corresponds to this frame.
|
Returns the `frame` or `iframe` element handle which corresponds to this frame.
|
||||||
|
@ -367,7 +367,7 @@ const contentFrame = await frameElement.contentFrame();
|
||||||
console.log(frame === contentFrame); // -> true
|
console.log(frame === contentFrame); // -> true
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.getAttribute(selector, name[, options])
|
## frame.getAttribute(selector, name[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `name` <[string]> Attribute name to get the value for.
|
- `name` <[string]> Attribute name to get the value for.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -376,7 +376,7 @@ console.log(frame === contentFrame); // -> true
|
||||||
|
|
||||||
Returns element attribute value.
|
Returns element attribute value.
|
||||||
|
|
||||||
#### frame.goto(url[, options])
|
## frame.goto(url[, options])
|
||||||
- `url` <[string]> URL to navigate frame to. The url should include scheme, e.g. `https://`.
|
- `url` <[string]> URL to navigate frame to. The url should include scheme, e.g. `https://`.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders(headers)](api/class-page.md#pagesetextrahttpheadersheaders).
|
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders(headers)](api/class-page.md#pagesetextrahttpheadersheaders).
|
||||||
|
@ -401,7 +401,7 @@ Returns the main resource response. In case of multiple redirects, the navigatio
|
||||||
> **NOTE** `frame.goto` either throws an error or returns a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
|
> **NOTE** `frame.goto` either throws an error or returns a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`.
|
||||||
> **NOTE** Headless mode doesn't support navigation to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
|
> **NOTE** Headless mode doesn't support navigation to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
|
||||||
|
|
||||||
#### frame.hover(selector[, options])
|
## frame.hover(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -421,7 +421,7 @@ This method hovers over an element matching `selector` by performing the followi
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### frame.innerHTML(selector[, options])
|
## frame.innerHTML(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -429,7 +429,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Returns `element.innerHTML`.
|
Returns `element.innerHTML`.
|
||||||
|
|
||||||
#### frame.innerText(selector[, options])
|
## frame.innerText(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -437,12 +437,12 @@ Returns `element.innerHTML`.
|
||||||
|
|
||||||
Returns `element.innerText`.
|
Returns `element.innerText`.
|
||||||
|
|
||||||
#### frame.isDetached()
|
## frame.isDetached()
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Returns `true` if the frame has been detached, or `false` otherwise.
|
Returns `true` if the frame has been detached, or `false` otherwise.
|
||||||
|
|
||||||
#### frame.name()
|
## frame.name()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Returns frame's name attribute as specified in the tag.
|
Returns frame's name attribute as specified in the tag.
|
||||||
|
@ -451,17 +451,17 @@ If the name is empty, returns the id attribute instead.
|
||||||
|
|
||||||
> **NOTE** This value is calculated once when the frame is created, and will not update if the attribute is changed later.
|
> **NOTE** This value is calculated once when the frame is created, and will not update if the attribute is changed later.
|
||||||
|
|
||||||
#### frame.page()
|
## frame.page()
|
||||||
- returns: <[Page]>
|
- returns: <[Page]>
|
||||||
|
|
||||||
Returns the page containing this frame.
|
Returns the page containing this frame.
|
||||||
|
|
||||||
#### frame.parentFrame()
|
## frame.parentFrame()
|
||||||
- returns: <[null]|[Frame]>
|
- returns: <[null]|[Frame]>
|
||||||
|
|
||||||
Parent frame, if any. Detached frames and main frames return `null`.
|
Parent frame, if any. Detached frames and main frames return `null`.
|
||||||
|
|
||||||
#### frame.press(selector, key[, options])
|
## frame.press(selector, key[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -482,7 +482,7 @@ If `key` is a single character, it is case-sensitive, so the values `a` and `A`
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
#### frame.selectOption(selector, values[, options])
|
## frame.selectOption(selector, values[, options])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
||||||
- `value` <[string]> Matches by `option.value`. Optional.
|
- `value` <[string]> Matches by `option.value`. Optional.
|
||||||
|
@ -508,7 +508,7 @@ frame.selectOption('select#colors', { label: 'Blue' });
|
||||||
frame.selectOption('select#colors', 'red', 'green', 'blue');
|
frame.selectOption('select#colors', 'red', 'green', 'blue');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.setContent(html[, options])
|
## frame.setContent(html[, options])
|
||||||
- `html` <[string]> HTML markup to assign to the page.
|
- `html` <[string]> HTML markup to assign to the page.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
||||||
|
@ -518,7 +518,7 @@ frame.selectOption('select#colors', 'red', 'green', 'blue');
|
||||||
* `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
|
* `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
#### frame.setInputFiles(selector, files[, options])
|
## frame.setInputFiles(selector, files[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
||||||
- `name` <[string]> [File] name **required**
|
- `name` <[string]> [File] name **required**
|
||||||
|
@ -533,7 +533,7 @@ This method expects `selector` to point to an [input element](https://developer.
|
||||||
|
|
||||||
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
||||||
|
|
||||||
#### frame.tap(selector[, options])
|
## frame.tap(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -556,7 +556,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
> **NOTE** `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.
|
> **NOTE** `frame.tap()` requires that the `hasTouch` option of the browser context be set to true.
|
||||||
|
|
||||||
#### frame.textContent(selector[, options])
|
## frame.textContent(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -564,12 +564,12 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Returns `element.textContent`.
|
Returns `element.textContent`.
|
||||||
|
|
||||||
#### frame.title()
|
## frame.title()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Returns the page title.
|
Returns the page title.
|
||||||
|
|
||||||
#### frame.type(selector, text[, options])
|
## frame.type(selector, text[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `text` <[string]> A text to type into a focused element.
|
- `text` <[string]> A text to type into a focused element.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -587,7 +587,7 @@ await frame.type('#mytextarea', 'Hello'); // Types instantly
|
||||||
await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
|
await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.uncheck(selector[, options])
|
## frame.uncheck(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -606,12 +606,12 @@ This method checks an element matching `selector` by performing the following st
|
||||||
|
|
||||||
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
When all steps combined have not finished during the specified `timeout`, this method rejects with a [TimeoutError]. Passing zero timeout disables this.
|
||||||
|
|
||||||
#### frame.url()
|
## frame.url()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Returns frame's url.
|
Returns frame's url.
|
||||||
|
|
||||||
#### frame.waitForFunction(pageFunction[, arg, options])
|
## frame.waitForFunction(pageFunction[, arg, options])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in browser context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -643,7 +643,7 @@ const selector = '.foo';
|
||||||
await frame.waitForFunction(selector => !!document.querySelector(selector), selector);
|
await frame.waitForFunction(selector => !!document.querySelector(selector), selector);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.waitForLoadState([state, options])
|
## frame.waitForLoadState([state, options])
|
||||||
- `state` <"load"|"domcontentloaded"|"networkidle"> Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method returns immediately. Can be one of:
|
- `state` <"load"|"domcontentloaded"|"networkidle"> Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method returns immediately. Can be one of:
|
||||||
* `'load'` - wait for the `load` event to be fired.
|
* `'load'` - wait for the `load` event to be fired.
|
||||||
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
|
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
|
||||||
|
@ -661,7 +661,7 @@ await frame.click('button'); // Click triggers navigation.
|
||||||
await frame.waitForLoadState(); // Waits for 'load' state by default.
|
await frame.waitForLoadState(); // Waits for 'load' state by default.
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.waitForNavigation([options])
|
## frame.waitForNavigation([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
||||||
- `url` <[string]|[RegExp]|[Function]> URL string, URL regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
- `url` <[string]|[RegExp]|[Function]> URL string, URL regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
||||||
|
@ -684,7 +684,7 @@ const [response] = await Promise.all([
|
||||||
|
|
||||||
**NOTE** Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.
|
**NOTE** Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.
|
||||||
|
|
||||||
#### frame.waitForSelector(selector[, options])
|
## frame.waitForSelector(selector[, options])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:
|
- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:
|
||||||
|
@ -718,13 +718,14 @@ const { webkit } = require('playwright'); // Or 'chromium' or 'firefox'.
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### frame.waitForTimeout(timeout)
|
## frame.waitForTimeout(timeout)
|
||||||
- `timeout` <[number]> A timeout to wait for
|
- `timeout` <[number]> A timeout to wait for
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Waits for the given `timeout` in milliseconds.
|
Waits for the given `timeout` in milliseconds.
|
||||||
|
|
||||||
Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.
|
Note that `frame.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-jshandle
|
id: class-jshandle
|
||||||
title: "class: JSHandle"
|
title: "JSHandle"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,17 +24,17 @@ JSHandle instances can be used as an argument in [page.$eval(selector, pageFunct
|
||||||
- [jsHandle.getProperty(propertyName)](api/class-jshandle.md#jshandlegetpropertypropertyname)
|
- [jsHandle.getProperty(propertyName)](api/class-jshandle.md#jshandlegetpropertypropertyname)
|
||||||
- [jsHandle.jsonValue()](api/class-jshandle.md#jshandlejsonvalue)
|
- [jsHandle.jsonValue()](api/class-jshandle.md#jshandlejsonvalue)
|
||||||
|
|
||||||
#### jsHandle.asElement()
|
## jsHandle.asElement()
|
||||||
- returns: <[null]|[ElementHandle]>
|
- returns: <[null]|[ElementHandle]>
|
||||||
|
|
||||||
Returns either `null` or the object handle itself, if the object handle is an instance of [ElementHandle].
|
Returns either `null` or the object handle itself, if the object handle is an instance of [ElementHandle].
|
||||||
|
|
||||||
#### jsHandle.dispose()
|
## jsHandle.dispose()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
The `jsHandle.dispose` method stops referencing the element handle.
|
The `jsHandle.dispose` method stops referencing the element handle.
|
||||||
|
|
||||||
#### jsHandle.evaluate(pageFunction[, arg])
|
## jsHandle.evaluate(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]> Function to be evaluated in browser context
|
- `pageFunction` <[function]> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[Serializable]>>
|
- returns: <[Promise]<[Serializable]>>
|
||||||
|
@ -52,7 +52,7 @@ const tweetHandle = await page.$('.tweet .retweets');
|
||||||
expect(await tweetHandle.evaluate((node, suffix) => node.innerText, ' retweets')).toBe('10 retweets');
|
expect(await tweetHandle.evaluate((node, suffix) => node.innerText, ' retweets')).toBe('10 retweets');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### jsHandle.evaluateHandle(pageFunction[, arg])
|
## jsHandle.evaluateHandle(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated
|
- `pageFunction` <[function]|[string]> Function to be evaluated
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[JSHandle]>>
|
- returns: <[Promise]<[JSHandle]>>
|
||||||
|
@ -67,7 +67,7 @@ If the function passed to the `jsHandle.evaluateHandle` returns a [Promise], the
|
||||||
|
|
||||||
See [page.evaluateHandle(pageFunction[, arg])](api/class-page.md#pageevaluatehandlepagefunction-arg) for more details.
|
See [page.evaluateHandle(pageFunction[, arg])](api/class-page.md#pageevaluatehandlepagefunction-arg) for more details.
|
||||||
|
|
||||||
#### jsHandle.getProperties()
|
## jsHandle.getProperties()
|
||||||
- returns: <[Promise]<[Map]<[string], [JSHandle]>>>
|
- returns: <[Promise]<[Map]<[string], [JSHandle]>>>
|
||||||
|
|
||||||
The method returns a map with **own property names** as keys and JSHandle instances for the property values.
|
The method returns a map with **own property names** as keys and JSHandle instances for the property values.
|
||||||
|
@ -80,18 +80,19 @@ const documentHandle = properties.get('document');
|
||||||
await handle.dispose();
|
await handle.dispose();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### jsHandle.getProperty(propertyName)
|
## jsHandle.getProperty(propertyName)
|
||||||
- `propertyName` <[string]> property to get
|
- `propertyName` <[string]> property to get
|
||||||
- returns: <[Promise]<[JSHandle]>>
|
- returns: <[Promise]<[JSHandle]>>
|
||||||
|
|
||||||
Fetches a single property from the referenced object.
|
Fetches a single property from the referenced object.
|
||||||
|
|
||||||
#### jsHandle.jsonValue()
|
## jsHandle.jsonValue()
|
||||||
- returns: <[Promise]<[Serializable]>>
|
- returns: <[Promise]<[Serializable]>>
|
||||||
|
|
||||||
Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.
|
Returns a JSON representation of the object. If the object has a `toJSON` function, it **will not be called**.
|
||||||
|
|
||||||
> **NOTE** The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an error if the object has circular references.
|
> **NOTE** The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an error if the object has circular references.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-keyboard
|
id: class-keyboard
|
||||||
title: "class: Keyboard"
|
title: "Keyboard"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ await page.keyboard.press('Meta+A');
|
||||||
- [keyboard.type(text[, options])](api/class-keyboard.md#keyboardtypetext-options)
|
- [keyboard.type(text[, options])](api/class-keyboard.md#keyboardtypetext-options)
|
||||||
- [keyboard.up(key)](api/class-keyboard.md#keyboardupkey)
|
- [keyboard.up(key)](api/class-keyboard.md#keyboardupkey)
|
||||||
|
|
||||||
#### keyboard.down(key)
|
## keyboard.down(key)
|
||||||
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ After the key is pressed once, subsequent calls to [keyboard.down(key)](api/clas
|
||||||
|
|
||||||
> **NOTE** Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.
|
> **NOTE** Modifier keys DO influence `keyboard.down`. Holding down `Shift` will type the text in upper case.
|
||||||
|
|
||||||
#### keyboard.insertText(text)
|
## keyboard.insertText(text)
|
||||||
- `text` <[string]> Sets input to the specified text value.
|
- `text` <[string]> Sets input to the specified text value.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ page.keyboard.insertText('嗨');
|
||||||
|
|
||||||
> **NOTE** Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.
|
> **NOTE** Modifier keys DO NOT effect `keyboard.insertText`. Holding down `Shift` will not type the text in upper case.
|
||||||
|
|
||||||
#### keyboard.press(key[, options])
|
## keyboard.press(key[, options])
|
||||||
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `delay` <[number]> Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
|
- `delay` <[number]> Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
|
||||||
|
@ -113,7 +113,7 @@ await browser.close();
|
||||||
|
|
||||||
Shortcut for [keyboard.down(key)](api/class-keyboard.md#keyboarddownkey) and [keyboard.up(key)](api/class-keyboard.md#keyboardupkey).
|
Shortcut for [keyboard.down(key)](api/class-keyboard.md#keyboarddownkey) and [keyboard.up(key)](api/class-keyboard.md#keyboardupkey).
|
||||||
|
|
||||||
#### keyboard.type(text[, options])
|
## keyboard.type(text[, options])
|
||||||
- `text` <[string]> A text to type into a focused element.
|
- `text` <[string]> A text to type into a focused element.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.
|
- `delay` <[number]> Time to wait between key presses in milliseconds. Defaults to 0.
|
||||||
|
@ -130,11 +130,12 @@ await page.keyboard.type('World', {delay: 100}); // Types slower, like a user
|
||||||
|
|
||||||
> **NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
|
> **NOTE** Modifier keys DO NOT effect `keyboard.type`. Holding down `Shift` will not type the text in upper case.
|
||||||
|
|
||||||
#### keyboard.up(key)
|
## keyboard.up(key)
|
||||||
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Dispatches a `keyup` event.
|
Dispatches a `keyup` event.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-logger
|
id: class-logger
|
||||||
title: "class: Logger"
|
title: "Logger"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,20 +24,21 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
|
||||||
- [logger.isEnabled(name, severity)](api/class-logger.md#loggerisenabledname-severity)
|
- [logger.isEnabled(name, severity)](api/class-logger.md#loggerisenabledname-severity)
|
||||||
- [logger.log(name, severity, message, args, hints)](api/class-logger.md#loggerlogname-severity-message-args-hints)
|
- [logger.log(name, severity, message, args, hints)](api/class-logger.md#loggerlogname-severity-message-args-hints)
|
||||||
|
|
||||||
#### logger.isEnabled(name, severity)
|
## logger.isEnabled(name, severity)
|
||||||
- `name` <[string]> logger name
|
- `name` <[string]> logger name
|
||||||
- `severity` <"verbose"|"info"|"warning"|"error">
|
- `severity` <"verbose"|"info"|"warning"|"error">
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Determines whether sink is interested in the logger with the given name and severity.
|
Determines whether sink is interested in the logger with the given name and severity.
|
||||||
|
|
||||||
#### logger.log(name, severity, message, args, hints)
|
## logger.log(name, severity, message, args, hints)
|
||||||
- `name` <[string]> logger name
|
- `name` <[string]> logger name
|
||||||
- `severity` <"verbose"|"info"|"warning"|"error">
|
- `severity` <"verbose"|"info"|"warning"|"error">
|
||||||
- `message` <[string]|[Error]> log message format
|
- `message` <[string]|[Error]> log message format
|
||||||
- `args` <[Array]<[Object]>> message arguments
|
- `args` <[Array]<[Object]>> message arguments
|
||||||
- `hints` <[Object]> optional formatting hints
|
- `hints` <[Object]> optional formatting hints
|
||||||
- `color` <[string]> Optional preferred logger color.
|
- `color` <[string]> Optional preferred logger color.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-mouse
|
id: class-mouse
|
||||||
title: "class: Mouse"
|
title: "Mouse"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ await page.mouse.up();
|
||||||
- [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-options)
|
- [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-options)
|
||||||
- [mouse.up([options])](api/class-mouse.md#mouseupoptions)
|
- [mouse.up([options])](api/class-mouse.md#mouseupoptions)
|
||||||
|
|
||||||
#### mouse.click(x, y[, options])
|
## mouse.click(x, y[, options])
|
||||||
- `x` <[number]>
|
- `x` <[number]>
|
||||||
- `y` <[number]>
|
- `y` <[number]>
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -37,7 +37,7 @@ await page.mouse.up();
|
||||||
|
|
||||||
Shortcut for [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-options), [mouse.down([options])](api/class-mouse.md#mousedownoptions), [mouse.up([options])](api/class-mouse.md#mouseupoptions).
|
Shortcut for [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-options), [mouse.down([options])](api/class-mouse.md#mousedownoptions), [mouse.up([options])](api/class-mouse.md#mouseupoptions).
|
||||||
|
|
||||||
#### mouse.dblclick(x, y[, options])
|
## mouse.dblclick(x, y[, options])
|
||||||
- `x` <[number]>
|
- `x` <[number]>
|
||||||
- `y` <[number]>
|
- `y` <[number]>
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -47,7 +47,7 @@ Shortcut for [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-optio
|
||||||
|
|
||||||
Shortcut for [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-options), [mouse.down([options])](api/class-mouse.md#mousedownoptions), [mouse.up([options])](api/class-mouse.md#mouseupoptions), [mouse.down([options])](api/class-mouse.md#mousedownoptions) and [mouse.up([options])](api/class-mouse.md#mouseupoptions).
|
Shortcut for [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-options), [mouse.down([options])](api/class-mouse.md#mousedownoptions), [mouse.up([options])](api/class-mouse.md#mouseupoptions), [mouse.down([options])](api/class-mouse.md#mousedownoptions) and [mouse.up([options])](api/class-mouse.md#mouseupoptions).
|
||||||
|
|
||||||
#### mouse.down([options])
|
## mouse.down([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
- `clickCount` <[number]> defaults to 1. See [UIEvent.detail].
|
- `clickCount` <[number]> defaults to 1. See [UIEvent.detail].
|
||||||
|
@ -55,7 +55,7 @@ Shortcut for [mouse.move(x, y[, options])](api/class-mouse.md#mousemovex-y-optio
|
||||||
|
|
||||||
Dispatches a `mousedown` event.
|
Dispatches a `mousedown` event.
|
||||||
|
|
||||||
#### mouse.move(x, y[, options])
|
## mouse.move(x, y[, options])
|
||||||
- `x` <[number]>
|
- `x` <[number]>
|
||||||
- `y` <[number]>
|
- `y` <[number]>
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -64,13 +64,14 @@ Dispatches a `mousedown` event.
|
||||||
|
|
||||||
Dispatches a `mousemove` event.
|
Dispatches a `mousemove` event.
|
||||||
|
|
||||||
#### mouse.up([options])
|
## mouse.up([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
- `clickCount` <[number]> defaults to 1. See [UIEvent.detail].
|
- `clickCount` <[number]> defaults to 1. See [UIEvent.detail].
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Dispatches a `mouseup` event.
|
Dispatches a `mouseup` event.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-page
|
id: class-page
|
||||||
title: "class: Page"
|
title: "Page"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
* extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
|
||||||
|
@ -131,11 +131,11 @@ page.removeListener('request', logRequest);
|
||||||
- [page.waitForTimeout(timeout)](api/class-page.md#pagewaitfortimeouttimeout)
|
- [page.waitForTimeout(timeout)](api/class-page.md#pagewaitfortimeouttimeout)
|
||||||
- [page.workers()](api/class-page.md#pageworkers)
|
- [page.workers()](api/class-page.md#pageworkers)
|
||||||
|
|
||||||
#### page.on('close')
|
## page.on('close')
|
||||||
|
|
||||||
Emitted when the page closes.
|
Emitted when the page closes.
|
||||||
|
|
||||||
#### page.on('console')
|
## page.on('console')
|
||||||
- type: <[ConsoleMessage]>
|
- type: <[ConsoleMessage]>
|
||||||
|
|
||||||
Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.
|
Emitted when JavaScript within the page calls one of console API methods, e.g. `console.log` or `console.dir`. Also emitted if the page throws an error or a warning.
|
||||||
|
@ -152,7 +152,7 @@ page.on('console', msg => {
|
||||||
page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
|
page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.on('crash')
|
## page.on('crash')
|
||||||
|
|
||||||
Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.
|
Emitted when the page crashes. Browser pages might crash if they try to allocate too much memory. When the page crashes, ongoing and subsequent operations will throw.
|
||||||
|
|
||||||
|
@ -181,23 +181,23 @@ await new Promise((resolve, reject) => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.on('dialog')
|
## page.on('dialog')
|
||||||
- type: <[Dialog]>
|
- type: <[Dialog]>
|
||||||
|
|
||||||
Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [dialog.accept([promptText])](api/class-dialog.md#dialogacceptprompttext) or [dialog.dismiss()](api/class-dialog.md#dialogdismiss) methods.
|
Emitted when a JavaScript dialog appears, such as `alert`, `prompt`, `confirm` or `beforeunload`. Playwright can respond to the dialog via [dialog.accept([promptText])](api/class-dialog.md#dialogacceptprompttext) or [dialog.dismiss()](api/class-dialog.md#dialogdismiss) methods.
|
||||||
|
|
||||||
#### page.on('domcontentloaded')
|
## page.on('domcontentloaded')
|
||||||
|
|
||||||
Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
|
Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded) event is dispatched.
|
||||||
|
|
||||||
#### page.on('download')
|
## page.on('download')
|
||||||
- type: <[Download]>
|
- type: <[Download]>
|
||||||
|
|
||||||
Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.
|
Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.
|
||||||
|
|
||||||
> **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.
|
> **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.
|
||||||
|
|
||||||
#### page.on('filechooser')
|
## page.on('filechooser')
|
||||||
- type: <[FileChooser]>
|
- type: <[FileChooser]>
|
||||||
|
|
||||||
Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [fileChooser.setFiles(files[, options])](api/class-filechooser.md#filechoosersetfilesfiles-options) that can be uploaded after that.
|
Emitted when a file chooser is supposed to appear, such as after clicking the `<input type=file>`. Playwright can respond to it via setting the input files using [fileChooser.setFiles(files[, options])](api/class-filechooser.md#filechoosersetfilesfiles-options) that can be uploaded after that.
|
||||||
|
@ -208,31 +208,31 @@ page.on('filechooser', async (fileChooser) => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.on('frameattached')
|
## page.on('frameattached')
|
||||||
- type: <[Frame]>
|
- type: <[Frame]>
|
||||||
|
|
||||||
Emitted when a frame is attached.
|
Emitted when a frame is attached.
|
||||||
|
|
||||||
#### page.on('framedetached')
|
## page.on('framedetached')
|
||||||
- type: <[Frame]>
|
- type: <[Frame]>
|
||||||
|
|
||||||
Emitted when a frame is detached.
|
Emitted when a frame is detached.
|
||||||
|
|
||||||
#### page.on('framenavigated')
|
## page.on('framenavigated')
|
||||||
- type: <[Frame]>
|
- type: <[Frame]>
|
||||||
|
|
||||||
Emitted when a frame is navigated to a new url.
|
Emitted when a frame is navigated to a new url.
|
||||||
|
|
||||||
#### page.on('load')
|
## page.on('load')
|
||||||
|
|
||||||
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.
|
Emitted when the JavaScript [`load`](https://developer.mozilla.org/en-US/docs/Web/Events/load) event is dispatched.
|
||||||
|
|
||||||
#### page.on('pageerror')
|
## page.on('pageerror')
|
||||||
- type: <[Error]>
|
- type: <[Error]>
|
||||||
|
|
||||||
Emitted when an uncaught exception happens within the page.
|
Emitted when an uncaught exception happens within the page.
|
||||||
|
|
||||||
#### page.on('popup')
|
## page.on('popup')
|
||||||
- type: <[Page]>
|
- type: <[Page]>
|
||||||
|
|
||||||
Emitted when the page opens a new tab or window. This event is emitted in addition to the [browserContext.on('page')](api/class-browsercontext.md#browsercontextonpage), but only for popups relevant to this page.
|
Emitted when the page opens a new tab or window. This event is emitted in addition to the [browserContext.on('page')](api/class-browsercontext.md#browsercontextonpage), but only for popups relevant to this page.
|
||||||
|
@ -249,39 +249,39 @@ console.log(await popup.evaluate('location.href'));
|
||||||
|
|
||||||
> **NOTE** Use [page.waitForLoadState([state, options])](api/class-page.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).
|
> **NOTE** Use [page.waitForLoadState([state, options])](api/class-page.md#pagewaitforloadstatestate-options) to wait until the page gets to a particular state (you should not need it in most cases).
|
||||||
|
|
||||||
#### page.on('request')
|
## page.on('request')
|
||||||
- type: <[Request]>
|
- type: <[Request]>
|
||||||
|
|
||||||
Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [page.route(url, handler)](api/class-page.md#pagerouteurl-handler) or [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler).
|
Emitted when a page issues a request. The [request] object is read-only. In order to intercept and mutate requests, see [page.route(url, handler)](api/class-page.md#pagerouteurl-handler) or [browserContext.route(url, handler)](api/class-browsercontext.md#browsercontextrouteurl-handler).
|
||||||
|
|
||||||
#### page.on('requestfailed')
|
## page.on('requestfailed')
|
||||||
- type: <[Request]>
|
- type: <[Request]>
|
||||||
|
|
||||||
Emitted when a request fails, for example by timing out.
|
Emitted when a request fails, for example by timing out.
|
||||||
|
|
||||||
> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [page.on('requestfinished')](api/class-page.md#pageonrequestfinished) event and not with [page.on('requestfailed')](api/class-page.md#pageonrequestfailed).
|
> **NOTE** HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request will complete with [page.on('requestfinished')](api/class-page.md#pageonrequestfinished) event and not with [page.on('requestfailed')](api/class-page.md#pageonrequestfailed).
|
||||||
|
|
||||||
#### page.on('requestfinished')
|
## page.on('requestfinished')
|
||||||
- type: <[Request]>
|
- type: <[Request]>
|
||||||
|
|
||||||
Emitted when a request finishes successfully after downloading the response body. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.
|
Emitted when a request finishes successfully after downloading the response body. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.
|
||||||
|
|
||||||
#### page.on('response')
|
## page.on('response')
|
||||||
- type: <[Response]>
|
- type: <[Response]>
|
||||||
|
|
||||||
Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.
|
Emitted when [response] status and headers are received for a request. For a successful response, the sequence of events is `request`, `response` and `requestfinished`.
|
||||||
|
|
||||||
#### page.on('websocket')
|
## page.on('websocket')
|
||||||
- type: <[WebSocket]>
|
- type: <[WebSocket]>
|
||||||
|
|
||||||
Emitted when <[WebSocket]> request is sent.
|
Emitted when <[WebSocket]> request is sent.
|
||||||
|
|
||||||
#### page.on('worker')
|
## page.on('worker')
|
||||||
- type: <[Worker]>
|
- type: <[Worker]>
|
||||||
|
|
||||||
Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.
|
Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is spawned by the page.
|
||||||
|
|
||||||
#### page.$(selector)
|
## page.$(selector)
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- returns: <[Promise]<[null]|[ElementHandle]>>
|
- returns: <[Promise]<[null]|[ElementHandle]>>
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ The method finds an element matching the specified selector within the page. If
|
||||||
|
|
||||||
Shortcut for main frame's [frame.$(selector)](api/class-frame.md#frameselector).
|
Shortcut for main frame's [frame.$(selector)](api/class-frame.md#frameselector).
|
||||||
|
|
||||||
#### page.$$(selector)
|
## page.$$(selector)
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- returns: <[Promise]<[Array]<[ElementHandle]>>>
|
- returns: <[Promise]<[Array]<[ElementHandle]>>>
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ The method finds all elements matching the specified selector within the page. I
|
||||||
|
|
||||||
Shortcut for main frame's [frame.$$(selector)](api/class-frame.md#frameselector-1).
|
Shortcut for main frame's [frame.$$(selector)](api/class-frame.md#frameselector-1).
|
||||||
|
|
||||||
#### page.$eval(selector, pageFunction[, arg])
|
## page.$eval(selector, pageFunction[, arg])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
|
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
|
@ -317,7 +317,7 @@ const html = await page.$eval('.main-container', (e, suffix) => e.outerHTML + su
|
||||||
|
|
||||||
Shortcut for main frame's [frame.$eval(selector, pageFunction[, arg])](api/class-frame.md#frameevalselector-pagefunction-arg).
|
Shortcut for main frame's [frame.$eval(selector, pageFunction[, arg])](api/class-frame.md#frameevalselector-pagefunction-arg).
|
||||||
|
|
||||||
#### page.$$eval(selector, pageFunction[, arg])
|
## page.$$eval(selector, pageFunction[, arg])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context
|
- `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
|
@ -333,10 +333,10 @@ Examples:
|
||||||
const divsCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10);
|
const divsCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.accessibility
|
## page.accessibility
|
||||||
- type: <[Accessibility]>
|
- type: <[Accessibility]>
|
||||||
|
|
||||||
#### page.addInitScript(script[, arg])
|
## page.addInitScript(script[, arg])
|
||||||
- `script` <[function]|[string]|[Object]> Script to be evaluated in the page.
|
- `script` <[function]|[string]|[Object]> Script to be evaluated in the page.
|
||||||
- `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
- `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
||||||
- `content` <[string]> Raw script content. Optional.
|
- `content` <[string]> Raw script content. Optional.
|
||||||
|
@ -362,7 +362,7 @@ await page.addInitScript(preloadFile);
|
||||||
|
|
||||||
> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript(script[, arg])](api/class-browsercontext.md#browsercontextaddinitscriptscript-arg) and [page.addInitScript(script[, arg])](api/class-page.md#pageaddinitscriptscript-arg) is not defined.
|
> **NOTE** The order of evaluation of multiple scripts installed via [browserContext.addInitScript(script[, arg])](api/class-browsercontext.md#browsercontextaddinitscriptscript-arg) and [page.addInitScript(script[, arg])](api/class-page.md#pageaddinitscriptscript-arg) is not defined.
|
||||||
|
|
||||||
#### page.addScriptTag(params)
|
## page.addScriptTag(params)
|
||||||
- `params` <[Object]>
|
- `params` <[Object]>
|
||||||
- `url` <[string]> URL of a script to be added. Optional.
|
- `url` <[string]> URL of a script to be added. Optional.
|
||||||
- `path` <[string]> Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
- `path` <[string]> Path to the JavaScript file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
||||||
|
@ -374,7 +374,7 @@ Adds a `<script>` tag into the page with the desired url or content. Returns the
|
||||||
|
|
||||||
Shortcut for main frame's [frame.addScriptTag(params)](api/class-frame.md#frameaddscripttagparams).
|
Shortcut for main frame's [frame.addScriptTag(params)](api/class-frame.md#frameaddscripttagparams).
|
||||||
|
|
||||||
#### page.addStyleTag(params)
|
## page.addStyleTag(params)
|
||||||
- `params` <[Object]>
|
- `params` <[Object]>
|
||||||
- `url` <[string]> URL of the `<link>` tag. Optional.
|
- `url` <[string]> URL of the `<link>` tag. Optional.
|
||||||
- `path` <[string]> Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
- `path` <[string]> Path to the CSS file to be injected into frame. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
||||||
|
@ -385,12 +385,12 @@ Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<s
|
||||||
|
|
||||||
Shortcut for main frame's [frame.addStyleTag(params)](api/class-frame.md#frameaddstyletagparams).
|
Shortcut for main frame's [frame.addStyleTag(params)](api/class-frame.md#frameaddstyletagparams).
|
||||||
|
|
||||||
#### page.bringToFront()
|
## page.bringToFront()
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Brings page to front (activates tab).
|
Brings page to front (activates tab).
|
||||||
|
|
||||||
#### page.check(selector[, options])
|
## page.check(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -411,7 +411,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Shortcut for main frame's [frame.check(selector[, options])](api/class-frame.md#framecheckselector-options).
|
Shortcut for main frame's [frame.check(selector[, options])](api/class-frame.md#framecheckselector-options).
|
||||||
|
|
||||||
#### page.click(selector[, options])
|
## page.click(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
|
@ -437,7 +437,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Shortcut for main frame's [frame.click(selector[, options])](api/class-frame.md#frameclickselector-options).
|
Shortcut for main frame's [frame.click(selector[, options])](api/class-frame.md#frameclickselector-options).
|
||||||
|
|
||||||
#### page.close([options])
|
## page.close([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `runBeforeUnload` <[boolean]> Defaults to `false`. Whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers.
|
- `runBeforeUnload` <[boolean]> Defaults to `false`. Whether to run the [before unload](https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload) page handlers.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
@ -449,22 +449,22 @@ By default, `page.close()` **does not** run `beforeunload` handlers.
|
||||||
> **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned
|
> **NOTE** if `runBeforeUnload` is passed as true, a `beforeunload` dialog might be summoned
|
||||||
> and should be handled manually via [page.on('dialog')](api/class-page.md#pageondialog) event.
|
> and should be handled manually via [page.on('dialog')](api/class-page.md#pageondialog) event.
|
||||||
|
|
||||||
#### page.content()
|
## page.content()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Gets the full HTML contents of the page, including the doctype.
|
Gets the full HTML contents of the page, including the doctype.
|
||||||
|
|
||||||
#### page.context()
|
## page.context()
|
||||||
- returns: <[BrowserContext]>
|
- returns: <[BrowserContext]>
|
||||||
|
|
||||||
Get the browser context that the page belongs to.
|
Get the browser context that the page belongs to.
|
||||||
|
|
||||||
#### page.coverage
|
## page.coverage
|
||||||
- type: <[null]|[ChromiumCoverage]>
|
- type: <[null]|[ChromiumCoverage]>
|
||||||
|
|
||||||
Browser-specific Coverage implementation, only available for Chromium atm. See [ChromiumCoverage](#class-chromiumcoverage) for more details.
|
Browser-specific Coverage implementation, only available for Chromium atm. See [ChromiumCoverage](#class-chromiumcoverage) for more details.
|
||||||
|
|
||||||
#### page.dblclick(selector[, options])
|
## page.dblclick(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
- `button` <"left"|"right"|"middle"> Defaults to `left`.
|
||||||
|
@ -491,7 +491,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Shortcut for main frame's [frame.dblclick(selector[, options])](api/class-frame.md#framedblclickselector-options).
|
Shortcut for main frame's [frame.dblclick(selector[, options])](api/class-frame.md#framedblclickselector-options).
|
||||||
|
|
||||||
#### page.dispatchEvent(selector, type[, eventInit, options])
|
## page.dispatchEvent(selector, type[, eventInit, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.
|
- `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc.
|
||||||
- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.
|
- `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties.
|
||||||
|
@ -524,7 +524,7 @@ const dataTransfer = await page.evaluateHandle(() => new DataTransfer());
|
||||||
await page.dispatchEvent('#source', 'dragstart', { dataTransfer });
|
await page.dispatchEvent('#source', 'dragstart', { dataTransfer });
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.emulateMedia(params)
|
## page.emulateMedia(params)
|
||||||
- `params` <[Object]>
|
- `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.
|
- `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.
|
- `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.
|
||||||
|
@ -559,7 +559,7 @@ await page.evaluate(() => matchMedia('(prefers-color-scheme: no-preference)').ma
|
||||||
// → false
|
// → false
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.evaluate(pageFunction[, arg])
|
## page.evaluate(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[Serializable]>>
|
- returns: <[Promise]<[Serializable]>>
|
||||||
|
@ -597,7 +597,7 @@ await bodyHandle.dispose();
|
||||||
|
|
||||||
Shortcut for main frame's [frame.evaluate(pageFunction[, arg])](api/class-frame.md#frameevaluatepagefunction-arg).
|
Shortcut for main frame's [frame.evaluate(pageFunction[, arg])](api/class-frame.md#frameevaluatepagefunction-arg).
|
||||||
|
|
||||||
#### page.evaluateHandle(pageFunction[, arg])
|
## page.evaluateHandle(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[JSHandle]>>
|
- returns: <[Promise]<[JSHandle]>>
|
||||||
|
@ -623,7 +623,7 @@ console.log(await resultHandle.jsonValue());
|
||||||
await resultHandle.dispose();
|
await resultHandle.dispose();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.exposeBinding(name, playwrightBinding[, options])
|
## page.exposeBinding(name, playwrightBinding[, options])
|
||||||
- `name` <[string]> Name of the function on the window object.
|
- `name` <[string]> Name of the function on the window object.
|
||||||
- `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context.
|
- `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -676,7 +676,7 @@ await page.setContent(`
|
||||||
`);
|
`);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.exposeFunction(name, playwrightFunction)
|
## page.exposeFunction(name, playwrightFunction)
|
||||||
- `name` <[string]> Name of the function on the window object
|
- `name` <[string]> Name of the function on the window object
|
||||||
- `playwrightFunction` <[function]> Callback function which will be called in Playwright's context.
|
- `playwrightFunction` <[function]> Callback function which will be called in Playwright's context.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
@ -741,7 +741,7 @@ const fs = require('fs');
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.fill(selector, value[, options])
|
## page.fill(selector, value[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
- `value` <[string]> Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -755,7 +755,7 @@ To send fine-grained keyboard events, use [page.type(selector, text[, options])]
|
||||||
|
|
||||||
Shortcut for main frame's [frame.fill(selector, value[, options])](api/class-frame.md#framefillselector-value-options)
|
Shortcut for main frame's [frame.fill(selector, value[, options])](api/class-frame.md#framefillselector-value-options)
|
||||||
|
|
||||||
#### page.focus(selector[, options])
|
## page.focus(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -765,7 +765,7 @@ This method fetches an element with `selector` and focuses it. If there's no ele
|
||||||
|
|
||||||
Shortcut for main frame's [frame.focus(selector[, options])](api/class-frame.md#framefocusselector-options).
|
Shortcut for main frame's [frame.focus(selector[, options])](api/class-frame.md#framefocusselector-options).
|
||||||
|
|
||||||
#### page.frame(frameSelector)
|
## page.frame(frameSelector)
|
||||||
- `frameSelector` <[string]|[Object]> Frame name or other frame lookup options.
|
- `frameSelector` <[string]|[Object]> Frame name or other frame lookup options.
|
||||||
- `name` <[string]> Frame name specified in the `iframe`'s `name` attribute. Optional.
|
- `name` <[string]> Frame name specified in the `iframe`'s `name` attribute. Optional.
|
||||||
- `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.
|
- `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving frame's `url` as a [URL] object. Optional.
|
||||||
|
@ -781,12 +781,12 @@ const frame = page.frame('frame-name');
|
||||||
const frame = page.frame({ url: /.*domain.*/ });
|
const frame = page.frame({ url: /.*domain.*/ });
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.frames()
|
## page.frames()
|
||||||
- returns: <[Array]<[Frame]>>
|
- returns: <[Array]<[Frame]>>
|
||||||
|
|
||||||
An array of all frames attached to the page.
|
An array of all frames attached to the page.
|
||||||
|
|
||||||
#### page.getAttribute(selector, name[, options])
|
## page.getAttribute(selector, name[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `name` <[string]> Attribute name to get the value for.
|
- `name` <[string]> Attribute name to get the value for.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -795,7 +795,7 @@ An array of all frames attached to the page.
|
||||||
|
|
||||||
Returns element attribute value.
|
Returns element attribute value.
|
||||||
|
|
||||||
#### page.goBack([options])
|
## page.goBack([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
||||||
- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:
|
||||||
|
@ -808,7 +808,7 @@ Returns the main resource response. In case of multiple redirects, the navigatio
|
||||||
|
|
||||||
Navigate to the previous page in history.
|
Navigate to the previous page in history.
|
||||||
|
|
||||||
#### page.goForward([options])
|
## page.goForward([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
||||||
- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:
|
||||||
|
@ -821,7 +821,7 @@ Returns the main resource response. In case of multiple redirects, the navigatio
|
||||||
|
|
||||||
Navigate to the next page in history.
|
Navigate to the next page in history.
|
||||||
|
|
||||||
#### page.goto(url[, options])
|
## page.goto(url[, options])
|
||||||
- `url` <[string]> URL to navigate page to. The url should include scheme, e.g. `https://`.
|
- `url` <[string]> URL to navigate page to. The url should include scheme, e.g. `https://`.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders(headers)](api/class-page.md#pagesetextrahttpheadersheaders).
|
- `referer` <[string]> Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders(headers)](api/class-page.md#pagesetextrahttpheadersheaders).
|
||||||
|
@ -848,7 +848,7 @@ Returns the main resource response. In case of multiple redirects, the navigatio
|
||||||
|
|
||||||
Shortcut for main frame's [frame.goto(url[, options])](api/class-frame.md#framegotourl-options)
|
Shortcut for main frame's [frame.goto(url[, options])](api/class-frame.md#framegotourl-options)
|
||||||
|
|
||||||
#### page.hover(selector[, options])
|
## page.hover(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -870,7 +870,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Shortcut for main frame's [frame.hover(selector[, options])](api/class-frame.md#framehoverselector-options).
|
Shortcut for main frame's [frame.hover(selector[, options])](api/class-frame.md#framehoverselector-options).
|
||||||
|
|
||||||
#### page.innerHTML(selector[, options])
|
## page.innerHTML(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -878,7 +878,7 @@ Shortcut for main frame's [frame.hover(selector[, options])](api/class-frame.md#
|
||||||
|
|
||||||
Returns `element.innerHTML`.
|
Returns `element.innerHTML`.
|
||||||
|
|
||||||
#### page.innerText(selector[, options])
|
## page.innerText(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -886,28 +886,28 @@ Returns `element.innerHTML`.
|
||||||
|
|
||||||
Returns `element.innerText`.
|
Returns `element.innerText`.
|
||||||
|
|
||||||
#### page.isClosed()
|
## page.isClosed()
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Indicates that the page has been closed.
|
Indicates that the page has been closed.
|
||||||
|
|
||||||
#### page.keyboard
|
## page.keyboard
|
||||||
- type: <[Keyboard]>
|
- type: <[Keyboard]>
|
||||||
|
|
||||||
#### page.mainFrame()
|
## page.mainFrame()
|
||||||
- returns: <[Frame]>
|
- returns: <[Frame]>
|
||||||
|
|
||||||
The page's main frame. Page is guaranteed to have a main frame which persists during navigations.
|
The page's main frame. Page is guaranteed to have a main frame which persists during navigations.
|
||||||
|
|
||||||
#### page.mouse
|
## page.mouse
|
||||||
- type: <[Mouse]>
|
- type: <[Mouse]>
|
||||||
|
|
||||||
#### page.opener()
|
## page.opener()
|
||||||
- returns: <[Promise]<[null]|[Page]>>
|
- returns: <[Promise]<[null]|[Page]>>
|
||||||
|
|
||||||
Returns the opener for popup pages and `null` for others. If the opener has been closed already the returns `null`.
|
Returns the opener for popup pages and `null` for others. If the opener has been closed already the returns `null`.
|
||||||
|
|
||||||
#### page.pdf([options])
|
## page.pdf([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `displayHeaderFooter` <[boolean]> Display header and footer. Defaults to `false`.
|
- `displayHeaderFooter` <[boolean]> Display header and footer. Defaults to `false`.
|
||||||
- `footerTemplate` <[string]> HTML template for the print footer. Should use the same format as the `headerTemplate`.
|
- `footerTemplate` <[string]> HTML template for the print footer. Should use the same format as the `headerTemplate`.
|
||||||
|
@ -977,7 +977,7 @@ The `format` options are:
|
||||||
> 1. Script tags inside templates are not evaluated.
|
> 1. Script tags inside templates are not evaluated.
|
||||||
> 2. Page styles are not visible inside templates.
|
> 2. Page styles are not visible inside templates.
|
||||||
|
|
||||||
#### page.press(selector, key[, options])
|
## page.press(selector, key[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
- `key` <[string]> Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -1012,7 +1012,7 @@ await page.screenshot({ path: 'O.png' });
|
||||||
await browser.close();
|
await browser.close();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.reload([options])
|
## page.reload([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
||||||
- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:
|
- `waitUntil` <"load"|"domcontentloaded"|"networkidle"> When to consider operation succeeded, defaults to `load`. Events can be either:
|
||||||
|
@ -1023,7 +1023,7 @@ await browser.close();
|
||||||
|
|
||||||
Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
|
Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
|
||||||
|
|
||||||
#### page.route(url, handler)
|
## page.route(url, handler)
|
||||||
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
|
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
|
||||||
- `handler` <[function]\([Route], [Request]\)> handler function to route the request.
|
- `handler` <[function]\([Route], [Request]\)> handler function to route the request.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
@ -1056,7 +1056,7 @@ Page routes take precedence over browser context routes (set up with [browserCon
|
||||||
|
|
||||||
> **NOTE** Enabling routing disables http cache.
|
> **NOTE** Enabling routing disables http cache.
|
||||||
|
|
||||||
#### page.screenshot([options])
|
## page.screenshot([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `clip` <[Object]> An object which specifies clipping of the resulting image. Should have the following fields:
|
- `clip` <[Object]> An object which specifies clipping of the resulting image. Should have the following fields:
|
||||||
- `x` <[number]> x-coordinate of top-left corner of clip area
|
- `x` <[number]> x-coordinate of top-left corner of clip area
|
||||||
|
@ -1075,7 +1075,7 @@ Returns the buffer with the captured screenshot.
|
||||||
|
|
||||||
> **NOTE** Screenshots take at least 1/6 second on Chromium OS X and Chromium Windows. See https://crbug.com/741689 for discussion.
|
> **NOTE** Screenshots take at least 1/6 second on Chromium OS X and Chromium Windows. See https://crbug.com/741689 for discussion.
|
||||||
|
|
||||||
#### page.selectOption(selector, values[, options])
|
## page.selectOption(selector, values[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
- `values` <[null]|[string]|[ElementHandle]|[Array]<[string]>|[Object]|[Array]<[ElementHandle]>|[Array]<[Object]>> Options to select. If the `<select>` has the `multiple` attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are equivalent to `{value:'string'}`. Option is considered matching if all specified properties match.
|
||||||
- `value` <[string]> Matches by `option.value`. Optional.
|
- `value` <[string]> Matches by `option.value`. Optional.
|
||||||
|
@ -1104,7 +1104,7 @@ page.selectOption('select#colors', ['red', 'green', 'blue']);
|
||||||
|
|
||||||
Shortcut for main frame's [frame.selectOption(selector, values[, options])](api/class-frame.md#frameselectoptionselector-values-options)
|
Shortcut for main frame's [frame.selectOption(selector, values[, options])](api/class-frame.md#frameselectoptionselector-values-options)
|
||||||
|
|
||||||
#### page.setContent(html[, options])
|
## page.setContent(html[, options])
|
||||||
- `html` <[string]> HTML markup to assign to the page.
|
- `html` <[string]> HTML markup to assign to the page.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
||||||
|
@ -1114,7 +1114,7 @@ Shortcut for main frame's [frame.selectOption(selector, values[, options])](api/
|
||||||
* `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
|
* `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
#### page.setDefaultNavigationTimeout(timeout)
|
## page.setDefaultNavigationTimeout(timeout)
|
||||||
- `timeout` <[number]> Maximum navigation time in milliseconds
|
- `timeout` <[number]> Maximum navigation time in milliseconds
|
||||||
|
|
||||||
This setting will change the default maximum navigation time for the following methods and related shortcuts:
|
This setting will change the default maximum navigation time for the following methods and related shortcuts:
|
||||||
|
@ -1127,14 +1127,14 @@ This setting will change the default maximum navigation time for the following m
|
||||||
|
|
||||||
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) takes priority over [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout) and [browserContext.setDefaultNavigationTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout).
|
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) takes priority over [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout) and [browserContext.setDefaultNavigationTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout).
|
||||||
|
|
||||||
#### page.setDefaultTimeout(timeout)
|
## page.setDefaultTimeout(timeout)
|
||||||
- `timeout` <[number]> Maximum time in milliseconds
|
- `timeout` <[number]> Maximum time in milliseconds
|
||||||
|
|
||||||
This setting will change the default maximum time for all the methods accepting `timeout` option.
|
This setting will change the default maximum time for all the methods accepting `timeout` option.
|
||||||
|
|
||||||
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) takes priority over [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout).
|
> **NOTE** [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) takes priority over [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout).
|
||||||
|
|
||||||
#### page.setExtraHTTPHeaders(headers)
|
## page.setExtraHTTPHeaders(headers)
|
||||||
- `headers` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings.
|
- `headers` <[Object]<[string], [string]>> An object containing additional HTTP headers to be sent with every request. All header values must be strings.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
|
@ -1142,7 +1142,7 @@ The extra HTTP headers will be sent with every request the page initiates.
|
||||||
|
|
||||||
> **NOTE** page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests.
|
> **NOTE** page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing requests.
|
||||||
|
|
||||||
#### page.setInputFiles(selector, files[, options])
|
## page.setInputFiles(selector, files[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
- `files` <[string]|[Array]<[string]>|[Object]|[Array]<[Object]>>
|
||||||
- `name` <[string]> [File] name **required**
|
- `name` <[string]> [File] name **required**
|
||||||
|
@ -1157,7 +1157,7 @@ This method expects `selector` to point to an [input element](https://developer.
|
||||||
|
|
||||||
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
Sets the value of the file input to these file paths or files. If some of the `filePaths` are relative paths, then they are resolved relative to the the current working directory. For empty array, clears the selected files.
|
||||||
|
|
||||||
#### page.setViewportSize(viewportSize)
|
## page.setViewportSize(viewportSize)
|
||||||
- `viewportSize` <[Object]>
|
- `viewportSize` <[Object]>
|
||||||
- `width` <[number]> page width in pixels. **required**
|
- `width` <[number]> page width in pixels. **required**
|
||||||
- `height` <[number]> page height in pixels. **required**
|
- `height` <[number]> page height in pixels. **required**
|
||||||
|
@ -1176,7 +1176,7 @@ await page.setViewportSize({
|
||||||
await page.goto('https://example.com');
|
await page.goto('https://example.com');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.tap(selector[, options])
|
## page.tap(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -1201,7 +1201,7 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Shortcut for main frame's [frame.tap(selector[, options])](api/class-frame.md#frametapselector-options).
|
Shortcut for main frame's [frame.tap(selector[, options])](api/class-frame.md#frametapselector-options).
|
||||||
|
|
||||||
#### page.textContent(selector[, options])
|
## page.textContent(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `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.
|
- `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.
|
||||||
|
@ -1209,15 +1209,15 @@ Shortcut for main frame's [frame.tap(selector[, options])](api/class-frame.md#fr
|
||||||
|
|
||||||
Returns `element.textContent`.
|
Returns `element.textContent`.
|
||||||
|
|
||||||
#### page.title()
|
## page.title()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Returns the page's title. Shortcut for main frame's [frame.title()](api/class-frame.md#frametitle).
|
Returns the page's title. Shortcut for main frame's [frame.title()](api/class-frame.md#frametitle).
|
||||||
|
|
||||||
#### page.touchscreen
|
## page.touchscreen
|
||||||
- type: <[Touchscreen]>
|
- type: <[Touchscreen]>
|
||||||
|
|
||||||
#### page.type(selector, text[, options])
|
## page.type(selector, text[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `text` <[string]> A text to type into a focused element.
|
- `text` <[string]> A text to type into a focused element.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -1237,7 +1237,7 @@ await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a u
|
||||||
|
|
||||||
Shortcut for main frame's [frame.type(selector, text[, options])](api/class-frame.md#frametypeselector-text-options).
|
Shortcut for main frame's [frame.type(selector, text[, options])](api/class-frame.md#frametypeselector-text-options).
|
||||||
|
|
||||||
#### page.uncheck(selector[, options])
|
## page.uncheck(selector[, options])
|
||||||
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
- `force` <[boolean]> Whether to bypass the [actionability](./actionability.md) checks. Defaults to `false`.
|
||||||
|
@ -1258,29 +1258,29 @@ When all steps combined have not finished during the specified `timeout`, this m
|
||||||
|
|
||||||
Shortcut for main frame's [frame.uncheck(selector[, options])](api/class-frame.md#frameuncheckselector-options).
|
Shortcut for main frame's [frame.uncheck(selector[, options])](api/class-frame.md#frameuncheckselector-options).
|
||||||
|
|
||||||
#### page.unroute(url[, handler])
|
## page.unroute(url[, handler])
|
||||||
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
|
- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
|
||||||
- `handler` <[function]\([Route], [Request]\)> Optional handler function to route the request.
|
- `handler` <[function]\([Route], [Request]\)> Optional handler function to route the request.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Removes a route created with [page.route(url, handler)](api/class-page.md#pagerouteurl-handler). When `handler` is not specified, removes all routes for the `url`.
|
Removes a route created with [page.route(url, handler)](api/class-page.md#pagerouteurl-handler). When `handler` is not specified, removes all routes for the `url`.
|
||||||
|
|
||||||
#### page.url()
|
## page.url()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Shortcut for main frame's [frame.url()](api/class-frame.md#frameurl).
|
Shortcut for main frame's [frame.url()](api/class-frame.md#frameurl).
|
||||||
|
|
||||||
#### page.video()
|
## page.video()
|
||||||
- returns: <[null]|[Video]>
|
- returns: <[null]|[Video]>
|
||||||
|
|
||||||
Video object associated with this page.
|
Video object associated with this page.
|
||||||
|
|
||||||
#### page.viewportSize()
|
## page.viewportSize()
|
||||||
- returns: <[null]|[Object]>
|
- returns: <[null]|[Object]>
|
||||||
- `width` <[number]> page width in pixels.
|
- `width` <[number]> page width in pixels.
|
||||||
- `height` <[number]> page height in pixels.
|
- `height` <[number]> page height in pixels.
|
||||||
|
|
||||||
#### page.waitForEvent(event[, optionsOrPredicate])
|
## page.waitForEvent(event[, optionsOrPredicate])
|
||||||
- `event` <[string]> Event name, same one would pass into `page.on(event)`.
|
- `event` <[string]> Event name, same one would pass into `page.on(event)`.
|
||||||
- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.
|
- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.
|
||||||
- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.
|
- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.
|
||||||
|
@ -1291,7 +1291,7 @@ Returns the event data value.
|
||||||
|
|
||||||
Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the page is closed before the event is fired.
|
Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the page is closed before the event is fired.
|
||||||
|
|
||||||
#### page.waitForFunction(pageFunction[, arg, options])
|
## page.waitForFunction(pageFunction[, arg, options])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in browser context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in browser context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
|
@ -1325,7 +1325,7 @@ await page.waitForFunction(selector => !!document.querySelector(selector), selec
|
||||||
|
|
||||||
Shortcut for main frame's [frame.waitForFunction(pageFunction[, arg, options])](api/class-frame.md#framewaitforfunctionpagefunction-arg-options).
|
Shortcut for main frame's [frame.waitForFunction(pageFunction[, arg, options])](api/class-frame.md#framewaitforfunctionpagefunction-arg-options).
|
||||||
|
|
||||||
#### page.waitForLoadState([state, options])
|
## page.waitForLoadState([state, options])
|
||||||
- `state` <"load"|"domcontentloaded"|"networkidle"> Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method resolves immediately. Can be one of:
|
- `state` <"load"|"domcontentloaded"|"networkidle"> Optional load state to wait for, defaults to `load`. If the state has been already reached while loading current document, the method resolves immediately. Can be one of:
|
||||||
* `'load'` - wait for the `load` event to be fired.
|
* `'load'` - wait for the `load` event to be fired.
|
||||||
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
|
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
|
||||||
|
@ -1354,7 +1354,7 @@ console.log(await popup.title()); // Popup is ready to use.
|
||||||
|
|
||||||
Shortcut for main frame's [frame.waitForLoadState([state, options])](api/class-frame.md#framewaitforloadstatestate-options).
|
Shortcut for main frame's [frame.waitForLoadState([state, options])](api/class-frame.md#framewaitforloadstatestate-options).
|
||||||
|
|
||||||
#### page.waitForNavigation([options])
|
## page.waitForNavigation([options])
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
- `timeout` <[number]> 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(timeout)](api/class-browsercontext.md#browsercontextsetdefaultnavigationtimeouttimeout), [browserContext.setDefaultTimeout(timeout)](api/class-browsercontext.md#browsercontextsetdefaulttimeouttimeout), [page.setDefaultNavigationTimeout(timeout)](api/class-page.md#pagesetdefaultnavigationtimeouttimeout) or [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) methods.
|
||||||
- `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
- `url` <[string]|[RegExp]|[Function]> A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation.
|
||||||
|
@ -1379,7 +1379,7 @@ const [response] = await Promise.all([
|
||||||
|
|
||||||
Shortcut for main frame's [frame.waitForNavigation([options])](api/class-frame.md#framewaitfornavigationoptions).
|
Shortcut for main frame's [frame.waitForNavigation([options])](api/class-frame.md#framewaitfornavigationoptions).
|
||||||
|
|
||||||
#### page.waitForRequest(urlOrPredicate[, options])
|
## page.waitForRequest(urlOrPredicate[, options])
|
||||||
- `urlOrPredicate` <[string]|[RegExp]|[Function]> Request URL string, regex or predicate receiving [Request] object.
|
- `urlOrPredicate` <[string]|[RegExp]|[Function]> Request URL string, regex or predicate receiving [Request] object.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) method.
|
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the timeout. The default value can be changed by using the [page.setDefaultTimeout(timeout)](api/class-page.md#pagesetdefaulttimeouttimeout) method.
|
||||||
|
@ -1397,7 +1397,7 @@ return firstRequest.url();
|
||||||
await page.waitForRequest(request => request.url().searchParams.get('foo') === 'bar' && request.url().searchParams.get('foo2') === 'bar2');
|
await page.waitForRequest(request => request.url().searchParams.get('foo') === 'bar' && request.url().searchParams.get('foo2') === 'bar2');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.waitForResponse(urlOrPredicate[, options])
|
## page.waitForResponse(urlOrPredicate[, options])
|
||||||
- `urlOrPredicate` <[string]|[RegExp]|[function]\([Response]\):[boolean]> Request URL string, regex or predicate receiving [Response] object.
|
- `urlOrPredicate` <[string]|[RegExp]|[function]\([Response]\):[boolean]> Request URL string, regex or predicate receiving [Response] object.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the 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.
|
- `timeout` <[number]> Maximum wait time in milliseconds, defaults to 30 seconds, pass `0` to disable the 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.
|
||||||
|
@ -1411,7 +1411,7 @@ const finalResponse = await page.waitForResponse(response => response.url() ===
|
||||||
return finalResponse.ok();
|
return finalResponse.ok();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.waitForSelector(selector[, options])
|
## page.waitForSelector(selector[, options])
|
||||||
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
- `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
|
||||||
- `options` <[Object]>
|
- `options` <[Object]>
|
||||||
- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:
|
- `state` <"attached"|"detached"|"visible"|"hidden"> Defaults to `'visible'`. Can be either:
|
||||||
|
@ -1445,7 +1445,7 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.waitForTimeout(timeout)
|
## page.waitForTimeout(timeout)
|
||||||
- `timeout` <[number]> A timeout to wait for
|
- `timeout` <[number]> A timeout to wait for
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
|
@ -1460,12 +1460,13 @@ await page.waitForTimeout(1000);
|
||||||
|
|
||||||
Shortcut for main frame's [frame.waitForTimeout(timeout)](api/class-frame.md#framewaitfortimeouttimeout).
|
Shortcut for main frame's [frame.waitForTimeout(timeout)](api/class-frame.md#framewaitfortimeouttimeout).
|
||||||
|
|
||||||
#### page.workers()
|
## page.workers()
|
||||||
- returns: <[Array]<[Worker]>>
|
- returns: <[Array]<[Worker]>>
|
||||||
|
|
||||||
This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page.
|
This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) associated with the page.
|
||||||
|
|
||||||
> **NOTE** This does not contain ServiceWorkers
|
> **NOTE** This does not contain ServiceWorkers
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-playwright
|
id: class-playwright
|
||||||
title: "class: Playwright"
|
title: "Playwright"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@ By default, the `playwright` NPM package automatically downloads browser executa
|
||||||
- [playwright.selectors](api/class-playwright.md#playwrightselectors)
|
- [playwright.selectors](api/class-playwright.md#playwrightselectors)
|
||||||
- [playwright.webkit](api/class-playwright.md#playwrightwebkit)
|
- [playwright.webkit](api/class-playwright.md#playwrightwebkit)
|
||||||
|
|
||||||
#### playwright.chromium
|
## playwright.chromium
|
||||||
- type: <[BrowserType]>
|
- type: <[BrowserType]>
|
||||||
|
|
||||||
This object can be used to launch or connect to Chromium, returning instances of [ChromiumBrowser].
|
This object can be used to launch or connect to Chromium, returning instances of [ChromiumBrowser].
|
||||||
|
|
||||||
#### playwright.devices
|
## playwright.devices
|
||||||
- type: <[Object]>
|
- type: <[Object]>
|
||||||
|
|
||||||
Returns a list of devices to be used with [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions) or [browser.newPage([options])](api/class-browser.md#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 [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions) or [browser.newPage([options])](api/class-browser.md#browsernewpageoptions). Actual list of devices can be found in [src/server/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/server/deviceDescriptors.ts).
|
||||||
|
@ -54,7 +54,7 @@ const iPhone = devices['iPhone 6'];
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### playwright.errors
|
## playwright.errors
|
||||||
- type: <[Object]>
|
- type: <[Object]>
|
||||||
- `TimeoutError` <[function]> A class of [TimeoutError].
|
- `TimeoutError` <[function]> A class of [TimeoutError].
|
||||||
|
|
||||||
|
@ -74,20 +74,21 @@ try {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### playwright.firefox
|
## playwright.firefox
|
||||||
- type: <[BrowserType]>
|
- type: <[BrowserType]>
|
||||||
|
|
||||||
This object can be used to launch or connect to Firefox, returning instances of [FirefoxBrowser].
|
This object can be used to launch or connect to Firefox, returning instances of [FirefoxBrowser].
|
||||||
|
|
||||||
#### playwright.selectors
|
## playwright.selectors
|
||||||
- type: <[Selectors]>
|
- type: <[Selectors]>
|
||||||
|
|
||||||
Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md#working-with-selectors) for more information.
|
Selectors can be used to install custom selector engines. See [Working with selectors](./selectors.md#working-with-selectors) for more information.
|
||||||
|
|
||||||
#### playwright.webkit
|
## playwright.webkit
|
||||||
- type: <[BrowserType]>
|
- type: <[BrowserType]>
|
||||||
|
|
||||||
This object can be used to launch or connect to WebKit, returning instances of [WebKitBrowser].
|
This object can be used to launch or connect to WebKit, returning instances of [WebKitBrowser].
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-request
|
id: class-request
|
||||||
title: "class: Request"
|
title: "Request"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ If request gets a 'redirect' response, the request is successfully finished with
|
||||||
- [request.timing()](api/class-request.md#requesttiming)
|
- [request.timing()](api/class-request.md#requesttiming)
|
||||||
- [request.url()](api/class-request.md#requesturl)
|
- [request.url()](api/class-request.md#requesturl)
|
||||||
|
|
||||||
#### request.failure()
|
## request.failure()
|
||||||
- returns: <[null]|[Object]>
|
- returns: <[null]|[Object]>
|
||||||
- `errorText` <[string]> Human-readable error message, e.g. `'net::ERR_FAILED'`.
|
- `errorText` <[string]> Human-readable error message, e.g. `'net::ERR_FAILED'`.
|
||||||
|
|
||||||
|
@ -45,44 +45,44 @@ page.on('requestfailed', request => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### request.frame()
|
## request.frame()
|
||||||
- returns: <[Frame]>
|
- returns: <[Frame]>
|
||||||
|
|
||||||
Returns the [Frame] that initiated this request.
|
Returns the [Frame] that initiated this request.
|
||||||
|
|
||||||
#### request.headers()
|
## request.headers()
|
||||||
- returns: <[Object]<[string], [string]>>
|
- returns: <[Object]<[string], [string]>>
|
||||||
|
|
||||||
An object with HTTP headers associated with the request. All header names are lower-case.
|
An object with HTTP headers associated with the request. All header names are lower-case.
|
||||||
|
|
||||||
#### request.isNavigationRequest()
|
## request.isNavigationRequest()
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Whether this request is driving frame's navigation.
|
Whether this request is driving frame's navigation.
|
||||||
|
|
||||||
#### request.method()
|
## request.method()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Request's method (GET, POST, etc.)
|
Request's method (GET, POST, etc.)
|
||||||
|
|
||||||
#### request.postData()
|
## request.postData()
|
||||||
- returns: <[null]|[string]>
|
- returns: <[null]|[string]>
|
||||||
|
|
||||||
Request's post body, if any.
|
Request's post body, if any.
|
||||||
|
|
||||||
#### request.postDataBuffer()
|
## request.postDataBuffer()
|
||||||
- returns: <[null]|[Buffer]>
|
- returns: <[null]|[Buffer]>
|
||||||
|
|
||||||
Request's post body in a binary form, if any.
|
Request's post body in a binary form, if any.
|
||||||
|
|
||||||
#### request.postDataJSON()
|
## request.postDataJSON()
|
||||||
- returns: <[null]|[Object]>
|
- returns: <[null]|[Object]>
|
||||||
|
|
||||||
Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.
|
Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any.
|
||||||
|
|
||||||
When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned. Otherwise it will be parsed as JSON.
|
When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned. Otherwise it will be parsed as JSON.
|
||||||
|
|
||||||
#### request.redirectedFrom()
|
## request.redirectedFrom()
|
||||||
- returns: <[null]|[Request]>
|
- returns: <[null]|[Request]>
|
||||||
|
|
||||||
Request that was redirected by the server to this one, if any.
|
Request that was redirected by the server to this one, if any.
|
||||||
|
@ -103,7 +103,7 @@ const response = await page.goto('https://google.com');
|
||||||
console.log(response.request().redirectedFrom()); // null
|
console.log(response.request().redirectedFrom()); // null
|
||||||
```
|
```
|
||||||
|
|
||||||
#### request.redirectedTo()
|
## request.redirectedTo()
|
||||||
- returns: <[null]|[Request]>
|
- returns: <[null]|[Request]>
|
||||||
|
|
||||||
New request issued by the browser if the server responded with redirect.
|
New request issued by the browser if the server responded with redirect.
|
||||||
|
@ -114,17 +114,17 @@ This method is the opposite of [request.redirectedFrom()](api/class-request.md#r
|
||||||
console.log(request.redirectedFrom().redirectedTo() === request); // true
|
console.log(request.redirectedFrom().redirectedTo() === request); // true
|
||||||
```
|
```
|
||||||
|
|
||||||
#### request.resourceType()
|
## request.resourceType()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
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`.
|
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`.
|
||||||
|
|
||||||
#### request.response()
|
## request.response()
|
||||||
- returns: <[Promise]<[null]|[Response]>>
|
- returns: <[Promise]<[null]|[Response]>>
|
||||||
|
|
||||||
Returns the matching [Response] object, or `null` if the response was not received due to error.
|
Returns the matching [Response] object, or `null` if the response was not received due to error.
|
||||||
|
|
||||||
#### request.timing()
|
## request.timing()
|
||||||
- returns: <[Object]>
|
- returns: <[Object]>
|
||||||
- `startTime` <[number]> Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC
|
- `startTime` <[number]> Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC
|
||||||
- `domainLookupStart` <[number]> Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
|
- `domainLookupStart` <[number]> Time immediately before the browser starts the domain name lookup for the resource. The value is given in milliseconds relative to `startTime`, -1 if not available.
|
||||||
|
@ -146,10 +146,11 @@ const [request] = await Promise.all([
|
||||||
console.log(request.timing());
|
console.log(request.timing());
|
||||||
```
|
```
|
||||||
|
|
||||||
#### request.url()
|
## request.url()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
URL of the request.
|
URL of the request.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-response
|
id: class-response
|
||||||
title: "class: Response"
|
title: "Response"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,62 +19,63 @@ title: "class: Response"
|
||||||
- [response.text()](api/class-response.md#responsetext)
|
- [response.text()](api/class-response.md#responsetext)
|
||||||
- [response.url()](api/class-response.md#responseurl)
|
- [response.url()](api/class-response.md#responseurl)
|
||||||
|
|
||||||
#### response.body()
|
## response.body()
|
||||||
- returns: <[Promise]<[Buffer]>>
|
- returns: <[Promise]<[Buffer]>>
|
||||||
|
|
||||||
Returns the buffer with response body.
|
Returns the buffer with response body.
|
||||||
|
|
||||||
#### response.finished()
|
## response.finished()
|
||||||
- returns: <[Promise]<[null]|[Error]>>
|
- returns: <[Promise]<[null]|[Error]>>
|
||||||
|
|
||||||
Waits for this response to finish, returns failure error if request failed.
|
Waits for this response to finish, returns failure error if request failed.
|
||||||
|
|
||||||
#### response.frame()
|
## response.frame()
|
||||||
- returns: <[Frame]>
|
- returns: <[Frame]>
|
||||||
|
|
||||||
Returns the [Frame] that initiated this response.
|
Returns the [Frame] that initiated this response.
|
||||||
|
|
||||||
#### response.headers()
|
## response.headers()
|
||||||
- returns: <[Object]<[string], [string]>>
|
- returns: <[Object]<[string], [string]>>
|
||||||
|
|
||||||
Returns the object with HTTP headers associated with the response. All header names are lower-case.
|
Returns the object with HTTP headers associated with the response. All header names are lower-case.
|
||||||
|
|
||||||
#### response.json()
|
## response.json()
|
||||||
- returns: <[Promise]<[Serializable]>>
|
- returns: <[Promise]<[Serializable]>>
|
||||||
|
|
||||||
Returns the JSON representation of response body.
|
Returns the JSON representation of response body.
|
||||||
|
|
||||||
This method will throw if the response body is not parsable via `JSON.parse`.
|
This method will throw if the response body is not parsable via `JSON.parse`.
|
||||||
|
|
||||||
#### response.ok()
|
## response.ok()
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
|
Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
|
||||||
|
|
||||||
#### response.request()
|
## response.request()
|
||||||
- returns: <[Request]>
|
- returns: <[Request]>
|
||||||
|
|
||||||
Returns the matching [Request] object.
|
Returns the matching [Request] object.
|
||||||
|
|
||||||
#### response.status()
|
## response.status()
|
||||||
- returns: <[number]>
|
- returns: <[number]>
|
||||||
|
|
||||||
Contains the status code of the response (e.g., 200 for a success).
|
Contains the status code of the response (e.g., 200 for a success).
|
||||||
|
|
||||||
#### response.statusText()
|
## response.statusText()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Contains the status text of the response (e.g. usually an "OK" for a success).
|
Contains the status text of the response (e.g. usually an "OK" for a success).
|
||||||
|
|
||||||
#### response.text()
|
## response.text()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Returns the text representation of response body.
|
Returns the text representation of response body.
|
||||||
|
|
||||||
#### response.url()
|
## response.url()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Contains the URL of the response.
|
Contains the URL of the response.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-route
|
id: class-route
|
||||||
title: "class: Route"
|
title: "Route"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Whenever a network route is set up with [page.route(url, handler)](api/class-pag
|
||||||
- [route.fulfill(response)](api/class-route.md#routefulfillresponse)
|
- [route.fulfill(response)](api/class-route.md#routefulfillresponse)
|
||||||
- [route.request()](api/class-route.md#routerequest)
|
- [route.request()](api/class-route.md#routerequest)
|
||||||
|
|
||||||
#### route.abort([errorCode])
|
## route.abort([errorCode])
|
||||||
- `errorCode` <[string]> Optional error code. Defaults to `failed`, could be one of the following:
|
- `errorCode` <[string]> Optional error code. Defaults to `failed`, could be one of the following:
|
||||||
* `'aborted'` - An operation was aborted (due to user action)
|
* `'aborted'` - An operation was aborted (due to user action)
|
||||||
* `'accessdenied'` - Permission to access a resource, other than the network, was denied
|
* `'accessdenied'` - Permission to access a resource, other than the network, was denied
|
||||||
|
@ -32,7 +32,7 @@ Whenever a network route is set up with [page.route(url, handler)](api/class-pag
|
||||||
|
|
||||||
Aborts the route's request.
|
Aborts the route's request.
|
||||||
|
|
||||||
#### route.continue([overrides])
|
## route.continue([overrides])
|
||||||
- `overrides` <[Object]> Optional request overrides, can override following properties:
|
- `overrides` <[Object]> Optional request overrides, can override following properties:
|
||||||
- `url` <[string]> If set changes the request URL. New URL must have same protocol as original one.
|
- `url` <[string]> If set changes the request URL. New URL must have same protocol as original one.
|
||||||
- `method` <[string]> If set changes the request method (e.g. GET or POST)
|
- `method` <[string]> If set changes the request method (e.g. GET or POST)
|
||||||
|
@ -54,7 +54,7 @@ await page.route('**/*', (route, request) => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### route.fulfill(response)
|
## route.fulfill(response)
|
||||||
- `response` <[Object]> Response that will fulfill this route's request.
|
- `response` <[Object]> Response that will fulfill this route's request.
|
||||||
- `status` <[number]> Response status code, defaults to `200`.
|
- `status` <[number]> Response status code, defaults to `200`.
|
||||||
- `headers` <[Object]<[string], [string]>> Optional response headers. Header values will be converted to a string.
|
- `headers` <[Object]<[string], [string]>> Optional response headers. Header values will be converted to a string.
|
||||||
|
@ -83,10 +83,11 @@ An example of serving static file:
|
||||||
await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));
|
await page.route('**/xhr_endpoint', route => route.fulfill({ path: 'mock_data.json' }));
|
||||||
```
|
```
|
||||||
|
|
||||||
#### route.request()
|
## route.request()
|
||||||
- returns: <[Request]>
|
- returns: <[Request]>
|
||||||
|
|
||||||
A request to be routed.
|
A request to be routed.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-selectors
|
id: class-selectors
|
||||||
title: "class: Selectors"
|
title: "Selectors"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Selectors can be used to install custom selector engines. See [Working with sele
|
||||||
|
|
||||||
- [selectors.register(name, script[, options])](api/class-selectors.md#selectorsregistername-script-options)
|
- [selectors.register(name, script[, options])](api/class-selectors.md#selectorsregistername-script-options)
|
||||||
|
|
||||||
#### selectors.register(name, script[, options])
|
## selectors.register(name, script[, options])
|
||||||
- `name` <[string]> Name that is used in selectors as a prefix, e.g. `{name: 'foo'}` enables `foo=myselectorbody` selectors. May only contain `[a-zA-Z0-9_]` characters.
|
- `name` <[string]> Name that is used in selectors as a prefix, e.g. `{name: 'foo'}` enables `foo=myselectorbody` selectors. May only contain `[a-zA-Z0-9_]` characters.
|
||||||
- `script` <[function]|[string]|[Object]> Script that evaluates to a selector engine instance.
|
- `script` <[function]|[string]|[Object]> Script that evaluates to a selector engine instance.
|
||||||
- `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
- `path` <[string]> Path to the JavaScript file. If `path` is a relative path, then it is resolved relative to the current working directory. Optional.
|
||||||
|
@ -55,6 +55,7 @@ const { selectors, firefox } = require('playwright'); // Or 'chromium' or 'webk
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-timeouterror
|
id: class-timeouterror
|
||||||
title: "class: TimeoutError"
|
title: "TimeoutError"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [Error]
|
* extends: [Error]
|
||||||
|
@ -8,6 +8,7 @@ title: "class: TimeoutError"
|
||||||
TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [page.waitForSelector(selector[, options])](api/class-page.md#pagewaitforselectorselector-options) or [browserType.launch([options])](api/class-browsertype.md#browsertypelaunchoptions).
|
TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [page.waitForSelector(selector[, options])](api/class-page.md#pagewaitforselectorselector-options) or [browserType.launch([options])](api/class-browsertype.md#browsertypelaunchoptions).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-touchscreen
|
id: class-touchscreen
|
||||||
title: "class: Touchscreen"
|
title: "Touchscreen"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,12 +9,13 @@ The Touchscreen class operates in main-frame CSS pixels relative to the top-left
|
||||||
|
|
||||||
- [touchscreen.tap(x, y)](api/class-touchscreen.md#touchscreentapx-y)
|
- [touchscreen.tap(x, y)](api/class-touchscreen.md#touchscreentapx-y)
|
||||||
|
|
||||||
#### touchscreen.tap(x, y)
|
## touchscreen.tap(x, y)
|
||||||
- `x` <[number]>
|
- `x` <[number]>
|
||||||
- `y` <[number]>
|
- `y` <[number]>
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`).
|
Dispatches a `touchstart` and `touchend` event with a single touch at the position (`x`,`y`).
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-video
|
id: class-video
|
||||||
title: "class: Video"
|
title: "Video"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,10 +13,11 @@ console.log(await page.video().path());
|
||||||
|
|
||||||
- [video.path()](api/class-video.md#videopath)
|
- [video.path()](api/class-video.md#videopath)
|
||||||
|
|
||||||
#### video.path()
|
## video.path()
|
||||||
- returns: <[Promise]<[string]>>
|
- returns: <[Promise]<[string]>>
|
||||||
|
|
||||||
Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem upon closing the browser context.
|
Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem upon closing the browser context.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-webkitbrowser
|
id: class-webkitbrowser
|
||||||
title: "class: WebKitBrowser"
|
title: "WebKitBrowser"
|
||||||
---
|
---
|
||||||
|
|
||||||
* extends: [Browser]
|
* extends: [Browser]
|
||||||
|
@ -15,6 +15,7 @@ WebKit browser instance does not expose WebKit-specific features.
|
||||||
- [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions)
|
- [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions)
|
||||||
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
- [browser.newPage([options])](api/class-browser.md#browsernewpageoptions)
|
||||||
- [browser.version()](api/class-browser.md#browserversion)
|
- [browser.version()](api/class-browser.md#browserversion)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-websocket
|
id: class-websocket
|
||||||
title: "class: WebSocket"
|
title: "WebSocket"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,38 +15,38 @@ The [WebSocket] class represents websocket connections in the page.
|
||||||
- [webSocket.url()](api/class-websocket.md#websocketurl)
|
- [webSocket.url()](api/class-websocket.md#websocketurl)
|
||||||
- [webSocket.waitForEvent(event[, optionsOrPredicate])](api/class-websocket.md#websocketwaitforeventevent-optionsorpredicate)
|
- [webSocket.waitForEvent(event[, optionsOrPredicate])](api/class-websocket.md#websocketwaitforeventevent-optionsorpredicate)
|
||||||
|
|
||||||
#### webSocket.on('close')
|
## webSocket.on('close')
|
||||||
|
|
||||||
Fired when the websocket closes.
|
Fired when the websocket closes.
|
||||||
|
|
||||||
#### webSocket.on('framereceived')
|
## webSocket.on('framereceived')
|
||||||
- type: <[Object]>
|
- type: <[Object]>
|
||||||
- `payload` <[string]|[Buffer]> frame payload
|
- `payload` <[string]|[Buffer]> frame payload
|
||||||
|
|
||||||
Fired when the websocket recieves a frame.
|
Fired when the websocket recieves a frame.
|
||||||
|
|
||||||
#### webSocket.on('framesent')
|
## webSocket.on('framesent')
|
||||||
- type: <[Object]>
|
- type: <[Object]>
|
||||||
- `payload` <[string]|[Buffer]> frame payload
|
- `payload` <[string]|[Buffer]> frame payload
|
||||||
|
|
||||||
Fired when the websocket sends a frame.
|
Fired when the websocket sends a frame.
|
||||||
|
|
||||||
#### webSocket.on('socketerror')
|
## webSocket.on('socketerror')
|
||||||
- type: <[String]>
|
- type: <[String]>
|
||||||
|
|
||||||
Fired when the websocket has an error.
|
Fired when the websocket has an error.
|
||||||
|
|
||||||
#### webSocket.isClosed()
|
## webSocket.isClosed()
|
||||||
- returns: <[boolean]>
|
- returns: <[boolean]>
|
||||||
|
|
||||||
Indicates that the web socket has been closed.
|
Indicates that the web socket has been closed.
|
||||||
|
|
||||||
#### webSocket.url()
|
## webSocket.url()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
Contains the URL of the WebSocket.
|
Contains the URL of the WebSocket.
|
||||||
|
|
||||||
#### webSocket.waitForEvent(event[, optionsOrPredicate])
|
## webSocket.waitForEvent(event[, optionsOrPredicate])
|
||||||
- `event` <[string]> Event name, same one would pass into `webSocket.on(event)`.
|
- `event` <[string]> Event name, same one would pass into `webSocket.on(event)`.
|
||||||
- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.
|
- `optionsOrPredicate` <[Function]|[Object]> Either a predicate that receives an event or an options object. Optional.
|
||||||
- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.
|
- `predicate` <[Function]> receives the event data and resolves to truthy value when the waiting should resolve.
|
||||||
|
@ -56,6 +56,7 @@ Contains the URL of the WebSocket.
|
||||||
Returns the event data value.
|
Returns the event data value.
|
||||||
|
|
||||||
Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event is fired.
|
Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event is fired.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
id: class-worker
|
id: class-worker
|
||||||
title: "class: Worker"
|
title: "Worker"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@ for (const worker of page.workers())
|
||||||
- [worker.evaluateHandle(pageFunction[, arg])](api/class-worker.md#workerevaluatehandlepagefunction-arg)
|
- [worker.evaluateHandle(pageFunction[, arg])](api/class-worker.md#workerevaluatehandlepagefunction-arg)
|
||||||
- [worker.url()](api/class-worker.md#workerurl)
|
- [worker.url()](api/class-worker.md#workerurl)
|
||||||
|
|
||||||
#### worker.on('close')
|
## worker.on('close')
|
||||||
- type: <[Worker]>
|
- type: <[Worker]>
|
||||||
|
|
||||||
Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.
|
Emitted when this dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) is terminated.
|
||||||
|
|
||||||
#### worker.evaluate(pageFunction[, arg])
|
## worker.evaluate(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in the worker context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in the worker context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[Serializable]>>
|
- returns: <[Promise]<[Serializable]>>
|
||||||
|
@ -39,7 +39,7 @@ If the function passed to the `worker.evaluate` returns a [Promise], then `worke
|
||||||
|
|
||||||
If the function passed to the `worker.evaluate` returns a non-[Serializable] value, then `worker.evaluate` returns `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.
|
If the function passed to the `worker.evaluate` returns a non-[Serializable] value, then `worker.evaluate` returns `undefined`. DevTools Protocol also supports transferring some additional values that are not serializable by `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.
|
||||||
|
|
||||||
#### worker.evaluateHandle(pageFunction[, arg])
|
## worker.evaluateHandle(pageFunction[, arg])
|
||||||
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
- `pageFunction` <[function]|[string]> Function to be evaluated in the page context
|
||||||
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
- `arg` <[EvaluationArgument]> Optional argument to pass to `pageFunction`
|
||||||
- returns: <[Promise]<[JSHandle]>>
|
- returns: <[Promise]<[JSHandle]>>
|
||||||
|
@ -50,8 +50,9 @@ The only difference between `worker.evaluate` and `worker.evaluateHandle` is tha
|
||||||
|
|
||||||
If the function passed to the `worker.evaluateHandle` returns a [Promise], then `worker.evaluateHandle` would wait for the promise to resolve and return its value.
|
If the function passed to the `worker.evaluateHandle` returns a [Promise], then `worker.evaluateHandle` would wait for the promise to resolve and return its value.
|
||||||
|
|
||||||
#### worker.url()
|
## worker.url()
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -108,6 +108,7 @@ assert(length === 3);
|
||||||
- [elementHandle.$eval(selector, pageFunction[, arg])](api/class-elementhandle.md#elementhandleevalselector-pagefunction-arg)
|
- [elementHandle.$eval(selector, pageFunction[, arg])](api/class-elementhandle.md#elementhandleevalselector-pagefunction-arg)
|
||||||
- [elementHandle.$$eval(selector, pageFunction[, arg])](api/class-elementhandle.md#elementhandleevalselector-pagefunction-arg-1)
|
- [elementHandle.$$eval(selector, pageFunction[, arg])](api/class-elementhandle.md#elementhandleevalselector-pagefunction-arg-1)
|
||||||
- [EvaluationArgument]
|
- [EvaluationArgument]
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -142,6 +142,7 @@ const context = await chromium.launchPersistentContext(userDataDir, { headless:
|
||||||
### API reference
|
### API reference
|
||||||
- [BrowserContext]
|
- [BrowserContext]
|
||||||
- [browserType.launchPersistentContext(userDataDir[, options])](api/class-browsertype.md#browsertypelaunchpersistentcontextuserdatadir-options)
|
- [browserType.launchPersistentContext(userDataDir[, options])](api/class-browsertype.md#browsertypelaunchpersistentcontextuserdatadir-options)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -14,7 +14,7 @@ Playwright tests can be executed in CI environments. We have created sample conf
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
3 steps to get your tests running on CI:
|
3 steps to get your tests running on CI:
|
||||||
1. **Ensure CI agent can run browsers**: Use [our Docker image](docker/README.md) in Linux agents. Windows and macOS agents do not require any additional dependencies.
|
1. **Ensure CI agent can run browsers**: Use [our Docker image](./docker.md) in Linux agents. Windows and macOS agents do not require any additional dependencies.
|
||||||
1. **Install Playwright**: In most projects, this would be done with `npm ci` (or `npm install`). Playwright would install the relevant browsers automatically.
|
1. **Install Playwright**: In most projects, this would be done with `npm ci` (or `npm install`). Playwright would install the relevant browsers automatically.
|
||||||
1. **Run your tests**: Use `npm test` or equivalent to execute your tests.
|
1. **Run your tests**: Use `npm test` or equivalent to execute your tests.
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ We run [our tests](/.github/workflows/tests.yml) on GitHub Actions, across a mat
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
We have a [pre-built Docker image](docker/README.md) which can either be used directly, or as a reference to update your existing Docker definitions.
|
We have a [pre-built Docker image](./docker.md) which can either be used directly, or as a reference to update your existing Docker definitions.
|
||||||
|
|
||||||
Suggested configuration
|
Suggested configuration
|
||||||
1. By default, Docker runs a container with a `/dev/shm` shared memory space 64MB. This is [typically too small](https://github.com/c0b/chrome-in-docker/issues/1) for Chromium and will cause Chromium to crash when rendering large pages. To fix, run the container with `docker run --shm-size=1gb` to increase the size of `/dev/shm`. Since Chromium 65, this is no longer necessary. Instead, launch the browser with the `--disable-dev-shm-usage` flag:
|
1. By default, Docker runs a container with a `/dev/shm` shared memory space 64MB. This is [typically too small](https://github.com/c0b/chrome-in-docker/issues/1) for Chromium and will cause Chromium to crash when rendering large pages. To fix, run the container with `docker run --shm-size=1gb` to increase the size of `/dev/shm`. Since Chromium 65, this is no longer necessary. Instead, launch the browser with the `--disable-dev-shm-usage` flag:
|
||||||
|
@ -55,7 +55,7 @@ Suggested configuration
|
||||||
|
|
||||||
For Windows or macOS agents, no additional configuration required, just install Playwright and run your tests.
|
For Windows or macOS agents, no additional configuration required, just install Playwright and run your tests.
|
||||||
|
|
||||||
For Linux agents, you can use [our Docker container](docker/README.md) with Azure Pipelines support for [running containerized jobs](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops). Alternatively, you can refer to the [Dockerfile](docker/README.md) to see additional dependencies that need to be installed on a Ubuntu agent.
|
For Linux agents, you can use [our Docker container](./docker.md) with Azure Pipelines support for [running containerized jobs](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops). Alternatively, you can refer to the [Dockerfile](./docker.md) to see additional dependencies that need to be installed on a Ubuntu agent.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
pool:
|
pool:
|
||||||
|
@ -122,8 +122,8 @@ before_install:
|
||||||
|
|
||||||
### CircleCI
|
### CircleCI
|
||||||
|
|
||||||
We run our tests on CircleCI, with our [pre-built Docker image](docker/README.md). Running Playwright smoothly on CircleCI requires the following steps:
|
We run our tests on CircleCI, with our [pre-built Docker image](./docker.md). Running Playwright smoothly on CircleCI requires the following steps:
|
||||||
1. Use the pre-built [Docker image](docker/README.md) in your config like so:
|
1. Use the pre-built [Docker image](./docker.md) in your config like so:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
docker:
|
docker:
|
||||||
|
@ -144,7 +144,7 @@ We run our tests on CircleCI, with our [pre-built Docker image](docker/README.md
|
||||||
|
|
||||||
### Jenkins
|
### Jenkins
|
||||||
|
|
||||||
Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image](docker/README.md) to run tests on Jenkins.
|
Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image](./docker.md) to run tests on Jenkins.
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
pipeline {
|
pipeline {
|
||||||
|
@ -162,7 +162,7 @@ pipeline {
|
||||||
|
|
||||||
### Bitbucket Pipelines
|
### Bitbucket Pipelines
|
||||||
|
|
||||||
Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](docker/README.md)).
|
Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.md)).
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
image: mcr.microsoft.com/playwright:bionic
|
image: mcr.microsoft.com/playwright:bionic
|
||||||
|
@ -177,7 +177,7 @@ const browser = await chromium.launch({ chromiumSandbox: false });
|
||||||
|
|
||||||
### GitLab CI
|
### GitLab CI
|
||||||
|
|
||||||
To run Playwright tests on GitLab, use our public Docker image ([see Dockerfile](docker/README.md)).
|
To run Playwright tests on GitLab, use our public Docker image ([see Dockerfile](./docker.md)).
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
stages:
|
stages:
|
||||||
|
@ -238,12 +238,13 @@ const { chromium } = require('playwright');
|
||||||
const browser = await chromium.launch({ headless: false });
|
const browser = await chromium.launch({ headless: false });
|
||||||
```
|
```
|
||||||
|
|
||||||
On Linux agents, headful execution requires [Xvfb](https://en.wikipedia.org/wiki/Xvfb) to be installed. Our [Docker image](docker/README.md) and GitHub Action have Xvfb pre-installed. To run browsers in headful mode with Xvfb, add `xvfb-run` before the Node.js command.
|
On Linux agents, headful execution requires [Xvfb](https://en.wikipedia.org/wiki/Xvfb) to be installed. Our [Docker image](./docker.md) and GitHub Action have Xvfb pre-installed. To run browsers in headful mode with Xvfb, add `xvfb-run` before the Node.js command.
|
||||||
|
|
||||||
```
|
```
|
||||||
xvfb-run node index.js
|
xvfb-run node index.js
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -37,7 +37,7 @@ $ npx playwright codegen wikipedia.org
|
||||||
|
|
||||||
Run `codegen` and perform actions in the browser. Playwright CLI will generate JavaScript code for the user interactions. `codegen` will attempt to generate resilient text-based selectors.
|
Run `codegen` and perform actions in the browser. Playwright CLI will generate JavaScript code for the user interactions. `codegen` will attempt to generate resilient text-based selectors.
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/284612/92536033-7e7ebe00-f1ed-11ea-9e1a-7cbd912e3391.gif">
|
<img src="https://user-images.githubusercontent.com/284612/92536033-7e7ebe00-f1ed-11ea-9e1a-7cbd912e3391.gif"></img>
|
||||||
|
|
||||||
## Open pages
|
## Open pages
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ npx playwright --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --la
|
||||||
|
|
||||||
During `open` or `codegen`, you can use following API inside the developer tools console of any browser.
|
During `open` or `codegen`, you can use following API inside the developer tools console of any browser.
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/284612/92536317-37dd9380-f1ee-11ea-875d-daf1b206dd56.png">
|
<img src="https://user-images.githubusercontent.com/284612/92536317-37dd9380-f1ee-11ea-875d-daf1b206dd56.png"></img>
|
||||||
|
|
||||||
#### playwright.$(selector)
|
#### playwright.$(selector)
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ $ npx playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf
|
||||||
## Known limitations
|
## Known limitations
|
||||||
|
|
||||||
Opening WebKit Web Inspector will disconnect Playwright from the browser. In such cases, code generation will stop.
|
Opening WebKit Web Inspector will disconnect Playwright from the browser. In such cases, code generation will stop.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -376,6 +376,7 @@ await myArrayHandle.dispose();
|
||||||
- [page.$(selector)](api/class-page.md#pageselector)
|
- [page.$(selector)](api/class-page.md#pageselector)
|
||||||
- [page.$$(selector)](api/class-page.md#pageselector-1)
|
- [page.$$(selector)](api/class-page.md#pageselector-1)
|
||||||
- [jsHandle.evaluate(pageFunction[, arg])](api/class-jshandle.md#jshandleevaluatepagefunction-arg)
|
- [jsHandle.evaluate(pageFunction[, arg])](api/class-jshandle.md#jshandleevaluatepagefunction-arg)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -44,7 +44,7 @@ You can use browser developer tools in Chromium, Firefox and WebKit while runnin
|
||||||
* **See console logs** during execution (or learn how to [read logs via API](./verification.md#console-logs))
|
* **See console logs** during execution (or learn how to [read logs via API](./verification.md#console-logs))
|
||||||
* Check **network activity** and other developer tools features
|
* Check **network activity** and other developer tools features
|
||||||
|
|
||||||
<a href="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png"><img src="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png" width="500" alt="Chromium Developer Tools"></a>
|
<a href="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png"><img src="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png" width="500" alt="Chromium Developer Tools"></img></a>
|
||||||
|
|
||||||
> **For WebKit**: Note that launching WebKit Inspector during the execution will prevent the Playwright script from executing any further.
|
> **For WebKit**: Note that launching WebKit Inspector during the execution will prevent the Playwright script from executing any further.
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ PWDEBUG configures a `playwright` object in the browser to highlight [Playwright
|
||||||
* `playwright.inspect(selector)`: Inspect the selector in the Elements panel.
|
* `playwright.inspect(selector)`: Inspect the selector in the Elements panel.
|
||||||
* `playwright.clear()`: Clear existing highlights.
|
* `playwright.clear()`: Clear existing highlights.
|
||||||
|
|
||||||
<a href="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png"><img src="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png" width="500" alt="Highlight selectors"></a>
|
<a href="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png"><img src="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png" width="500" alt="Highlight selectors"></img></a>
|
||||||
|
|
||||||
### Evaluate Source Maps
|
### Evaluate Source Maps
|
||||||
|
|
||||||
PWDEBUG also enables source maps for [`page.evaluate` executions](core-concepts.md#evaluation). This improves the debugging experience for JavaScript executions in the page context.
|
PWDEBUG also enables source maps for [`page.evaluate` executions](core-concepts.md#evaluation). This improves the debugging experience for JavaScript executions in the page context.
|
||||||
|
|
||||||
<a href="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png"><img src="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png" width="500" alt="Highlight selectors"></a>
|
<a href="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png"><img src="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png" width="500" alt="Highlight selectors"></img></a>
|
||||||
|
|
||||||
## Verbose API logs
|
## Verbose API logs
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ $ set DEBUG=pw:api
|
||||||
$ npm run test
|
$ npm run test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -0,0 +1,169 @@
|
||||||
|
---
|
||||||
|
id: docker
|
||||||
|
title: "Docker"
|
||||||
|
---
|
||||||
|
|
||||||
|
[Dockerfile.bionic](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.bionic) and [Dockerfile.focal](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.focal) can be used to run Playwright scripts in Docker environments. These images includes all the dependencies needed to run browsers in a Docker container, including browsers.
|
||||||
|
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Image tags](#image-tags)
|
||||||
|
- [Development](#development)
|
||||||
|
- [Base images](#base-images)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
[](https://hub.docker.com/_/microsoft-playwright)
|
||||||
|
|
||||||
|
This image is published on [Docker Hub](https://hub.docker.com/_/microsoft-playwright).
|
||||||
|
|
||||||
|
### Pull the image
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker pull mcr.microsoft.com/playwright:bionic
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run the image
|
||||||
|
|
||||||
|
By default, the Docker image will use the `root` user to run the browsers. This will disable the Chromium sandbox which is not available with root. If you run trusted code (e.g. End-to-end tests) and want to avoid the hassle of managing separate user then the root user may be fine. For web scraping or crawling, we recommend to create a separate user inside the Docker container and use the seccomp profile.
|
||||||
|
|
||||||
|
#### End-to-end tests
|
||||||
|
|
||||||
|
On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:bionic /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Crawling and scraping
|
||||||
|
|
||||||
|
On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:bionic /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
[`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/master/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"comment": "Allow create user namespaces",
|
||||||
|
"names": [
|
||||||
|
"clone",
|
||||||
|
"setns",
|
||||||
|
"unshare"
|
||||||
|
],
|
||||||
|
"action": "SCMP_ACT_ALLOW",
|
||||||
|
"args": [],
|
||||||
|
"includes": {},
|
||||||
|
"excludes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
> **NOTE**: Using `--ipc=host` is recommended when using Chrome ([Docker docs](https://docs.docker.com/engine/reference/run/#ipc-settings---ipc)). Chrome can run out of memory without this flag.
|
||||||
|
|
||||||
|
### Using on CI
|
||||||
|
|
||||||
|
See our [Continuous Integration guides](./ci.md) for sample configs.
|
||||||
|
|
||||||
|
## Image tags
|
||||||
|
|
||||||
|
See [all available image tags](https://mcr.microsoft.com/v2/playwright/tags/list).
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Build the image
|
||||||
|
|
||||||
|
Use [`//utils/docker/build.sh`](https://github.com/microsoft/playwright/blob/master/utils/docker/build.sh) to build the image.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./utils/docker/build.sh bionic playwright:localbuild-bionic
|
||||||
|
```
|
||||||
|
|
||||||
|
The image will be tagged as `playwright:localbuild-bionic` and could be run as:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker run --rm -it playwright:localbuild /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
|
### Push
|
||||||
|
|
||||||
|
Docker images are published automatically by GitHub Actions. We currently publish the following images:
|
||||||
|
- `mcr.microsoft.com/playwright:next` - tip-of-tree image version.
|
||||||
|
- `mcr.microsoft.com/playwright:bionic` - last Playwright release docker image.
|
||||||
|
- `mcr.microsoft.com/playwright:sha-XXXXXXX` - docker image for every commit that changed docker files or browsers, marked with a [short sha](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Short-SHA-1) (first 7 digits of the SHA commit).
|
||||||
|
|
||||||
|
Status of push to MCR can be [verified here](https://mcrflow-status-ui.azurewebsites.net/) (internal link).
|
||||||
|
|
||||||
|
## Base images
|
||||||
|
|
||||||
|
### Ubuntu 20
|
||||||
|
|
||||||
|
`mcr.microsoft.com/playwright:focal` is based on Ubuntu 20.04 LTS (Focal Fossa).
|
||||||
|
|
||||||
|
### Ubuntu 18
|
||||||
|
|
||||||
|
`mcr.microsoft.com/playwright:bionic` is based on Ubuntu 18.04 LTS (Bionic Beaver).
|
||||||
|
|
||||||
|
### Alpine
|
||||||
|
|
||||||
|
Browser builds for Firefox and WebKit are built for the [glibc](https://en.wikipedia.org/wiki/GNU_C_Library) library. Alpine Linux and other distributions that are based on the [musl](https://en.wikipedia.org/wiki/Musl) standard library are not supported.
|
||||||
|
|
||||||
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
|
[Browser]: api/class-browser.md "Browser"
|
||||||
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
||||||
|
[Page]: api/class-page.md "Page"
|
||||||
|
[Frame]: api/class-frame.md "Frame"
|
||||||
|
[ElementHandle]: api/class-elementhandle.md "ElementHandle"
|
||||||
|
[JSHandle]: api/class-jshandle.md "JSHandle"
|
||||||
|
[ConsoleMessage]: api/class-consolemessage.md "ConsoleMessage"
|
||||||
|
[Dialog]: api/class-dialog.md "Dialog"
|
||||||
|
[Download]: api/class-download.md "Download"
|
||||||
|
[Video]: api/class-video.md "Video"
|
||||||
|
[FileChooser]: api/class-filechooser.md "FileChooser"
|
||||||
|
[Keyboard]: api/class-keyboard.md "Keyboard"
|
||||||
|
[Mouse]: api/class-mouse.md "Mouse"
|
||||||
|
[Touchscreen]: api/class-touchscreen.md "Touchscreen"
|
||||||
|
[Request]: api/class-request.md "Request"
|
||||||
|
[Response]: api/class-response.md "Response"
|
||||||
|
[Selectors]: api/class-selectors.md "Selectors"
|
||||||
|
[Route]: api/class-route.md "Route"
|
||||||
|
[WebSocket]: api/class-websocket.md "WebSocket"
|
||||||
|
[TimeoutError]: api/class-timeouterror.md "TimeoutError"
|
||||||
|
[Accessibility]: api/class-accessibility.md "Accessibility"
|
||||||
|
[Worker]: api/class-worker.md "Worker"
|
||||||
|
[BrowserServer]: api/class-browserserver.md "BrowserServer"
|
||||||
|
[BrowserType]: api/class-browsertype.md "BrowserType"
|
||||||
|
[Logger]: api/class-logger.md "Logger"
|
||||||
|
[ChromiumBrowser]: api/class-chromiumbrowser.md "ChromiumBrowser"
|
||||||
|
[ChromiumBrowserContext]: api/class-chromiumbrowsercontext.md "ChromiumBrowserContext"
|
||||||
|
[ChromiumCoverage]: api/class-chromiumcoverage.md "ChromiumCoverage"
|
||||||
|
[CDPSession]: api/class-cdpsession.md "CDPSession"
|
||||||
|
[FirefoxBrowser]: api/class-firefoxbrowser.md "FirefoxBrowser"
|
||||||
|
[WebKitBrowser]: api/class-webkitbrowser.md "WebKitBrowser"
|
||||||
|
[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array"
|
||||||
|
[Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer"
|
||||||
|
[ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess"
|
||||||
|
[Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element"
|
||||||
|
[Error]: https://nodejs.org/api/errors.html#errors_class_error "Error"
|
||||||
|
[Evaluation Argument]: ./core-concepts.md#evaluationargument "Evaluation Argument"
|
||||||
|
[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map"
|
||||||
|
[Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object"
|
||||||
|
[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise"
|
||||||
|
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp"
|
||||||
|
[Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable"
|
||||||
|
[UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail"
|
||||||
|
[URL]: https://nodejs.org/api/url.html "URL"
|
||||||
|
[USKeyboardLayout]: ../src/usKeyboardLayout.ts "USKeyboardLayout"
|
||||||
|
[UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time"
|
||||||
|
[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean"
|
||||||
|
[function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function"
|
||||||
|
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator"
|
||||||
|
[null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null"
|
||||||
|
[number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number"
|
||||||
|
[origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin"
|
||||||
|
[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector"
|
||||||
|
[Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable"
|
||||||
|
[string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string"
|
||||||
|
[xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath"
|
|
@ -182,6 +182,7 @@ await page.emulateMedia({ media: 'print' });
|
||||||
#### API reference
|
#### API reference
|
||||||
- [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions)
|
- [browser.newContext([options])](api/class-browser.md#browsernewcontextoptions)
|
||||||
- [page.emulateMedia(params)](api/class-page.md#pageemulatemediaparams)
|
- [page.emulateMedia(params)](api/class-page.md#pageemulatemediaparams)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -45,6 +45,7 @@ await page.click('tag=div >> span >> "Click me"');
|
||||||
const buttonCount = await page.$$eval('tag=button', buttons => buttons.length);
|
const buttonCount = await page.$$eval('tag=button', buttons => buttons.length);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -246,7 +246,7 @@ You can select input files for upload using the `page.setInputFiles` method. It
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
[This script](examples/upload.js) uploads a file to an `input` element that accepts file uploads.
|
[This script](https://github.com/microsoft/playwright/blob/master/utils/docs/examples/upload.js) uploads a file to an `input` element that accepts file uploads.
|
||||||
|
|
||||||
#### API reference
|
#### API reference
|
||||||
- [page.setInputFiles(selector, files[, options])](api/class-page.md#pagesetinputfilesselector-files-options)
|
- [page.setInputFiles(selector, files[, options])](api/class-page.md#pagesetinputfilesselector-files-options)
|
||||||
|
@ -269,6 +269,7 @@ await page.focus('input#name');
|
||||||
- [elementHandle.focus()](api/class-elementhandle.md#elementhandlefocus)
|
- [elementHandle.focus()](api/class-elementhandle.md#elementhandlefocus)
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -63,12 +63,8 @@ $ npm i -D playwright
|
||||||
|
|
||||||
Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions.
|
Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions.
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
> **NOTE** Developers can opt-in in this mode via exporting `PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers` in their `.bashrc`.
|
> **NOTE** Developers can opt-in in this mode via exporting `PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers` in their `.bashrc`.
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Download from artifact repository
|
## Download from artifact repository
|
||||||
|
|
||||||
By default, Playwright downloads browsers from Microsoft and Google public CDNs.
|
By default, Playwright downloads browsers from Microsoft and Google public CDNs.
|
||||||
|
@ -91,8 +87,6 @@ It is also possible to use a per-browser download hosts using `PLAYWRIGHT_CHROMI
|
||||||
$ PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright
|
$ PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Skip browser downloads
|
## Skip browser downloads
|
||||||
|
|
||||||
In certain cases, it is desired to avoid browser downloads altogether because browser binaries are managed separately.
|
In certain cases, it is desired to avoid browser downloads altogether because browser binaries are managed separately.
|
||||||
|
@ -108,8 +102,6 @@ $ set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||||
$ npm i -D playwright
|
$ npm i -D playwright
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Download single browser binary
|
## Download single browser binary
|
||||||
|
|
||||||
Playwright ships three packages that bundle only a single browser:
|
Playwright ships three packages that bundle only a single browser:
|
||||||
|
@ -139,6 +131,7 @@ const { webkit } = require('playwright-webkit');
|
||||||
})();
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -108,7 +108,8 @@ Playwright requires Node.js version 10.17 or above. The browser binaries for Chr
|
||||||
* **macOS**: Requires 10.14 or above.
|
* **macOS**: Requires 10.14 or above.
|
||||||
* **Linux**: Depending on your Linux distribution, you might need to install additional dependencies to run the browsers.
|
* **Linux**: Depending on your Linux distribution, you might need to install additional dependencies to run the browsers.
|
||||||
* Firefox requires Ubuntu 18.04+
|
* Firefox requires Ubuntu 18.04+
|
||||||
* For Ubuntu 18.04, the additional dependencies are defined in [our Docker image](docker/Dockerfile.bionic), which is based on Ubuntu.
|
* For Ubuntu 18.04, the additional dependencies are defined in [our Docker image](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.bionic), which is based on Ubuntu.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -54,6 +54,7 @@ go get github.com/mxschmitt/playwright-go
|
||||||
|
|
||||||
* [GitHub repo](https://github.com/mxschmitt/playwright-go)
|
* [GitHub repo](https://github.com/mxschmitt/playwright-go)
|
||||||
* [Documentation](https://pkg.go.dev/github.com/mxschmitt/playwright-go?tab=doc)
|
* [Documentation](https://pkg.go.dev/github.com/mxschmitt/playwright-go?tab=doc)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -42,6 +42,7 @@ const { _clank } = require('playwright');
|
||||||
- Passing `viewport: null` is necessary to make sure resolution is not emulated.
|
- Passing `viewport: null` is necessary to make sure resolution is not emulated.
|
||||||
- Device needs to be awake to produce screenshots. Enabling "Stay awake" developer mode will help.
|
- Device needs to be awake to produce screenshots. Enabling "Stay awake" developer mode will help.
|
||||||
- We didn't run all the tests against the device, so not everything works.
|
- We didn't run all the tests against the device, so not everything works.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -109,6 +109,7 @@ page.on('popup', async popup => {
|
||||||
|
|
||||||
#### API reference
|
#### API reference
|
||||||
- [page.on('popup')](api/class-page.md#pageonpopup)
|
- [page.on('popup')](api/class-page.md#pageonpopup)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -170,6 +170,7 @@ await page.screenshot();
|
||||||
|
|
||||||
#### API reference
|
#### API reference
|
||||||
- [page.waitForFunction(pageFunction[, arg, options])](api/class-page.md#pagewaitforfunctionpagefunction-arg-options)
|
- [page.waitForFunction(pageFunction[, arg, options])](api/class-page.md#pagewaitforfunctionpagefunction-arg-options)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -187,6 +187,7 @@ await page.route('**/*', route => {
|
||||||
- [route.abort([errorCode])](api/class-route.md#routeaborterrorcode)
|
- [route.abort([errorCode])](api/class-route.md#routeaborterrorcode)
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -52,6 +52,7 @@ await searchPage.search('search query');
|
||||||
|
|
||||||
### API reference
|
### API reference
|
||||||
- [Page]
|
- [Page]
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -350,6 +350,7 @@ Attribute engines are selecting based on the corresponding attribute value. For
|
||||||
[text]: #text-and-textlight
|
[text]: #text-and-textlight
|
||||||
[xpath]: #xpath
|
[xpath]: #xpath
|
||||||
[id]: #id-data-testid-data-test-id-data-test-and-their-light-counterparts
|
[id]: #id-data-testid-data-test-id-data-test-and-their-light-counterparts
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -53,6 +53,7 @@ title: "Community Showcase"
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Did we miss something in this list? Send us a PR!
|
Did we miss something in this list? Send us a PR!
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -38,8 +38,6 @@ it('should work', async () => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## AVA
|
## AVA
|
||||||
|
|
||||||
Tests run concurrently in AVA, so a single page variable cannot be shared between tests. Instead, create new pages with a macro function.
|
Tests run concurrently in AVA, so a single page variable cannot be shared between tests. Instead, create new pages with a macro function.
|
||||||
|
@ -65,8 +63,6 @@ test('should work', pageMacro, async (t, page) => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Mocha
|
## Mocha
|
||||||
|
|
||||||
Mocha looks very similar to the Jest/Jasmine setup, and functions in the same way.
|
Mocha looks very similar to the Jest/Jasmine setup, and functions in the same way.
|
||||||
|
@ -95,8 +91,6 @@ it('should work', async () => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Multiple Browsers
|
## Multiple Browsers
|
||||||
|
|
||||||
These simple examples can be extended to support multiple browsers using an environment variable.
|
These simple examples can be extended to support multiple browsers using an environment variable.
|
||||||
|
@ -111,6 +105,7 @@ beforeAll(async() => {
|
||||||
```
|
```
|
||||||
|
|
||||||
Then set `BROWSER=firefox` to run your tests with firefox, or any other browser.
|
Then set `BROWSER=firefox` to run your tests with firefox, or any other browser.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -12,7 +12,7 @@ title: "Troubleshooting"
|
||||||
|
|
||||||
Playwright does self-inspection every time it runs to make sure the browsers can be launched successfully. If there are missing dependencies, playwright will print instructions to acquire them.
|
Playwright does self-inspection every time it runs to make sure the browsers can be launched successfully. If there are missing dependencies, playwright will print instructions to acquire them.
|
||||||
|
|
||||||
We also provide [Ubuntu 18.04 dockerfile](docker/Dockerfile.bionic) and [Ubuntu 20.04 dockerfile](docker/Dockerfile.focal) with the list of Debian dependencies.
|
We also provide [Ubuntu 18.04 dockerfile](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.bionic) and [Ubuntu 20.04 dockerfile](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.focal) with the list of Debian dependencies.
|
||||||
|
|
||||||
## Code transpilation issues
|
## Code transpilation issues
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ Playwright requires Node.js 10 or higher. Node.js 8 is not supported, and will c
|
||||||
# Please file an issue
|
# Please file an issue
|
||||||
|
|
||||||
Playwright is a new project, and we are watching the issues very closely. As we solve common issues, this document will grow to include the common answers.
|
Playwright is a new project, and we are watching the issues very closely. As we solve common issues, this document will grow to include the common answers.
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -150,6 +150,7 @@ const [popup] = await Promise.all([
|
||||||
- [page.on('requestfailed')](api/class-page.md#pageonrequestfailed)
|
- [page.on('requestfailed')](api/class-page.md#pageonrequestfailed)
|
||||||
- [page.on('dialog')](api/class-page.md#pageondialog)
|
- [page.on('dialog')](api/class-page.md#pageondialog)
|
||||||
- [page.on('popup')](api/class-page.md#pageonpopup)
|
- [page.on('popup')](api/class-page.md#pageonpopup)
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -34,12 +34,13 @@ Playwright enables fast, reliable and capable automation across all modern brows
|
||||||
* **TypeScript support**. Playwright ships with built-in types for auto-completion and other benefits.
|
* **TypeScript support**. Playwright ships with built-in types for auto-completion and other benefits.
|
||||||
* **Debugging tools**. Playwright works with the [editor debugger and browser developer tools](./debug.md) to pause execution and inspect the web page.
|
* **Debugging tools**. Playwright works with the [editor debugger and browser developer tools](./debug.md) to pause execution and inspect the web page.
|
||||||
* **Language bindings**. Playwright is also available in [Python](https://github.com/microsoft/playwright-python) and [C#](https://github.com/microsoft/playwright-sharp). Learn about [supported languages](./languages.md).
|
* **Language bindings**. Playwright is also available in [Python](https://github.com/microsoft/playwright-python) and [C#](https://github.com/microsoft/playwright-sharp). Learn about [supported languages](./languages.md).
|
||||||
* **Deploy tests to CI**. First-party [Docker image](docker/README.md) and [GitHub Actions](https://github.com/microsoft/playwright-github-action) to deploy tests to [your preferred CI/CD provider](./ci.md).
|
* **Deploy tests to CI**. First-party [Docker image](./docker.md) and [GitHub Actions](https://github.com/microsoft/playwright-github-action) to deploy tests to [your preferred CI/CD provider](./ci.md).
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
* **Legacy Edge and IE11 support**. Playwright does not support legacy Microsoft Edge or IE11 ([deprecation notice](https://techcommunity.microsoft.com/t5/microsoft-365-blog/microsoft-365-apps-say-farewell-to-internet-explorer-11-and/ba-p/1591666)). The new Microsoft Edge (on Chromium) is supported.
|
* **Legacy Edge and IE11 support**. Playwright does not support legacy Microsoft Edge or IE11 ([deprecation notice](https://techcommunity.microsoft.com/t5/microsoft-365-blog/microsoft-365-apps-say-farewell-to-internet-explorer-11-and/ba-p/1591666)). The new Microsoft Edge (on Chromium) is supported.
|
||||||
* **Java language bindings**: The Playwright API cannot be used in Java or Ruby today. This is a temporary limitation as Playwright is built to support bindings for any language.
|
* **Java language bindings**: The Playwright API cannot be used in Java or Ruby today. This is a temporary limitation as Playwright is built to support bindings for any language.
|
||||||
* **Test on real mobile devices**: Playwright uses desktop browsers to emulate mobile devices. If you are interested in running on real mobile devices, please [upvote this issue](https://github.com/microsoft/playwright/issues/1122).
|
* **Test on real mobile devices**: Playwright uses desktop browsers to emulate mobile devices. If you are interested in running on real mobile devices, please [upvote this issue](https://github.com/microsoft/playwright/issues/1122).
|
||||||
|
|
||||||
[Playwright]: api/class-playwright.md "Playwright"
|
[Playwright]: api/class-playwright.md "Playwright"
|
||||||
[Browser]: api/class-browser.md "Browser"
|
[Browser]: api/class-browser.md "Browser"
|
||||||
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
[BrowserContext]: api/class-browsercontext.md "BrowserContext"
|
|
@ -40,10 +40,10 @@ Playwright is a library to automate [Chromium](https://www.chromium.org/Home), [
|
||||||
- [Page object models](./pom.md)
|
- [Page object models](./pom.md)
|
||||||
1. Integrations
|
1. Integrations
|
||||||
- [Test runners](./test-runners.md)
|
- [Test runners](./test-runners.md)
|
||||||
- [Docker](./docker/README.md)
|
- [Docker](././docker.md)
|
||||||
- [Continuous integration](./ci.md)
|
- [Continuous integration](./ci.md)
|
||||||
1. Reference
|
1. Reference
|
||||||
- [API Reference](./api.md)
|
- [API Reference](./api/class-playwright.md)
|
||||||
- [Actionability](./actionability.md)
|
- [Actionability](./actionability.md)
|
||||||
- [Advanced installation](./installation.md)
|
- [Advanced installation](./installation.md)
|
||||||
- [Extensibility](./extensibility.md)
|
- [Extensibility](./extensibility.md)
|
|
@ -11,13 +11,13 @@ Some actions like `page.click()` support `{force: true}` option that disable non
|
||||||
|
|
||||||
| Actions | Performed checks |
|
| Actions | Performed checks |
|
||||||
| ------ | ------- |
|
| ------ | ------- |
|
||||||
| `check()`<br>`click()`<br>`dblclick()`<br>`tap()`<br>`uncheck()` | [Visible]<br>[Stable]<br>[Enabled]<br>[Receiving Events]<br>[Attached] |
|
| `check()`<br></br>`click()`<br></br>`dblclick()`<br></br>`tap()`<br></br>`uncheck()` | [Visible]<br></br>[Stable]<br></br>[Enabled]<br></br>[Receiving Events]<br></br>[Attached] |
|
||||||
| `hover()` | [Visible]<br>[Stable]<br>[Receiving Events]<br>[Attached] |
|
| `hover()` | [Visible]<br></br>[Stable]<br></br>[Receiving Events]<br></br>[Attached] |
|
||||||
| `fill()` | [Visible]<br>[Enabled]<br>[Editable]<br>[Attached] |
|
| `fill()` | [Visible]<br></br>[Enabled]<br></br>[Editable]<br></br>[Attached] |
|
||||||
| `dispatchEvent()`<br>`focus()`<br>`press()`<br>`setInputFiles()`<br>`selectOption()`<br>`type()` | [Attached] |
|
| `dispatchEvent()`<br></br>`focus()`<br></br>`press()`<br></br>`setInputFiles()`<br></br>`selectOption()`<br></br>`type()` | [Attached] |
|
||||||
| `scrollIntoViewIfNeeded()`<br>`screenshot()` | [Visible]<br>[Stable]<br>[Attached] |
|
| `scrollIntoViewIfNeeded()`<br></br>`screenshot()` | [Visible]<br></br>[Stable]<br></br>[Attached] |
|
||||||
| `selectText()` | [Visible]<br>[Attached] |
|
| `selectText()` | [Visible]<br></br>[Attached] |
|
||||||
| `getAttribute()`<br>`innerText()`<br>`innerHTML()`<br>`textContent()` | [Attached] |
|
| `getAttribute()`<br></br>`innerText()`<br></br>`innerHTML()`<br></br>`textContent()` | [Attached] |
|
||||||
|
|
||||||
### Visible
|
### Visible
|
||||||
|
|
|
@ -12,7 +12,7 @@ configurations for common CI providers.
|
||||||
|
|
||||||
3 steps to get your tests running on CI:
|
3 steps to get your tests running on CI:
|
||||||
|
|
||||||
1. **Ensure CI agent can run browsers**: Use [our Docker image](docker/README.md)
|
1. **Ensure CI agent can run browsers**: Use [our Docker image](./docker.md)
|
||||||
in Linux agents. Windows and macOS agents do not require any additional dependencies.
|
in Linux agents. Windows and macOS agents do not require any additional dependencies.
|
||||||
1. **Install Playwright**: In most projects, this would be done with `npm ci`
|
1. **Install Playwright**: In most projects, this would be done with `npm ci`
|
||||||
(or `npm install`). Playwright would install the relevant browsers automatically.
|
(or `npm install`). Playwright would install the relevant browsers automatically.
|
||||||
|
@ -35,7 +35,7 @@ We run [our tests](/.github/workflows/tests.yml) on GitHub Actions, across a mat
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
We have a [pre-built Docker image](docker/README.md) which can either be used directly, or as a reference to update your existing Docker definitions.
|
We have a [pre-built Docker image](./docker.md) which can either be used directly, or as a reference to update your existing Docker definitions.
|
||||||
|
|
||||||
Suggested configuration
|
Suggested configuration
|
||||||
1. By default, Docker runs a container with a `/dev/shm` shared memory space 64MB.
|
1. By default, Docker runs a container with a `/dev/shm` shared memory space 64MB.
|
||||||
|
@ -65,7 +65,7 @@ Suggested configuration
|
||||||
|
|
||||||
For Windows or macOS agents, no additional configuration required, just install Playwright and run your tests.
|
For Windows or macOS agents, no additional configuration required, just install Playwright and run your tests.
|
||||||
|
|
||||||
For Linux agents, you can use [our Docker container](docker/README.md) with Azure Pipelines support for [running containerized jobs](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops). Alternatively, you can refer to the [Dockerfile](docker/README.md) to see additional dependencies that need to be installed on a Ubuntu agent.
|
For Linux agents, you can use [our Docker container](./docker.md) with Azure Pipelines support for [running containerized jobs](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops). Alternatively, you can refer to the [Dockerfile](./docker.md) to see additional dependencies that need to be installed on a Ubuntu agent.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
pool:
|
pool:
|
||||||
|
@ -136,9 +136,9 @@ before_install:
|
||||||
|
|
||||||
### CircleCI
|
### CircleCI
|
||||||
|
|
||||||
We run our tests on CircleCI, with our [pre-built Docker image](docker/README.md). Running Playwright smoothly on CircleCI requires the following steps:
|
We run our tests on CircleCI, with our [pre-built Docker image](./docker.md). Running Playwright smoothly on CircleCI requires the following steps:
|
||||||
|
|
||||||
1. Use the pre-built [Docker image](docker/README.md) in your config like so:
|
1. Use the pre-built [Docker image](./docker.md) in your config like so:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
docker:
|
docker:
|
||||||
|
@ -159,7 +159,7 @@ We run our tests on CircleCI, with our [pre-built Docker image](docker/README.md
|
||||||
|
|
||||||
### Jenkins
|
### Jenkins
|
||||||
|
|
||||||
Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image](docker/README.md)
|
Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image](./docker.md)
|
||||||
to run tests on Jenkins.
|
to run tests on Jenkins.
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
|
@ -178,7 +178,7 @@ pipeline {
|
||||||
|
|
||||||
### Bitbucket Pipelines
|
### Bitbucket Pipelines
|
||||||
|
|
||||||
Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](docker/README.md)).
|
Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.md)).
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
image: mcr.microsoft.com/playwright:bionic
|
image: mcr.microsoft.com/playwright:bionic
|
||||||
|
@ -193,7 +193,7 @@ const browser = await chromium.launch({ chromiumSandbox: false });
|
||||||
|
|
||||||
### GitLab CI
|
### GitLab CI
|
||||||
|
|
||||||
To run Playwright tests on GitLab, use our public Docker image ([see Dockerfile](docker/README.md)).
|
To run Playwright tests on GitLab, use our public Docker image ([see Dockerfile](./docker.md)).
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
stages:
|
stages:
|
||||||
|
@ -267,7 +267,7 @@ const { chromium } = require('playwright');
|
||||||
const browser = await chromium.launch({ headless: false });
|
const browser = await chromium.launch({ headless: false });
|
||||||
```
|
```
|
||||||
|
|
||||||
On Linux agents, headful execution requires [Xvfb](https://en.wikipedia.org/wiki/Xvfb) to be installed. Our [Docker image](docker/README.md) and GitHub Action have Xvfb pre-installed. To run browsers in headful mode with Xvfb, add `xvfb-run` before the Node.js command.
|
On Linux agents, headful execution requires [Xvfb](https://en.wikipedia.org/wiki/Xvfb) to be installed. Our [Docker image](./docker.md) and GitHub Action have Xvfb pre-installed. To run browsers in headful mode with Xvfb, add `xvfb-run` before the Node.js command.
|
||||||
|
|
||||||
```
|
```
|
||||||
xvfb-run node index.js
|
xvfb-run node index.js
|
|
@ -30,7 +30,7 @@ $ npx playwright codegen wikipedia.org
|
||||||
|
|
||||||
Run `codegen` and perform actions in the browser. Playwright CLI will generate JavaScript code for the user interactions. `codegen` will attempt to generate resilient text-based selectors.
|
Run `codegen` and perform actions in the browser. Playwright CLI will generate JavaScript code for the user interactions. `codegen` will attempt to generate resilient text-based selectors.
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/284612/92536033-7e7ebe00-f1ed-11ea-9e1a-7cbd912e3391.gif">
|
<img src="https://user-images.githubusercontent.com/284612/92536033-7e7ebe00-f1ed-11ea-9e1a-7cbd912e3391.gif"></img>
|
||||||
|
|
||||||
## Open pages
|
## Open pages
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ npx playwright --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --la
|
||||||
## Inspect selectors
|
## Inspect selectors
|
||||||
During `open` or `codegen`, you can use following API inside the developer tools console of any browser.
|
During `open` or `codegen`, you can use following API inside the developer tools console of any browser.
|
||||||
|
|
||||||
<img src="https://user-images.githubusercontent.com/284612/92536317-37dd9380-f1ee-11ea-875d-daf1b206dd56.png">
|
<img src="https://user-images.githubusercontent.com/284612/92536317-37dd9380-f1ee-11ea-875d-daf1b206dd56.png"></img>
|
||||||
|
|
||||||
#### playwright.$(selector)
|
#### playwright.$(selector)
|
||||||
|
|
|
@ -53,7 +53,7 @@ a Playwright script. Developer tools help to:
|
||||||
* **See console logs** during execution (or learn how to [read logs via API](./verification.md#console-logs))
|
* **See console logs** during execution (or learn how to [read logs via API](./verification.md#console-logs))
|
||||||
* Check **network activity** and other developer tools features
|
* Check **network activity** and other developer tools features
|
||||||
|
|
||||||
<a href="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png"><img src="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png" width="500" alt="Chromium Developer Tools"></a>
|
<a href="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png"><img src="https://user-images.githubusercontent.com/284612/77234134-5f21a500-6b69-11ea-92ec-1c146e1333ec.png" width="500" alt="Chromium Developer Tools"></img></a>
|
||||||
|
|
||||||
> **For WebKit**: Note that launching WebKit Inspector during the execution will
|
> **For WebKit**: Note that launching WebKit Inspector during the execution will
|
||||||
prevent the Playwright script from executing any further.
|
prevent the Playwright script from executing any further.
|
||||||
|
@ -105,14 +105,14 @@ composite selectors. To use this:
|
||||||
* `playwright.inspect(selector)`: Inspect the selector in the Elements panel.
|
* `playwright.inspect(selector)`: Inspect the selector in the Elements panel.
|
||||||
* `playwright.clear()`: Clear existing highlights.
|
* `playwright.clear()`: Clear existing highlights.
|
||||||
|
|
||||||
<a href="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png"><img src="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png" width="500" alt="Highlight selectors"></a>
|
<a href="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png"><img src="https://user-images.githubusercontent.com/284612/86857345-299abc00-c073-11ea-9e31-02923a9f0d4b.png" width="500" alt="Highlight selectors"></img></a>
|
||||||
|
|
||||||
### Evaluate Source Maps
|
### Evaluate Source Maps
|
||||||
|
|
||||||
PWDEBUG also enables source maps for [`page.evaluate` executions](core-concepts.md#evaluation).
|
PWDEBUG also enables source maps for [`page.evaluate` executions](core-concepts.md#evaluation).
|
||||||
This improves the debugging experience for JavaScript executions in the page context.
|
This improves the debugging experience for JavaScript executions in the page context.
|
||||||
|
|
||||||
<a href="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png"><img src="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png" width="500" alt="Highlight selectors"></a>
|
<a href="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png"><img src="https://user-images.githubusercontent.com/284612/86857568-a6c63100-c073-11ea-82a4-bfd531a4ec87.png" width="500" alt="Highlight selectors"></img></a>
|
||||||
|
|
||||||
## Verbose API logs
|
## Verbose API logs
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
# Running Playwright in Docker
|
---
|
||||||
|
id: docker
|
||||||
|
title: "Docker"
|
||||||
|
---
|
||||||
|
|
||||||
[Dockerfile.bionic](Dockerfile.bionic) and [Dockerfile.focal](Dockerfile.focal) can be used to run Playwright scripts in Docker environments. These images includes all the dependencies needed to run browsers in a Docker container, including browsers.
|
[Dockerfile.bionic](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.bionic) and [Dockerfile.focal](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.focal) can be used to run Playwright scripts in Docker environments. These images includes all the dependencies needed to run browsers in a Docker container, including browsers.
|
||||||
|
|
||||||
- [Usage](#usage)
|
<!-- TOC -->
|
||||||
* [Pull the image](#pull-the-image)
|
|
||||||
* [Run the image](#run-the-image)
|
|
||||||
- [End-to-end tests](#end-to-end-tests)
|
|
||||||
- [Crawling and scraping](#crawling-and-scraping)
|
|
||||||
* [Using on CI](#using-on-ci)
|
|
||||||
- [Image tags](#image-tags)
|
|
||||||
- [Development](#development)
|
|
||||||
* [Build the image](#build-the-image)
|
|
||||||
* [Push](#push)
|
|
||||||
- [Base images](#base-images)
|
|
||||||
* [Ubuntu 20](#ubuntu-20)
|
|
||||||
* [Ubuntu 18](#ubuntu-18)
|
|
||||||
* [Alpine](#alpine)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -49,8 +39,7 @@ On untrusted websites, it's recommended to use a separate user for launching the
|
||||||
$ docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:bionic /bin/bash
|
$ docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:bionic /bin/bash
|
||||||
```
|
```
|
||||||
|
|
||||||
[`seccomp_profile.json`](seccomp_profile.json) is needed to run Chromium with sandbox. This is
|
[`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/master/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions:
|
||||||
a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions:
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
|
@ -74,7 +63,7 @@ a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b0
|
||||||
|
|
||||||
### Using on CI
|
### Using on CI
|
||||||
|
|
||||||
See our [Continuous Integration guides](../ci.md) for sample configs.
|
See our [Continuous Integration guides](./ci.md) for sample configs.
|
||||||
|
|
||||||
## Image tags
|
## Image tags
|
||||||
|
|
||||||
|
@ -84,10 +73,10 @@ See [all available image tags](https://mcr.microsoft.com/v2/playwright/tags/list
|
||||||
|
|
||||||
### Build the image
|
### Build the image
|
||||||
|
|
||||||
Use [`//docs/docker/build.sh`](build.sh) to build the image.
|
Use [`//utils/docker/build.sh`](https://github.com/microsoft/playwright/blob/master/utils/docker/build.sh) to build the image.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ./docs/docker/build.sh bionic playwright:localbuild-bionic
|
$ ./utils/docker/build.sh bionic playwright:localbuild-bionic
|
||||||
```
|
```
|
||||||
|
|
||||||
The image will be tagged as `playwright:localbuild-bionic` and could be run as:
|
The image will be tagged as `playwright:localbuild-bionic` and could be run as:
|
|
@ -251,7 +251,7 @@ You can select input files for upload using the `page.setInputFiles` method. It
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
[This script](examples/upload.js) uploads a file to an `input` element that accepts file uploads.
|
[This script](https://github.com/microsoft/playwright/blob/master/utils/docs/examples/upload.js) uploads a file to an `input` element that accepts file uploads.
|
||||||
|
|
||||||
#### API reference
|
#### API reference
|
||||||
|
|
|
@ -61,12 +61,8 @@ $ npm i -D playwright
|
||||||
|
|
||||||
Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions.
|
Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions.
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
> **NOTE** Developers can opt-in in this mode via exporting `PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers` in their `.bashrc`.
|
> **NOTE** Developers can opt-in in this mode via exporting `PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers` in their `.bashrc`.
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Download from artifact repository
|
## Download from artifact repository
|
||||||
|
|
||||||
By default, Playwright downloads browsers from Microsoft and Google public CDNs.
|
By default, Playwright downloads browsers from Microsoft and Google public CDNs.
|
||||||
|
@ -92,8 +88,6 @@ take precedence over `PLAYWRIGHT_DOWNLOAD_HOST`.
|
||||||
$ PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright
|
$ PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Skip browser downloads
|
## Skip browser downloads
|
||||||
|
|
||||||
In certain cases, it is desired to avoid browser downloads altogether because
|
In certain cases, it is desired to avoid browser downloads altogether because
|
||||||
|
@ -110,8 +104,6 @@ $ set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
|
||||||
$ npm i -D playwright
|
$ npm i -D playwright
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Download single browser binary
|
## Download single browser binary
|
||||||
|
|
||||||
Playwright ships three packages that bundle only a single browser:
|
Playwright ships three packages that bundle only a single browser:
|
|
@ -104,5 +104,5 @@ Firefox and WebKit work across the 3 platforms (Windows, macOS, Linux):
|
||||||
* **Linux**: Depending on your Linux distribution, you might need to install additional
|
* **Linux**: Depending on your Linux distribution, you might need to install additional
|
||||||
dependencies to run the browsers.
|
dependencies to run the browsers.
|
||||||
* Firefox requires Ubuntu 18.04+
|
* Firefox requires Ubuntu 18.04+
|
||||||
* For Ubuntu 18.04, the additional dependencies are defined in [our Docker image](docker/Dockerfile.bionic),
|
* For Ubuntu 18.04, the additional dependencies are defined in [our Docker image](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.bionic),
|
||||||
which is based on Ubuntu.
|
which is based on Ubuntu.
|
|
@ -35,8 +35,6 @@ it('should work', async () => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## AVA
|
## AVA
|
||||||
|
|
||||||
Tests run concurrently in AVA, so a single page variable cannot be shared between tests. Instead, create new pages with a macro function.
|
Tests run concurrently in AVA, so a single page variable cannot be shared between tests. Instead, create new pages with a macro function.
|
||||||
|
@ -62,8 +60,6 @@ test('should work', pageMacro, async (t, page) => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Mocha
|
## Mocha
|
||||||
|
|
||||||
Mocha looks very similar to the Jest/Jasmine setup, and functions in the same way.
|
Mocha looks very similar to the Jest/Jasmine setup, and functions in the same way.
|
||||||
|
@ -91,8 +87,6 @@ it('should work', async () => {
|
||||||
assert.equal(await page.title(), 'Example Domain');
|
assert.equal(await page.title(), 'Example Domain');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
<br>
|
|
||||||
|
|
||||||
## Multiple Browsers
|
## Multiple Browsers
|
||||||
|
|
||||||
These simple examples can be extended to support multiple browsers using an environment variable.
|
These simple examples can be extended to support multiple browsers using an environment variable.
|
|
@ -10,7 +10,7 @@ title: "Troubleshooting"
|
||||||
Playwright does self-inspection every time it runs to make sure the browsers can be launched successfully. If there are missing
|
Playwright does self-inspection every time it runs to make sure the browsers can be launched successfully. If there are missing
|
||||||
dependencies, playwright will print instructions to acquire them.
|
dependencies, playwright will print instructions to acquire them.
|
||||||
|
|
||||||
We also provide [Ubuntu 18.04 dockerfile](docker/Dockerfile.bionic) and [Ubuntu 20.04 dockerfile](docker/Dockerfile.focal) with the list of Debian dependencies.
|
We also provide [Ubuntu 18.04 dockerfile](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.bionic) and [Ubuntu 20.04 dockerfile](https://github.com/microsoft/playwright/blob/master/utils/docker/Dockerfile.focal) with the list of Debian dependencies.
|
||||||
|
|
||||||
## Code transpilation issues
|
## Code transpilation issues
|
||||||
|
|
|
@ -43,7 +43,7 @@ Playwright enables fast, reliable and capable automation across all modern brows
|
||||||
|
|
||||||
* **Language bindings**. Playwright is also available in [Python](https://github.com/microsoft/playwright-python) and [C#](https://github.com/microsoft/playwright-sharp). Learn about [supported languages](./languages.md).
|
* **Language bindings**. Playwright is also available in [Python](https://github.com/microsoft/playwright-python) and [C#](https://github.com/microsoft/playwright-sharp). Learn about [supported languages](./languages.md).
|
||||||
|
|
||||||
* **Deploy tests to CI**. First-party [Docker image](docker/README.md) and [GitHub Actions](https://github.com/microsoft/playwright-github-action) to deploy tests to [your preferred CI/CD provider](./ci.md).
|
* **Deploy tests to CI**. First-party [Docker image](./docker.md) and [GitHub Actions](https://github.com/microsoft/playwright-github-action) to deploy tests to [your preferred CI/CD provider](./ci.md).
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
|
@ -40,7 +40,7 @@ run().catch(e => {
|
||||||
});;
|
});;
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const outline = new MDOutline(path.join(PROJECT_DIR, 'docs-src', 'api-body.md'), path.join(PROJECT_DIR, 'docs-src', 'api-params.md'));
|
const outline = new MDOutline(path.join(PROJECT_DIR, 'docs', 'src', 'api-body.md'), path.join(PROJECT_DIR, 'docs', 'src', 'api-params.md'));
|
||||||
outline.setLinkRenderer(item => {
|
outline.setLinkRenderer(item => {
|
||||||
const { clazz, member, param, option } = item;
|
const { clazz, member, param, option } = item;
|
||||||
if (param)
|
if (param)
|
||||||
|
@ -54,11 +54,11 @@ async function run() {
|
||||||
|
|
||||||
let generatedLinksSuffix;
|
let generatedLinksSuffix;
|
||||||
{
|
{
|
||||||
const links = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', 'links.md')).toString();
|
const links = fs.readFileSync(path.join(PROJECT_DIR, 'docs', 'src', 'links.md')).toString();
|
||||||
const localLinks = [];
|
const localLinks = [];
|
||||||
for (const clazz of outline.classesArray)
|
for (const clazz of outline.classesArray)
|
||||||
localLinks.push(`[${clazz.name}]: api/class-${clazz.name.toLowerCase()}.md "${clazz.name}"`);
|
localLinks.push(`[${clazz.name}]: api/class-${clazz.name.toLowerCase()}.md "${clazz.name}"`);
|
||||||
generatedLinksSuffix = localLinks.join('\n') + '\n' + links;
|
generatedLinksSuffix = '\n' + localLinks.join('\n') + '\n' + links;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Produce api.md
|
// Produce api.md
|
||||||
|
@ -70,7 +70,7 @@ async function run() {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: `---
|
text: `---
|
||||||
id: class-${clazz.name.toLowerCase()}
|
id: class-${clazz.name.toLowerCase()}
|
||||||
title: "class: ${clazz.name}"
|
title: "${clazz.name}"
|
||||||
---
|
---
|
||||||
`});
|
`});
|
||||||
result.push(...(clazz.spec || []).map(c => md.clone(c)));
|
result.push(...(clazz.spec || []).map(c => md.clone(c)));
|
||||||
|
@ -87,7 +87,7 @@ title: "class: ${clazz.name}"
|
||||||
for (const member of clazz.membersArray) {
|
for (const member of clazz.membersArray) {
|
||||||
// Iterate members
|
// Iterate members
|
||||||
/** @type {MarkdownNode} */
|
/** @type {MarkdownNode} */
|
||||||
const memberNode = { type: 'h4', children: [] };
|
const memberNode = { type: 'h2', children: [] };
|
||||||
if (member.kind === 'event') {
|
if (member.kind === 'event') {
|
||||||
memberNode.text = `${clazz.varName}.on('${member.name}')`;
|
memberNode.text = `${clazz.varName}.on('${member.name}')`;
|
||||||
} else if (member.kind === 'property') {
|
} else if (member.kind === 'property') {
|
||||||
|
@ -95,10 +95,8 @@ title: "class: ${clazz.name}"
|
||||||
} else if (member.kind === 'method') {
|
} else if (member.kind === 'method') {
|
||||||
// Patch method signatures
|
// Patch method signatures
|
||||||
memberNode.text = `${clazz.varName}.${member.name}(${member.signature})`;
|
memberNode.text = `${clazz.varName}.${member.name}(${member.signature})`;
|
||||||
for (const arg of member.argsArray) {
|
for (const arg of member.argsArray)
|
||||||
if (arg.type)
|
memberNode.children.push(renderProperty(`\`${arg.name}\``, arg.type, arg.spec));
|
||||||
memberNode.children.push(renderProperty(`\`${arg.name}\``, arg.type, arg.spec));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append type
|
// Append type
|
||||||
|
@ -116,23 +114,23 @@ title: "class: ${clazz.name}"
|
||||||
memberNode.children.push(...(member.spec || []).map(c => md.clone(c)));
|
memberNode.children.push(...(member.spec || []).map(c => md.clone(c)));
|
||||||
result.push(memberNode);
|
result.push(memberNode);
|
||||||
}
|
}
|
||||||
writeAssumeNoop(path.join(PROJECT_DIR, 'docs', `class-${clazz.name.toLowerCase()}.md`), [md.render(result), generatedLinksSuffix].join('\n'), dirtyFiles);
|
writeAssumeNoop(path.join(PROJECT_DIR, 'docs', 'out', 'api', `class-${clazz.name.toLowerCase()}.md`), [md.render(result), generatedLinksSuffix].join('\n'), dirtyFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Produce other docs
|
// Produce other docs
|
||||||
{
|
{
|
||||||
for (const name of fs.readdirSync(path.join(PROJECT_DIR, 'docs-src'))) {
|
for (const name of fs.readdirSync(path.join(PROJECT_DIR, 'docs', 'src'))) {
|
||||||
if (name === 'links.md' || name.startsWith('api-'))
|
if (name === 'links.md' || name.startsWith('api-'))
|
||||||
continue;
|
continue;
|
||||||
const content = fs.readFileSync(path.join(PROJECT_DIR, 'docs-src', name)).toString();
|
const content = fs.readFileSync(path.join(PROJECT_DIR, 'docs', 'src', name)).toString();
|
||||||
const nodes = md.parse(content);
|
const nodes = md.parse(content);
|
||||||
outline.renderLinksInText(nodes);
|
outline.renderLinksInText(nodes);
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
if (node.text === '<!-- TOC -->')
|
if (node.text === '<!-- TOC -->')
|
||||||
node.text = md.generateToc(nodes);
|
node.text = md.generateToc(nodes);
|
||||||
}
|
}
|
||||||
writeAssumeNoop(path.join(PROJECT_DIR, 'docs', name), [md.render(nodes), generatedLinksSuffix].join('\n'), dirtyFiles);
|
writeAssumeNoop(path.join(PROJECT_DIR, 'docs', 'out', name), [md.render(nodes), generatedLinksSuffix].join('\n'), dirtyFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +187,8 @@ title: "class: ${clazz.name}"
|
||||||
* @param {Set<string>} dirtyFiles
|
* @param {Set<string>} dirtyFiles
|
||||||
*/
|
*/
|
||||||
function writeAssumeNoop(name, content, dirtyFiles) {
|
function writeAssumeNoop(name, content, dirtyFiles) {
|
||||||
const oldContent = fs.readFileSync(name).toString();
|
fs.mkdirSync(path.dirname(name), { recursive: true });
|
||||||
|
const oldContent = fs.existsSync(name) ? fs.readFileSync(name).toString() : '';
|
||||||
if (oldContent !== content) {
|
if (oldContent !== content) {
|
||||||
fs.writeFileSync(name, content);
|
fs.writeFileSync(name, content);
|
||||||
dirtyFiles.add(name);
|
dirtyFiles.add(name);
|
||||||
|
|
|
@ -22,7 +22,7 @@ const { MDOutline } = require('./MDBuilder');
|
||||||
const PROJECT_DIR = path.join(__dirname, '..', '..');
|
const PROJECT_DIR = path.join(__dirname, '..', '..');
|
||||||
|
|
||||||
{
|
{
|
||||||
const outline = new MDOutline(path.join(PROJECT_DIR, 'docs-src', 'api-body.md'), path.join(PROJECT_DIR, 'docs-src', 'api-params.md'));
|
const outline = new MDOutline(path.join(PROJECT_DIR, 'docs', 'src', 'api-body.md'), path.join(PROJECT_DIR, 'docs', 'src', 'api-params.md'));
|
||||||
outline.setLinkRenderer(item => {
|
outline.setLinkRenderer(item => {
|
||||||
const { clazz, member, param, option } = item;
|
const { clazz, member, param, option } = item;
|
||||||
if (param)
|
if (param)
|
||||||
|
|
|
@ -36,7 +36,7 @@ let hadChanges = false;
|
||||||
fs.mkdirSync(typesDir)
|
fs.mkdirSync(typesDir)
|
||||||
writeFile(path.join(typesDir, 'protocol.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'server', 'chromium', 'protocol.ts'), 'utf8'));
|
writeFile(path.join(typesDir, 'protocol.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'server', 'chromium', 'protocol.ts'), 'utf8'));
|
||||||
writeFile(path.join(typesDir, 'trace.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'trace', 'traceTypes.ts'), 'utf8'));
|
writeFile(path.join(typesDir, 'trace.d.ts'), fs.readFileSync(path.join(PROJECT_DIR, 'src', 'trace', 'traceTypes.ts'), 'utf8'));
|
||||||
const outline = new MDOutline(path.join(PROJECT_DIR, 'docs-src', 'api-body.md'), path.join(PROJECT_DIR, 'docs-src', 'api-params.md'));
|
const outline = new MDOutline(path.join(PROJECT_DIR, 'docs', 'src', 'api-body.md'), path.join(PROJECT_DIR, 'docs', 'src', 'api-params.md'));
|
||||||
outline.copyDocsFromSuperclasses([]);
|
outline.copyDocsFromSuperclasses([]);
|
||||||
const createMemberLink = (text) => {
|
const createMemberLink = (text) => {
|
||||||
const anchor = text.toLowerCase().split(',').map(c => c.replace(/[^a-z]/g, '')).join('-');
|
const anchor = text.toLowerCase().split(',').map(c => c.replace(/[^a-z]/g, '')).join('-');
|
||||||
|
|
|
@ -26,8 +26,8 @@ process.on('exit', () => spawns.forEach(s => s.kill()));
|
||||||
|
|
||||||
runOnChanges(['src/protocol/protocol.yml'], 'utils/generate_channels.js');
|
runOnChanges(['src/protocol/protocol.yml'], 'utils/generate_channels.js');
|
||||||
runOnChanges([
|
runOnChanges([
|
||||||
'docs-src/api-body.md',
|
'docs/src/api-body.md',
|
||||||
'docs-src/api-params.md',
|
'docs/src/api-params.md',
|
||||||
'utils/generate_types/overrides.d.ts',
|
'utils/generate_types/overrides.d.ts',
|
||||||
'utils/generate_types/exported.json',
|
'utils/generate_types/exported.json',
|
||||||
'src/server/chromium/protocol.ts',
|
'src/server/chromium/protocol.ts',
|
||||||
|
|
Loading…
Reference in New Issue