diff --git a/.github/workflows/publish_canary_docker.yml b/.github/workflows/publish_canary_docker.yml index afeb9fbbbe..89b4fb486c 100644 --- a/.github/workflows/publish_canary_docker.yml +++ b/.github/workflows/publish_canary_docker.yml @@ -6,7 +6,7 @@ on: - master - release-* paths: - - docs/docker/** + - utils/docker/** - browsers.json - .github/workflows/publish_canary_docker.yml @@ -29,12 +29,12 @@ jobs: node-version: 10.15 - run: npm ci - run: npm run build - - run: ./docs/docker/build.sh bionic playwright:localbuild-bionic - - run: ./docs/docker/build.sh focal playwright:localbuild-focal + - run: ./utils/docker/build.sh bionic playwright:localbuild-bionic + - run: ./utils/docker/build.sh focal playwright:localbuild-focal - name: tag & publish run: | - ./docs/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 - ./docs/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-bionic playwright.azurecr.io/public/playwright:next + ./utils/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:sha-${{ github.sha }} + ./utils/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:next-focal diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 6e061565b8..551089703f 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -40,17 +40,17 @@ jobs: node-version: 10.15 - run: npm ci - run: npm run build - - run: ./docs/docker/build.sh bionic playwright:localbuild-bionic - - run: ./docs/docker/build.sh focal playwright:localbuild-focal + - run: ./utils/docker/build.sh bionic playwright:localbuild-bionic + - run: ./utils/docker/build.sh focal playwright:localbuild-focal - name: tag & publish run: | # GITHUB_REF has a form of `refs/tags/v1.3.0`. # TAG_NAME would be `v1.3.0` TAG_NAME=${GITHUB_REF#refs/tags/} - ./docs/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 - ./docs/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:latest + ./utils/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:${TAG_NAME} + ./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 - ./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:focal + ./utils/docker/tag_and_push.sh playwright:localbuild-focal playwright.azurecr.io/public/playwright:${TAG_NAME}-focal diff --git a/docs/README.md b/docs/out/README.md similarity index 98% rename from docs/README.md rename to docs/out/README.md index 1599dcdd09..cc711f6d9d 100644 --- a/docs/README.md +++ b/docs/out/README.md @@ -38,10 +38,10 @@ Playwright is a library to automate [Chromium](https://www.chromium.org/Home), [ - [Page object models](./pom.md) 1. Integrations - [Test runners](./test-runners.md) - - [Docker](./docker/README.md) + - [Docker](././docker.md) - [Continuous integration](./ci.md) 1. Reference - - [API Reference](./api.md) + - [API Reference](./api/class-playwright.md) - [Actionability](./actionability.md) - [Advanced installation](./installation.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) - [Stack Overflow](https://stackoverflow.com/tags/playwright) - [GitHub](https://github.com/microsoft/playwright/issues) + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/actionability.md b/docs/out/actionability.md similarity index 89% rename from docs/actionability.md rename to docs/out/actionability.md index a776cf910a..dabba1f0d9 100644 --- a/docs/actionability.md +++ b/docs/out/actionability.md @@ -11,13 +11,13 @@ Some actions like `page.click()` support `{force: true}` option that disable non | Actions | Performed checks | | ------ | ------- | -| `check()`
`click()`
`dblclick()`
`tap()`
`uncheck()` | [Visible]
[Stable]
[Enabled]
[Receiving Events]
[Attached] | -| `hover()` | [Visible]
[Stable]
[Receiving Events]
[Attached] | -| `fill()` | [Visible]
[Enabled]
[Editable]
[Attached] | -| `dispatchEvent()`
`focus()`
`press()`
`setInputFiles()`
`selectOption()`
`type()` | [Attached] | -| `scrollIntoViewIfNeeded()`
`screenshot()` | [Visible]
[Stable]
[Attached] | -| `selectText()` | [Visible]
[Attached] | -| `getAttribute()`
`innerText()`
`innerHTML()`
`textContent()` | [Attached] | +| `check()`

`click()`

`dblclick()`

`tap()`

`uncheck()` | [Visible]

[Stable]

[Enabled]

[Receiving Events]

[Attached] | +| `hover()` | [Visible]

[Stable]

[Receiving Events]

[Attached] | +| `fill()` | [Visible]

[Enabled]

[Editable]

[Attached] | +| `dispatchEvent()`

`focus()`

`press()`

`setInputFiles()`

`selectOption()`

`type()` | [Attached] | +| `scrollIntoViewIfNeeded()`

`screenshot()` | [Visible]

[Stable]

[Attached] | +| `selectText()` | [Visible]

[Attached] | +| `getAttribute()`

`innerText()`

`innerHTML()`

`textContent()` | [Attached] | ### Visible @@ -57,6 +57,7 @@ For example, consider a scenario where Playwright will click `Sign Up` button re [Editable]: #editable "Editable" [Receiving Events]: #receiving-events "Receiving Events" [Attached]: #attached "Attached" + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-accessibility.md b/docs/out/api/class-accessibility.md similarity index 99% rename from docs/class-accessibility.md rename to docs/out/api/class-accessibility.md index b18c43f229..f790159c4f 100644 --- a/docs/class-accessibility.md +++ b/docs/out/api/class-accessibility.md @@ -1,6 +1,6 @@ --- 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]) +## accessibility.snapshot([options]) - `options` <[Object]> - `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. @@ -76,6 +76,7 @@ function findFocusedNode(node) { } ``` + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-browser.md b/docs/out/api/class-browser.md similarity index 98% rename from docs/class-browser.md rename to docs/out/api/class-browser.md index f51623aacf..cafe4d446f 100644 --- a/docs/class-browser.md +++ b/docs/out/api/class-browser.md @@ -1,6 +1,6 @@ --- id: class-browser -title: "class: Browser" +title: "Browser" --- * 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.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: * Browser application is closed or crashed. * The [browser.close()](api/class-browser.md#browserclose) method was called. -#### browser.close() +## browser.close() - 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). @@ -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. -#### browser.contexts() +## browser.contexts() - returns: <[Array]<[BrowserContext]>> 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` ``` -#### browser.isConnected() +## browser.isConnected() - returns: <[boolean]> Indicates that the browser is connected. -#### browser.newContext([options]) +## browser.newContext([options]) - `options` <[Object]> - `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. @@ -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]> - `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. @@ -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. -#### browser.version() +## browser.version() - returns: <[string]> Returns the browser version. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-browsercontext.md b/docs/out/api/class-browsercontext.md similarity index 95% rename from docs/class-browsercontext.md rename to docs/out/api/class-browsercontext.md index a7aa14b6e4..7df6690300 100644 --- a/docs/class-browsercontext.md +++ b/docs/out/api/class-browsercontext.md @@ -1,6 +1,6 @@ --- id: class-browsercontext -title: "class: BrowserContext" +title: "BrowserContext" --- * 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.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: * Browser context is closed. * Browser application is closed or crashed. * The [browser.close()](api/class-browser.md#browserclose) method was called. -#### browserContext.on('page') +## browserContext.on('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. @@ -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). -#### browserContext.addCookies(cookies) +## browserContext.addCookies(cookies) - `cookies` <[Array]<[Object]>> - `name` <[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]); ``` -#### browserContext.addInitScript(script[, arg]) +## browserContext.addInitScript(script[, arg]) - `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. - `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. -#### browserContext.browser() +## browserContext.browser() - returns: <[null]|[Browser]> Returns the browser instance of the context. If it was launched as a persistent context null gets returned. -#### browserContext.clearCookies() +## browserContext.clearCookies() - returns: <[Promise]> Clears context cookies. -#### browserContext.clearPermissions() +## browserContext.clearPermissions() - returns: <[Promise]> Clears all permission overrides for the browser context. @@ -141,14 +141,14 @@ await context.grantPermissions(['clipboard-read']); context.clearPermissions(); ``` -#### browserContext.close() +## browserContext.close() - returns: <[Promise]> Closes the browser context. All the pages that belong to the browser context will be closed. > **NOTE** the default browser context cannot be closed. -#### browserContext.cookies([urls]) +## browserContext.cookies([urls]) - `urls` <[string]|[Array]<[string]>> Optional list of URLs. - returns: <[Promise]<[Array]<[Object]>>> - `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. -#### browserContext.exposeBinding(name, playwrightBinding[, options]) +## browserContext.exposeBinding(name, playwrightBinding[, options]) - `name` <[string]> Name of the function on the window object. - `playwrightBinding` <[function]> Callback function that will be called in the Playwright's context. - `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. - `playwrightFunction` <[function]> Callback function that will be called in the Playwright's context. - 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: * `'geolocation'` * `'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. -#### browserContext.newPage() +## browserContext.newPage() - returns: <[Promise]<[Page]>> Creates a new page in the browser context. -#### browserContext.pages() +## browserContext.pages() - 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). -#### 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. - `handler` <[function]\([Route], [Request]\)> handler function to route the request. - 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. -#### browserContext.setDefaultNavigationTimeout(timeout) +## browserContext.setDefaultNavigationTimeout(timeout) - `timeout` <[number]> Maximum navigation time in milliseconds 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). -#### browserContext.setDefaultTimeout(timeout) +## browserContext.setDefaultTimeout(timeout) - `timeout` <[number]> Maximum time in milliseconds 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). -#### 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. - 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. -#### browserContext.setGeolocation(geolocation) +## browserContext.setGeolocation(geolocation) - `geolocation` <[null]|[Object]> - `latitude` <[number]> Latitude between -90 and 90. **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. -#### browserContext.setHTTPCredentials(httpCredentials) +## browserContext.setHTTPCredentials(httpCredentials) - `httpCredentials` <[null]|[Object]> - `username` <[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. -#### browserContext.setOffline(offline) +## browserContext.setOffline(offline) - `offline` <[boolean]> Whether to emulate network being offline for the browser context. - returns: <[Promise]> -#### browserContext.storageState([options]) +## browserContext.storageState([options]) - `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. - 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. -#### 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). - `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]> 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)`. - `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. @@ -412,6 +412,7 @@ const context = await browser.newContext(); await context.grantPermissions(['geolocation']); ``` + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-browserserver.md b/docs/out/api/class-browserserver.md similarity index 96% rename from docs/class-browserserver.md rename to docs/out/api/class-browserserver.md index ef78253ee6..0c30606d87 100644 --- a/docs/class-browserserver.md +++ b/docs/out/api/class-browserserver.md @@ -1,6 +1,6 @@ --- id: class-browserserver -title: "class: BrowserServer" +title: "BrowserServer" --- @@ -11,31 +11,32 @@ title: "class: BrowserServer" - [browserServer.process()](api/class-browserserver.md#browserserverprocess) - [browserServer.wsEndpoint()](api/class-browserserver.md#browserserverwsendpoint) -#### browserServer.on('close') +## browserServer.on('close') Emitted when the browser server closes. -#### browserServer.close() +## browserServer.close() - returns: <[Promise]> Closes the browser gracefully and makes sure the process is terminated. -#### browserServer.kill() +## browserServer.kill() - returns: <[Promise]> Kills the browser process and waits for the process to exit. -#### browserServer.process() +## browserServer.process() - returns: <[ChildProcess]> Spawned browser application process. -#### browserServer.wsEndpoint() +## browserServer.wsEndpoint() - returns: <[string]> 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. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-browsertype.md b/docs/out/api/class-browsertype.md similarity index 98% rename from docs/class-browsertype.md rename to docs/out/api/class-browsertype.md index 0a3de21fd4..c15bf587a7 100644 --- a/docs/class-browsertype.md +++ b/docs/out/api/class-browsertype.md @@ -1,6 +1,6 @@ --- 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.name()](api/class-browsertype.md#browsertypename) -#### browserType.connect(params) +## browserType.connect(params) - `params` <[Object]> - `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. @@ -36,12 +36,12 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'. This methods attaches Playwright to an existing browser instance. -#### browserType.executablePath() +## browserType.executablePath() - returns: <[string]> A path where Playwright expects to find a bundled browser executable. -#### browserType.launch([options]) +## browserType.launch([options]) - `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/). - `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. -#### 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). - `options` <[Object]> - `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. -#### browserType.launchServer([options]) +## browserType.launchServer([options]) - `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/). - `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 browser name. For example: `'chromium'`, `'webkit'` or `'firefox'`. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-cdpsession.md b/docs/out/api/class-cdpsession.md similarity index 98% rename from docs/class-cdpsession.md rename to docs/out/api/class-cdpsession.md index 93bfa9c6a4..4e053b95e9 100644 --- a/docs/class-cdpsession.md +++ b/docs/out/api/class-cdpsession.md @@ -1,6 +1,6 @@ --- id: class-cdpsession -title: "class: CDPSession" +title: "CDPSession" --- * 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.send(method[, params])](api/class-cdpsession.md#cdpsessionsendmethod-params) -#### cdpSession.detach() +## cdpSession.detach() - 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. -#### cdpSession.send(method[, params]) +## cdpSession.send(method[, params]) - `method` <[string]> protocol method name - `params` <[Object]> Optional method parameters - returns: <[Promise]<[Object]>> + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-chromiumbrowser.md b/docs/out/api/class-chromiumbrowser.md similarity index 97% rename from docs/class-chromiumbrowser.md rename to docs/out/api/class-chromiumbrowser.md index 3017f77a8c..0cfb4d4313 100644 --- a/docs/class-chromiumbrowser.md +++ b/docs/out/api/class-chromiumbrowser.md @@ -1,6 +1,6 @@ --- id: class-chromiumbrowser -title: "class: ChromiumBrowser" +title: "ChromiumBrowser" --- * extends: [Browser] @@ -25,12 +25,12 @@ await browser.stopTracing(); - [browser.newPage([options])](api/class-browser.md#browsernewpageoptions) - [browser.version()](api/class-browser.md#browserversion) -#### chromiumBrowser.newBrowserCDPSession() +## chromiumBrowser.newBrowserCDPSession() - returns: <[Promise]<[CDPSession]>> 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. - `options` <[Object]> - `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. -#### chromiumBrowser.stopTracing() +## chromiumBrowser.stopTracing() - returns: <[Promise]<[Buffer]>> Returns the buffer with trace data. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-chromiumbrowsercontext.md b/docs/out/api/class-chromiumbrowsercontext.md similarity index 96% rename from docs/class-chromiumbrowsercontext.md rename to docs/out/api/class-chromiumbrowsercontext.md index 7f23bb993e..2084a61268 100644 --- a/docs/class-chromiumbrowsercontext.md +++ b/docs/out/api/class-chromiumbrowsercontext.md @@ -1,6 +1,6 @@ --- id: class-chromiumbrowsercontext -title: "class: ChromiumBrowserContext" +title: "ChromiumBrowserContext" --- * extends: [BrowserContext] @@ -42,33 +42,34 @@ const backgroundPage = await context.waitForEvent('backgroundpage'); - [browserContext.unroute(url[, handler])](api/class-browsercontext.md#browsercontextunrouteurl-handler) - [browserContext.waitForEvent(event[, optionsOrPredicate])](api/class-browsercontext.md#browsercontextwaitforeventevent-optionsorpredicate) -#### chromiumBrowserContext.on('backgroundpage') +## chromiumBrowserContext.on('backgroundpage') - type: <[Page]> Emitted when new background page is created in the context. > **NOTE** Only works with persistent context. -#### chromiumBrowserContext.on('serviceworker') +## chromiumBrowserContext.on('serviceworker') - type: <[Worker]> Emitted when new service worker is created in the context. -#### chromiumBrowserContext.backgroundPages() +## chromiumBrowserContext.backgroundPages() - returns: <[Array]<[Page]>> All existing background pages in the context. -#### chromiumBrowserContext.newCDPSession(page) +## chromiumBrowserContext.newCDPSession(page) - `page` <[Page]> Page to create new session for. - returns: <[Promise]<[CDPSession]>> Returns the newly created session. -#### chromiumBrowserContext.serviceWorkers() +## chromiumBrowserContext.serviceWorkers() - returns: <[Array]<[Worker]>> All existing service workers in the context. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-chromiumcoverage.md b/docs/out/api/class-chromiumcoverage.md similarity index 97% rename from docs/class-chromiumcoverage.md rename to docs/out/api/class-chromiumcoverage.md index 1468896427..fb9aaeef25 100644 --- a/docs/class-chromiumcoverage.md +++ b/docs/out/api/class-chromiumcoverage.md @@ -1,6 +1,6 @@ --- 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.stopJSCoverage()](api/class-chromiumcoverage.md#chromiumcoveragestopjscoverage) -#### chromiumCoverage.startCSSCoverage([options]) +## chromiumCoverage.startCSSCoverage([options]) - `options` <[Object]> - `resetOnNavigation` <[boolean]> Whether to reset coverage on every navigation. Defaults to `true`. - returns: <[Promise]> Returns coverage is started -#### chromiumCoverage.startJSCoverage([options]) +## chromiumCoverage.startJSCoverage([options]) - `options` <[Object]> - `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`. @@ -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. -#### chromiumCoverage.stopCSSCoverage() +## chromiumCoverage.stopCSSCoverage() - returns: <[Promise]<[Array]<[Object]>>> - `url` <[string]> StyleSheet URL - `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. -#### chromiumCoverage.stopJSCoverage() +## chromiumCoverage.stopJSCoverage() - returns: <[Promise]<[Array]<[Object]>>> - `url` <[string]> Script URL - `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 > **NOTE** JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-consolemessage.md b/docs/out/api/class-consolemessage.md similarity index 97% rename from docs/class-consolemessage.md rename to docs/out/api/class-consolemessage.md index 9a876e46af..e84cb98712 100644 --- a/docs/class-consolemessage.md +++ b/docs/out/api/class-consolemessage.md @@ -1,6 +1,6 @@ --- id: class-consolemessage -title: "class: ConsoleMessage" +title: "ConsoleMessage" --- @@ -12,22 +12,23 @@ title: "class: ConsoleMessage" - [consoleMessage.text()](api/class-consolemessage.md#consolemessagetext) - [consoleMessage.type()](api/class-consolemessage.md#consolemessagetype) -#### consoleMessage.args() +## consoleMessage.args() - returns: <[Array]<[JSHandle]>> -#### consoleMessage.location() +## consoleMessage.location() - returns: <[Object]> - `url` <[string]> URL of the resource. - `lineNumber` <[number]> 0-based line number in the resource. - `columnNumber` <[number]> 0-based column number in the resource. -#### consoleMessage.text() +## consoleMessage.text() - returns: <[string]> -#### consoleMessage.type() +## consoleMessage.type() - 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'`. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-dialog.md b/docs/out/api/class-dialog.md similarity index 97% rename from docs/class-dialog.md rename to docs/out/api/class-dialog.md index 20025d38eb..4e94d7e358 100644 --- a/docs/class-dialog.md +++ b/docs/out/api/class-dialog.md @@ -1,6 +1,6 @@ --- 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.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. - returns: <[Promise]> Returns when the dialog has been accepted. -#### dialog.defaultValue() +## dialog.defaultValue() - returns: <[string]> If dialog is prompt, returns default prompt value. Otherwise, returns empty string. -#### dialog.dismiss() +## dialog.dismiss() - returns: <[Promise]> Returns when the dialog has been dismissed. -#### dialog.message() +## dialog.message() - returns: <[string]> A message displayed in the dialog. -#### dialog.type() +## dialog.type() - returns: <[string]> Returns dialog's type, can be one of `alert`, `beforeunload`, `confirm` or `prompt`. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-download.md b/docs/out/api/class-download.md similarity index 96% rename from docs/class-download.md rename to docs/out/api/class-download.md index e3d5e5faf0..189c20fce7 100644 --- a/docs/class-download.md +++ b/docs/out/api/class-download.md @@ -1,6 +1,6 @@ --- 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.url()](api/class-download.md#downloadurl) -#### download.createReadStream() +## download.createReadStream() - returns: <[Promise]<[null]|[Readable]>> Returns readable stream for current download or `null` if download failed. -#### download.delete() +## download.delete() - returns: <[Promise]> Deletes the downloaded file. -#### download.failure() +## download.failure() - returns: <[Promise]<[null]|[string]>> Returns download error if any. -#### download.path() +## download.path() - returns: <[Promise]<[null]|[string]>> 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. - returns: <[Promise]> Saves the download to a user-specified path. -#### download.suggestedFilename() +## download.suggestedFilename() - 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. -#### download.url() +## download.url() - returns: <[string]> Returns downloaded url. + [Playwright]: api/class-playwright.md "Playwright" [Browser]: api/class-browser.md "Browser" [BrowserContext]: api/class-browsercontext.md "BrowserContext" diff --git a/docs/class-elementhandle.md b/docs/out/api/class-elementhandle.md similarity index 97% rename from docs/class-elementhandle.md rename to docs/out/api/class-elementhandle.md index 2005b2974d..62805f2028 100644 --- a/docs/class-elementhandle.md +++ b/docs/out/api/class-elementhandle.md @@ -1,6 +1,6 @@ --- id: class-elementhandle -title: "class: ElementHandle" +title: "ElementHandle" --- * 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.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. - 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`. -#### elementHandle.$$(selector) +## elementHandle.$$(selector) - `selector` <[string]> A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details. - 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. -#### 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. - `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context - `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'); ``` -#### 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. - `pageFunction` <[function]\([Array]<[Element]>\)> Function to be evaluated in browser context - `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!']); ``` -#### elementHandle.boundingBox() +## elementHandle.boundingBox() - returns: <[Promise]<[null]|[Object]>> - `x` <[number]> the x 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); ``` -#### elementHandle.check([options]) +## elementHandle.check([options]) - `options` <[Object]> - `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`. @@ -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. -#### elementHandle.click([options]) +## elementHandle.click([options]) - `options` <[Object]> - `button` <"left"|"right"|"middle"> Defaults to `left`. - `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. -#### elementHandle.contentFrame() +## elementHandle.contentFrame() - returns: <[Promise]<[null]|[Frame]>> Returns the content frame for element handles referencing iframe nodes, or `null` otherwise -#### elementHandle.dblclick([options]) +## elementHandle.dblclick([options]) - `options` <[Object]> - `button` <"left"|"right"|"middle"> Defaults to `left`. - `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. -#### elementHandle.dispatchEvent(type[, eventInit]) +## elementHandle.dispatchEvent(type[, eventInit]) - `type` <[string]> DOM event type: `"click"`, `"dragstart"`, etc. - `eventInit` <[EvaluationArgument]> Optional event-specific initialization properties. - returns: <[Promise]> @@ -243,7 +243,7 @@ const dataTransfer = await page.evaluateHandle(() => new DataTransfer()); await elementHandle.dispatchEvent('dragstart', { dataTransfer }); ``` -#### elementHandle.fill(value[, options]) +## elementHandle.fill(value[, options]) - `value` <[string]> Value to set for the ``, `