Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: annotate deprecated methods (#19005)

Pavel Feldmanf97dcd4c7936
diff --git a/docs/src/api/class-accessibility.md b/docs/src/api/class-accessibility.md
index dce0b8cc85..97f697c8dc 100644
--- a/docs/src/api/class-accessibility.md
+++ b/docs/src/api/class-accessibility.md
@@ -1,8 +1,7 @@
# class: Accessibility
* since: v1.8
* langs: csharp, js, python
-
-**DEPRECATED** This class is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
+* deprecated: This class is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
@@ -20,6 +19,8 @@ assistive technologies themselves. By default, Playwright tries to approximate t
## async method: Accessibility.snapshot
* since: v1.8
+* deprecated: This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
+
- returns: <[null]|[Object]>
- `role` <[string]> The [role](https://www.w3.org/TR/wai-aria/#usage_intro).
- `name` <[string]> A human readable name for the node.
@@ -48,8 +49,6 @@ assistive technologies themselves. By default, Playwright tries to approximate t
- `orientation` <[string]> Whether the node is oriented horizontally or vertically, if applicable.
- `children` <[Array]<[Object]>> Child nodes, if any, if applicable.
-**DEPRECATED** This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
-
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
page.
diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md
index 82f9c4ec41..7f2cdf88b1 100644
--- a/docs/src/api/class-browsercontext.md
+++ b/docs/src/api/class-browsercontext.md
@@ -1223,8 +1223,7 @@ its geolocation.
## async method: BrowserContext.setHTTPCredentials
* since: v1.8
* langs: js
-
-**DEPRECATED** Browsers may cache credentials after successful authentication. Create a new browser context instead.
+* deprecated: Browsers may cache credentials after successful authentication. Create a new browser context instead.
### param: BrowserContext.setHTTPCredentials.httpCredentials
* since: v1.8
diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md
index 43c51065a9..8b257fa587 100644
--- a/docs/src/api/class-frame.md
+++ b/docs/src/api/class-frame.md
@@ -188,6 +188,7 @@ Raw CSS content to be injected into frame.
## async method: Frame.check
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.check`] instead.
This method checks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -231,6 +232,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.click
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.click`] instead.
This method clicks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -285,6 +287,7 @@ Gets the full HTML contents of the frame, including the doctype.
## async method: Frame.dblclick
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.dblclick`] instead.
* langs:
- alias-csharp: DblClickAsync
@@ -337,6 +340,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.dispatchEvent
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.dispatchEvent`] instead.
The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click`
is dispatched. This is equivalent to calling
@@ -465,6 +469,7 @@ Optional event-specific initialization properties.
## async method: Frame.evalOnSelector
* since: v1.9
+* discouraged: Use locator-based [`method: Locator.evaluate`] instead.
* langs:
- alias-python: eval_on_selector
- alias-js: $eval
@@ -533,6 +538,7 @@ Optional argument to pass to [`param: expression`].
## async method: Frame.evalOnSelectorAll
* since: v1.9
+* discouraged: Use locator-based [`method: Locator.evaluateAll`] instead.
* langs:
- alias-python: eval_on_selector_all
- alias-js: $$eval
@@ -805,6 +811,7 @@ Optional argument to pass to [`param: expression`].
## async method: Frame.fill
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.fill`] instead.
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field.
@@ -835,6 +842,7 @@ Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
## async method: Frame.focus
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.focus`] instead.
This method fetches an element with [`param: selector`] and focuses it. If there's no element matching
[`param: selector`], the method waits until a matching element appears in the DOM.
@@ -932,6 +940,7 @@ await locator.ClickAsync();
## async method: Frame.getAttribute
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.getAttribute`] instead.
- returns: <[null]|[string]>
Returns element attribute value.
@@ -1074,6 +1083,7 @@ Referer header value. If provided it will take preference over the referer heade
## async method: Frame.hover
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.hover`] instead.
This method hovers over an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -1113,6 +1123,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.innerHTML
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.innerHTML`] instead.
- returns: <[string]>
Returns `element.innerHTML`.
@@ -1128,6 +1139,7 @@ Returns `element.innerHTML`.
## async method: Frame.innerText
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.innerText`] instead.
- returns: <[string]>
Returns `element.innerText`.
@@ -1143,6 +1155,7 @@ Returns `element.innerText`.
## async method: Frame.inputValue
* since: v1.13
+* discouraged: Use locator-based [`method: Locator.inputValue`] instead.
- returns: <[string]>
Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
@@ -1160,6 +1173,7 @@ Throws for non-input elements. However, if the element is inside the `<label>` e
## async method: Frame.isChecked
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isChecked`] instead.
- returns: <[boolean]>
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
@@ -1181,6 +1195,7 @@ Returns `true` if the frame has been detached, or `false` otherwise.
## async method: Frame.isDisabled
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isDisabled`] instead.
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
@@ -1196,6 +1211,7 @@ Returns whether the element is disabled, the opposite of [enabled](../actionabil
## async method: Frame.isEditable
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isEditable`] instead.
- returns: <[boolean]>
Returns whether the element is [editable](../actionability.md#editable).
@@ -1226,6 +1242,7 @@ Returns whether the element is [enabled](../actionability.md#enabled).
## async method: Frame.isHidden
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isHidden`] instead.
- returns: <[boolean]>
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered hidden.
@@ -1238,12 +1255,12 @@ Returns whether the element is hidden, the opposite of [visible](../actionabilit
### option: Frame.isHidden.timeout
* since: v1.8
+* deprecated: This option is ignored. [`method: Frame.isHidden`] does not wait for the element to become hidden and returns immediately.
- `timeout` <[float]>
-**DEPRECATED** This option is ignored. [`method: Frame.isHidden`] does not wait for the element to become hidden and returns immediately.
-
## async method: Frame.isVisible
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isVisible`] instead.
- returns: <[boolean]>
Returns whether the element is [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
@@ -1256,10 +1273,9 @@ Returns whether the element is [visible](../actionability.md#visible). [`option:
### option: Frame.isVisible.timeout
* since: v1.8
+* deprecated: This option is ignored. [`method: Frame.isVisible`] does not wait for the element to become visible and returns immediately.
- `timeout` <[float]>
-**DEPRECATED** This option is ignored. [`method: Frame.isVisible`] does not wait for the element to become visible and returns immediately.
-
## method: Frame.locator
* since: v1.14
- returns: <[Locator]>
@@ -1300,6 +1316,7 @@ Parent frame, if any. Detached frames and main frames return `null`.
## async method: Frame.press
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.press`] instead.
[`param: key`] can specify the intended
[keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to
@@ -1345,6 +1362,7 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
## async method: Frame.querySelector
* since: v1.9
+* discouraged: Use locator-based [`method: Frame.locator`] instead.
* langs:
- alias-python: query_selector
- alias-js: $
@@ -1368,6 +1386,7 @@ returns `null`.
## async method: Frame.querySelectorAll
* since: v1.9
+* discouraged: Use locator-based [`method: Frame.locator`] instead.
* langs:
- alias-python: query_selector_all
- alias-js: $$
@@ -1388,6 +1407,7 @@ returns empty array.
## async method: Frame.selectOption
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.selectOption`] instead.
- returns: <[Array]<[string]>>
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
@@ -1467,6 +1487,7 @@ await frame.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" })
## async method: Frame.setChecked
* since: v1.15
+* discouraged: Use locator-based [`method: Locator.setChecked`] instead.
This method checks or unchecks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -1524,6 +1545,7 @@ HTML markup to assign to the page.
## async method: Frame.setInputFiles
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.setInputFiles`] instead.
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 current working directory. For empty array, clears the selected files.
@@ -1548,6 +1570,7 @@ This method expects [`param: selector`] to point to an
## async method: Frame.tap
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.tap`] instead.
This method taps an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -1591,6 +1614,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: Frame.textContent
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.textContent`] instead.
- returns: <[null]|[string]>
Returns `element.textContent`.
@@ -1612,6 +1636,7 @@ Returns the page title.
## async method: Frame.type
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.type`] instead.
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `frame.type` can be used to
send fine-grained keyboard events. To fill values in form fields, use [`method: Frame.fill`].
@@ -1673,6 +1698,7 @@ Time to wait between key presses in milliseconds. Defaults to 0.
## async method: Frame.uncheck
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.uncheck`] instead.
This method checks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.md
index d68140902d..076209d005 100644
--- a/docs/src/api/class-locator.md
+++ b/docs/src/api/class-locator.md
@@ -876,10 +876,9 @@ Returns whether the element is hidden, the opposite of [visible](../actionabilit
### option: Locator.isHidden.timeout
* since: v1.14
+* deprecated: This option is ignored. [`method: Locator.isHidden`] does not wait for the element to become hidden and returns immediately.
- `timeout` <[float]>
-**DEPRECATED** This option is ignored. [`method: Locator.isHidden`] does not wait for the element to become hidden and returns immediately.
-
## async method: Locator.isVisible
* since: v1.14
- returns: <[boolean]>
@@ -888,10 +887,9 @@ Returns whether the element is [visible](../actionability.md#visible).
### option: Locator.isVisible.timeout
* since: v1.14
+* deprecated: This option is ignored. [`method: Locator.isVisible`] does not wait for the element to become visible and returns immediately.
- `timeout` <[float]>
-**DEPRECATED** This option is ignored. [`method: Locator.isVisible`] does not wait for the element to become visible and returns immediately.
-
## method: Locator.last
* since: v1.14
- returns: <[Locator]>
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index 3249eafcec..fc485f8cf9 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -558,10 +558,10 @@ page.
## property: Page.accessibility
* since: v1.8
* langs: csharp, js, python
+* deprecated: This property is discouraged. Please use other libraries such as
+ [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
- type: <[Accessibility]>
-**DEPRECATED** This property is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
-
## async method: Page.addInitScript
* since: v1.8
@@ -642,8 +642,6 @@ Optional argument to pass to [`param: script`] (only supported when passing a fu
Adds a `<script>` tag into the page with the desired url or content. Returns the added tag when the script's onload
fires or when the script content was injected into frame.
-Shortcut for main frame's [`method: Frame.addScriptTag`].
-
### option: Page.addScriptTag.url
* since: v1.8
- `url` <[string]>
@@ -677,8 +675,6 @@ Script type. Use 'module' in order to load a Javascript ES6 module. See
Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the
content. Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.
-Shortcut for main frame's [`method: Frame.addStyleTag`].
-
### option: Page.addStyleTag.url
* since: v1.8
- `url` <[string]>
@@ -705,6 +701,7 @@ Brings page to front (activates tab).
## async method: Page.check
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.check`] instead.
This method checks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -721,8 +718,6 @@ This method checks an element matching [`param: selector`] by performing the fol
When all steps combined have not finished during the specified [`option: timeout`], this method throws a
[TimeoutError]. Passing zero timeout disables this.
-Shortcut for main frame's [`method: Frame.check`].
-
### param: Page.check.selector = %%-input-selector-%%
* since: v1.8
@@ -746,6 +741,7 @@ Shortcut for main frame's [`method: Frame.check`].
## async method: Page.click
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.click`] instead.
This method clicks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -759,8 +755,6 @@ This method clicks an element matching [`param: selector`] by performing the fol
When all steps combined have not finished during the specified [`option: timeout`], this method throws a
[TimeoutError]. Passing zero timeout disables this.
-Shortcut for main frame's [`method: Frame.click`].
-
### param: Page.click.selector = %%-input-selector-%%
* since: v1.8
@@ -839,6 +833,7 @@ Browser-specific Coverage implementation. See [Coverage](#class-coverage) for mo
## async method: Page.dblclick
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.dblclick`] instead.
* langs:
- alias-csharp: DblClickAsync
@@ -859,8 +854,6 @@ When all steps combined have not finished during the specified [`option: timeout
`page.dblclick()` dispatches two `click` events and a single `dblclick` event.
:::
-Shortcut for main frame's [`method: Frame.dblclick`].
-
### param: Page.dblclick.selector = %%-input-selector-%%
* since: v1.8
@@ -893,6 +886,7 @@ Shortcut for main frame's [`method: Frame.dblclick`].
## async method: Page.dispatchEvent
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.dispatchEvent`] instead.
The snippet below dispatches the `click` event on the element. Regardless of the visibility state of the element, `click`
is dispatched. This is equivalent to calling
@@ -1283,6 +1277,7 @@ Emulates `'forced-colors'` media feature, supported values are `'active'` and `'
## async method: Page.evalOnSelector
* since: v1.9
+* discouraged: Use locator-based [`method: Locator.evaluate`] instead.
* langs:
- alias-python: eval_on_selector
- alias-js: $eval
@@ -1334,8 +1329,6 @@ var preloadHref = await page.EvalOnSelectorAsync<string>("link[rel=preload]", "e
var html = await page.EvalOnSelectorAsync(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello");
```
-Shortcut for main frame's [`method: Frame.evalOnSelector`].
-
### param: Page.evalOnSelector.selector = %%-query-selector-%%
* since: v1.9
@@ -1353,6 +1346,7 @@ Optional argument to pass to [`param: expression`].
## async method: Page.evalOnSelectorAll
* since: v1.9
+* discouraged: Use locator-based [`method: Locator.evaluateAll`] instead.
* langs:
- alias-python: eval_on_selector_all
- alias-js: $$eval
@@ -1508,8 +1502,6 @@ var html = await page.EvaluateAsync<string>("([body, suffix]) => body.innerHTML
await bodyHandle.DisposeAsync();
```
-Shortcut for main frame's [`method: Frame.evaluate`].
-
### param: Page.evaluate.expression = %%-evaluate-expression-%%
* since: v1.8
@@ -2054,6 +2046,7 @@ Callback function which will be called in Playwright's context.
## async method: Page.fill
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.fill`] instead.
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling. Note that you can pass an empty string to clear the input field.
@@ -2061,8 +2054,6 @@ If the target element is not an `<input>`, `<textarea>` or `[contenteditable]` e
To send fine-grained keyboard events, use [`method: Page.type`].
-Shortcut for main frame's [`method: Frame.fill`].
-
### param: Page.fill.selector = %%-input-selector-%%
* since: v1.8
@@ -2086,12 +2077,11 @@ Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
## async method: Page.focus
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.focus`] instead.
This method fetches an element with [`param: selector`] and focuses it. If there's no element matching
[`param: selector`], the method waits until a matching element appears in the DOM.
-Shortcut for main frame's [`method: Frame.focus`].
-
### param: Page.focus.selector = %%-input-selector-%%
* since: v1.8
@@ -2220,6 +2210,7 @@ An array of all frames attached to the page.
## async method: Page.getAttribute
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.getAttribute`] instead.
- returns: <[null]|[string]>
Returns element attribute value.
@@ -2371,8 +2362,6 @@ Headless mode doesn't support navigation to a PDF document. See the
[upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
:::
-Shortcut for main frame's [`method: Frame.goto`]
-
### param: Page.goto.url
* since: v1.8
- `url` <[string]>
@@ -2396,6 +2385,7 @@ Referer header value. If provided it will take preference over the referer heade
## async method: Page.hover
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.hover`] instead.
This method hovers over an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -2409,8 +2399,6 @@ This method hovers over an element matching [`param: selector`] by performing th
When all steps combined have not finished during the specified [`option: timeout`], this method throws a
[TimeoutError]. Passing zero timeout disables this.
-Shortcut for main frame's [`method: Frame.hover`].
-
### param: Page.hover.selector = %%-input-selector-%%
* since: v1.8
@@ -2437,6 +2425,7 @@ Shortcut for main frame's [`method: Frame.hover`].
## async method: Page.innerHTML
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.innerHTML`] instead.
- returns: <[string]>
Returns `element.innerHTML`.
@@ -2452,6 +2441,7 @@ Returns `element.innerHTML`.
## async method: Page.innerText
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.innerText`] instead.
- returns: <[string]>
Returns `element.innerText`.
@@ -2467,6 +2457,7 @@ Returns `element.innerText`.
## async method: Page.inputValue
* since: v1.13
+* discouraged: Use locator-based [`method: Locator.inputValue`] instead.
- returns: <[string]>
Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
@@ -2484,6 +2475,7 @@ Throws for non-input elements. However, if the element is inside the `<label>` e
## async method: Page.isChecked
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isChecked`] instead.
- returns: <[boolean]>
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
@@ -2505,6 +2497,7 @@ Indicates that the page has been closed.
## async method: Page.isDisabled
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isDisabled`] instead.
- returns: <[boolean]>
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
@@ -2520,6 +2513,7 @@ Returns whether the element is disabled, the opposite of [enabled](../actionabil
## async method: Page.isEditable
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isEditable`] instead.
- returns: <[boolean]>
Returns whether the element is [editable](../actionability.md#editable).
@@ -2535,6 +2529,7 @@ Returns whether the element is [editable](../actionability.md#editable).
## async method: Page.isEnabled
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isEnabled`] instead.
- returns: <[boolean]>
Returns whether the element is [enabled](../actionability.md#enabled).
@@ -2550,6 +2545,7 @@ Returns whether the element is [enabled](../actionability.md#enabled).
## async method: Page.isHidden
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isHidden`] instead.
- returns: <[boolean]>
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered hidden.
@@ -2562,12 +2558,13 @@ Returns whether the element is hidden, the opposite of [visible](../actionabilit
### option: Page.isHidden.timeout
* since: v1.8
+* deprecated: This option is ignored. [`method: Page.isHidden`] does not wait for the
+ element to become hidden and returns immediately.
- `timeout` <[float]>
-**DEPRECATED** This option is ignored. [`method: Page.isHidden`] does not wait for the element to become hidden and returns immediately.
-
## async method: Page.isVisible
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.isVisible`] instead.
- returns: <[boolean]>
Returns whether the element is [visible](../actionability.md#visible). [`option: selector`] that does not match any elements is considered not visible.
@@ -2580,10 +2577,10 @@ Returns whether the element is [visible](../actionability.md#visible). [`option:
### option: Page.isVisible.timeout
* since: v1.8
+* deprecated: This option is ignored. [`method: Page.isVisible`] does not wait
+ for the element to become visible and returns immediately.
- `timeout` <[float]>
-**DEPRECATED** This option is ignored. [`method: Page.isVisible`] does not wait for the element to become visible and returns immediately.
-
## property: Page.keyboard
* since: v1.8
- type: <[Keyboard]>
@@ -2834,6 +2831,7 @@ size.
## async method: Page.press
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.press`] instead.
Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].
@@ -2941,20 +2939,15 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
## async method: Page.querySelector
* since: v1.9
+* discouraged: Use locator-based [`method: Page.locator`] instead.
* langs:
- alias-python: query_selector
- alias-js: $
- returns: <[null]|[ElementHandle]>
-:::caution
-The use of [ElementHandle] is discouraged, use [Locator] objects and web-first assertions instead.
-:::
-
The method finds an element matching the specified selector within the page. If no elements match the selector, the
return value resolves to `null`. To wait for an element on the page, use [`method: Locator.waitFor`].
-Shortcut for main frame's [`method: Frame.querySelector`].
-
### param: Page.querySelector.selector = %%-query-selector-%%
* since: v1.9
@@ -2963,20 +2956,15 @@ Shortcut for main frame's [`method: Frame.querySelector`].
## async method: Page.querySelectorAll
* since: v1.9
+* discouraged: Use locator-based [`method: Page.locator`] instead.
* langs:
- alias-python: query_selector_all
- alias-js: $$
- returns: <[Array]<[ElementHandle]>>
-:::caution
-The use of [ElementHandle] is discouraged, use [Locator] objects and web-first assertions instead.
-:::
-
The method finds all elements matching the specified selector within the page. If no elements match the selector, the
return value resolves to `[]`.
-Shortcut for main frame's [`method: Frame.querySelectorAll`].
-
### param: Page.querySelectorAll.selector = %%-query-selector-%%
* since: v1.9
@@ -3227,6 +3215,7 @@ Returns the buffer with the captured screenshot.
## async method: Page.selectOption
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.selectOption`] instead.
- returns: <[Array]<[string]>>
This method waits for an element matching [`param: selector`], waits for [actionability](../actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
@@ -3287,8 +3276,6 @@ await page.SelectOptionAsync("select#colors", new[] { new SelectOptionValue() {
await page.SelectOptionAsync("select#colors", new[] { "red", "green", "blue" });
```
-Shortcut for main frame's [`method: Frame.selectOption`].
-
### param: Page.selectOption.selector = %%-input-selector-%%
* since: v1.8
@@ -3309,6 +3296,7 @@ Shortcut for main frame's [`method: Frame.selectOption`].
## async method: Page.setChecked
* since: v1.15
+* discouraged: Use locator-based [`method: Locator.setChecked`] instead.
This method checks or unchecks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -3325,8 +3313,6 @@ This method checks or unchecks an element matching [`param: selector`] by perfor
When all steps combined have not finished during the specified [`option: timeout`], this method throws a
[TimeoutError]. Passing zero timeout disables this.
-Shortcut for main frame's [`method: Frame.setChecked`].
-
### param: Page.setChecked.selector = %%-input-selector-%%
* since: v1.15
@@ -3421,6 +3407,7 @@ An object containing additional HTTP headers to be sent with every request. All
## async method: Page.setInputFiles
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.setInputFiles`] instead.
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 current working directory. For empty array, clears the selected files.
@@ -3506,6 +3493,7 @@ await page.GotoAsync("https://www.microsoft.com");
## async method: Page.tap
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.tap`] instead.
This method taps an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -3523,8 +3511,6 @@ When all steps combined have not finished during the specified [`option: timeout
[`method: Page.tap`] requires that the [`option: hasTouch`] option of the browser context be set to true.
:::
-Shortcut for main frame's [`method: Frame.tap`].
-
### param: Page.tap.selector = %%-input-selector-%%
* since: v1.8
@@ -3551,6 +3537,7 @@ Shortcut for main frame's [`method: Frame.tap`].
## async method: Page.textContent
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.textContent`] instead.
- returns: <[null]|[string]>
Returns `element.textContent`.
@@ -3568,7 +3555,7 @@ Returns `element.textContent`.
* since: v1.8
- returns: <[string]>
-Returns the page's title. Shortcut for main frame's [`method: Frame.title`].
+Returns the page's title.
## property: Page.touchscreen
* since: v1.8
@@ -3576,6 +3563,7 @@ Returns the page's title. Shortcut for main frame's [`method: Frame.title`].
## async method: Page.type
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.type`] instead.
Sends a `keydown`, `keypress`/`input`, and `keyup` event for each character in the text. `page.type` can be used to send
fine-grained keyboard events. To fill values in form fields, use [`method: Page.fill`].
@@ -3611,8 +3599,6 @@ await page.TypeAsync("#mytextarea", "hello"); // types instantly
await page.TypeAsync("#mytextarea", "world", new() { Delay = 100 }); // types slower, like a user
```
-Shortcut for main frame's [`method: Frame.type`].
-
### param: Page.type.selector = %%-input-selector-%%
* since: v1.8
@@ -3639,6 +3625,7 @@ Time to wait between key presses in milliseconds. Defaults to 0.
## async method: Page.uncheck
* since: v1.8
+* discouraged: Use locator-based [`method: Locator.uncheck`] instead.
This method unchecks an element matching [`param: selector`] by performing the following steps:
1. Find an element matching [`param: selector`]. If there is none, wait until a matching element is attached to
@@ -3655,8 +3642,6 @@ This method unchecks an element matching [`param: selector`] by performing the f
When all steps combined have not finished during the specified [`option: timeout`], this method throws a
[TimeoutError]. Passing zero timeout disables this.
-Shortcut for main frame's [`method: Frame.uncheck`].
-
### param: Page.uncheck.selector = %%-input-selector-%%
* since: v1.8
@@ -3708,8 +3693,6 @@ Optional handler function to route the request.
* since: v1.8
- returns: <[string]>
-Shortcut for main frame's [`method: Frame.url`].
-
## method: Page.video
* since: v1.8
- returns: <[null]|[Video]>
@@ -3956,8 +3939,6 @@ var selector = ".foo";
await page.WaitForFunctionAsync("selector => !!document.querySelector(selector)", selector);
```
-Shortcut for main frame's [`method: Frame.waitForFunction`].
-
### param: Page.waitForFunction.expression = %%-evaluate-expression-%%
* since: v1.8
@@ -4057,8 +4038,6 @@ await popup.WaitForLoadStateAsync(LoadState.DOMContentLoaded);
Console.WriteLine(await popup.TitleAsync()); // popup is ready to use.
```
-Shortcut for main frame's [`method: Frame.waitForLoadState`].
-
### param: Page.waitForLoadState.state = %%-wait-for-load-state-state-%%
* since: v1.8
@@ -4127,8 +4106,6 @@ Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/Hist
a navigation.
:::
-Shortcut for main frame's [`method: Frame.waitForNavigation`].
-
### option: Page.waitForNavigation.url = %%-wait-for-navigation-url-%%
* since: v1.8
@@ -4559,8 +4536,6 @@ page.wait_for_timeout(1000)
await page.WaitForTimeoutAsync(1000);
```
-Shortcut for main frame's [`method: Frame.waitForTimeout`].
-
### param: Page.waitForTimeout.timeout
* since: v1.8
- `timeout` <[float]>
@@ -4599,8 +4574,6 @@ await page.ClickAsync("a.delayed-navigation"); // clicking the link will indirec
await page.WaitForURLAsync("**/target.html");
```
-Shortcut for main frame's [`method: Frame.waitForURL`].
-
### param: Page.waitForURL.url = %%-wait-for-navigation-url-%%
* since: v1.11
diff --git a/docs/src/api/params.md b/docs/src/api/params.md
index cac56703c1..8fff325deb 100644
--- a/docs/src/api/params.md
+++ b/docs/src/api/params.md
@@ -568,18 +568,16 @@ Logger sink for Playwright logging.
## context-option-videospath
* langs: js
+* deprecated: Use [`option: recordVideo`] instead.
- `videosPath` <[path]>
-**DEPRECATED** Use [`option: recordVideo`] instead.
-
## context-option-videosize
* langs: js
+* deprecated: Use [`option: recordVideo`] instead.
- `videoSize` <[Object]>
- `width` <[int]> Video frame width.
- `height` <[int]> Video frame height.
-**DEPRECATED** Use [`option: recordVideo`] instead.
-
## context-option-recordhar
* langs: js
- `recordHar` <[Object]>
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index 02c7ab2dc9..b6a8f4faec 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -116,8 +116,6 @@ export interface Page {
* await bodyHandle.dispose();
* ```
*
- * Shortcut for main frame's
- * [frame.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-frame#frame-evaluate).
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
*/
@@ -165,8 +163,6 @@ export interface Page {
* await bodyHandle.dispose();
* ```
*
- * Shortcut for main frame's
- * [frame.evaluate(pageFunction[, arg])](https://playwright.dev/docs/api/class-frame#frame-evaluate).
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
*/
@@ -290,51 +286,31 @@ export interface Page {
addInitScript<Arg>(script: PageFunction<Arg, any> | { path?: string, content?: string }, arg?: Arg): Promise<void>;
/**
- * > NOTE: The use of [ElementHandle] is discouraged, use [Locator] objects and web-first assertions instead.
- *
* The method finds an element matching the specified selector within the page. If no elements match the selector, the
* return value resolves to `null`. To wait for an element on the page, use
* [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for).
- *
- * Shortcut for main frame's
- * [frame.$(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-query-selector).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
$<K extends keyof HTMLElementTagNameMap>(selector: K, options?: { strict: boolean }): Promise<ElementHandleForTag<K> | null>;
/**
- * > NOTE: The use of [ElementHandle] is discouraged, use [Locator] objects and web-first assertions instead.
- *
* The method finds an element matching the specified selector within the page. If no elements match the selector, the
* return value resolves to `null`. To wait for an element on the page, use
* [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for).
- *
- * Shortcut for main frame's
- * [frame.$(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-query-selector).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
$(selector: string, options?: { strict: boolean }): Promise<ElementHandle<SVGElement | HTMLElement> | null>;
/**
- * > NOTE: The use of [ElementHandle] is discouraged, use [Locator] objects and web-first assertions instead.
- *
* The method finds all elements matching the specified selector within the page. If no elements match the selector,
* the return value resolves to `[]`.
- *
- * Shortcut for main frame's
- * [frame.$$(selector)](https://playwright.dev/docs/api/class-frame#frame-query-selector-all).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
*/
$$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K>[]>;
/**
- * > NOTE: The use of [ElementHandle] is discouraged, use [Locator] objects and web-first assertions instead.
- *
* The method finds all elements matching the specified selector within the page. If no elements match the selector,
* the return value resolves to `[]`.
- *
- * Shortcut for main frame's
- * [frame.$$(selector)](https://playwright.dev/docs/api/class-frame#frame-query-selector-all).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
*/
$$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement>[]>;
@@ -362,8 +338,6 @@ export interface Page {
* const preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);
* ```
*
- * Shortcut for main frame's
- * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
@@ -393,8 +367,6 @@ export interface Page {
* const preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);
* ```
*
- * Shortcut for main frame's
- * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
@@ -424,8 +396,6 @@ export interface Page {
* const preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);
* ```
*
- * Shortcut for main frame's
- * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
@@ -455,8 +425,6 @@ export interface Page {
* const preloadHrefTS = await page.$eval('link[rel=preload]', (el: HTMLLinkElement) => el.href);
* ```
*
- * Shortcut for main frame's
- * [frame.$eval(selector, pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-eval-on-selector).
* @param selector A selector to query for. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
@@ -588,8 +556,6 @@ export interface Page {
* await page.waitForFunction(selector => !!document.querySelector(selector), selector);
* ```
*
- * Shortcut for main frame's
- * [frame.waitForFunction(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-wait-for-function).
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
* @param options
@@ -626,8 +592,6 @@ export interface Page {
* await page.waitForFunction(selector => !!document.querySelector(selector), selector);
* ```
*
- * Shortcut for main frame's
- * [frame.waitForFunction(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-frame#frame-wait-for-function).
* @param pageFunction Function to be evaluated in the page context.
* @param arg Optional argument to pass to `pageFunction`.
* @param options
@@ -1785,19 +1749,13 @@ export interface Page {
prependListener(event: 'worker', listener: (worker: Worker) => void): this;
/**
- * **DEPRECATED** This property is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if
- * you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
- * integration with Axe.
- * @deprecated
+ * @deprecated This property is discouraged. Please use other libraries such as↵[Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
*/
accessibility: Accessibility;
/**
* Adds a `<script>` tag into the page with the desired url or content. Returns the added tag when the script's onload
* fires or when the script content was injected into frame.
- *
- * Shortcut for main frame's
- * [frame.addScriptTag([options])](https://playwright.dev/docs/api/class-frame#frame-add-script-tag).
* @param options
*/
addScriptTag(options?: {
@@ -1827,9 +1785,6 @@ export interface Page {
/**
* Adds a `<link rel="stylesheet">` tag into the page with the desired url or a `<style type="text/css">` tag with the
* content. Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.
- *
- * Shortcut for main frame's
- * [frame.addStyleTag([options])](https://playwright.dev/docs/api/class-frame#frame-add-style-tag).
* @param options
*/
addStyleTag(options?: {
@@ -1870,9 +1825,6 @@ export interface Page {
*
* When all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError].
* Passing zero timeout disables this.
- *
- * Shortcut for main frame's
- * [frame.check(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-check).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
@@ -1932,9 +1884,6 @@ export interface Page {
*
* When all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError].
* Passing zero timeout disables this.
- *
- * Shortcut for main frame's
- * [frame.click(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-click).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
@@ -2053,9 +2002,6 @@ export interface Page {
* Passing zero timeout disables this.
*
* > NOTE: `page.dblclick()` dispatches two `click` events and a single `dblclick` event.
- *
- * Shortcut for main frame's
- * [frame.dblclick(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-dblclick).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
@@ -2363,9 +2309,6 @@ export interface Page {
*
* To send fine-grained keyboard events, use
* [page.type(selector, text[, options])](https://playwright.dev/docs/api/class-page#page-type).
- *
- * Shortcut for main frame's
- * [frame.fill(selector, value[, options])](https://playwright.dev/docs/api/class-frame#frame-fill).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param value Value to fill for the `<input>`, `<textarea>` or `[contenteditable]` element.
* @param options
@@ -2401,9 +2344,6 @@ export interface Page {
/**
* 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.
- *
- * Shortcut for main frame's
- * [frame.focus(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-focus).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
@@ -2793,8 +2733,6 @@ export interface Page {
* 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).
- *
- * Shortcut for main frame's [frame.goto(url[, options])](https://playwright.dev/docs/api/class-frame#frame-goto)
* @param url URL to navigate page to. The url should include scheme, e.g. `https://`. When a `baseURL` via the context options was provided and the passed URL is a path, it gets merged via the
* [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor.
* @param options
@@ -2840,9 +2778,6 @@ export interface Page {
*
* When all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError].
* Passing zero timeout disables this.
- *
- * Shortcut for main frame's
- * [frame.hover(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-hover).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
@@ -3066,10 +3001,7 @@ export interface Page {
strict?: boolean;
/**
- * **DEPRECATED** This option is ignored.
- * [page.isHidden(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-hidden) does not wait for
- * the element to become hidden and returns immediately.
- * @deprecated
+ * @deprecated This option is ignored. [`method: Page.isHidden`] does not wait for the↵element to become hidden and returns immediately.
*/
timeout?: number;
}): Promise<boolean>;
@@ -3088,10 +3020,7 @@ export interface Page {
strict?: boolean;
/**
- * **DEPRECATED** This option is ignored.
- * [page.isVisible(selector[, options])](https://playwright.dev/docs/api/class-page#page-is-visible) does not wait for
- * the element to become visible and returns immediately.
- * @deprecated
+ * @deprecated This option is ignored. [`method: Page.isVisible`] does not wait↵for the element to become visible and returns immediately.
*/
timeout?: number;
}): Promise<boolean>;
@@ -3533,8 +3462,6 @@ export interface Page {
*
* ```
*
- * Shortcut for main frame's
- * [frame.selectOption(selector, values[, options])](https://playwright.dev/docs/api/class-frame#frame-select-option).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param values 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.
@@ -3613,9 +3540,6 @@ export interface Page {
*
* When all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError].
* Passing zero timeout disables this.
- *
- * Shortcut for main frame's
- * [frame.setChecked(selector, checked[, options])](https://playwright.dev/docs/api/class-frame#frame-set-checked).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param checked Whether to check or uncheck the checkbox.
* @param options
@@ -3850,8 +3774,6 @@ export interface Page {
*
* > NOTE: [page.tap(selector[, options])](https://playwright.dev/docs/api/class-page#page-tap) requires that the
* `hasTouch` option of the browser context be set to true.
- *
- * Shortcut for main frame's [frame.tap(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-tap).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
@@ -3927,8 +3849,7 @@ export interface Page {
}): Promise<null|string>;
/**
- * Returns the page's title. Shortcut for main frame's
- * [frame.title()](https://playwright.dev/docs/api/class-frame#frame-title).
+ * Returns the page's title.
*/
title(): Promise<string>;
@@ -3949,8 +3870,6 @@ export interface Page {
* await page.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
* ```
*
- * Shortcut for main frame's
- * [frame.type(selector, text[, options])](https://playwright.dev/docs/api/class-frame#frame-type).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param text A text to type into a focused element.
* @param options
@@ -3998,9 +3917,6 @@ export interface Page {
*
* When all steps combined have not finished during the specified `timeout`, this method throws a [TimeoutError].
* Passing zero timeout disables this.
- *
- * Shortcut for main frame's
- * [frame.uncheck(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-uncheck).
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See [working with selectors](https://playwright.dev/docs/selectors) for more details.
* @param options
*/
@@ -4057,9 +3973,6 @@ export interface Page {
*/
unroute(url: string|RegExp|((url: URL) => boolean), handler?: ((route: Route, request: Request) => void)): Promise<void>;
- /**
- * Shortcut for main frame's [frame.url()](https://playwright.dev/docs/api/class-frame#frame-url).
- */
url(): string;
/**
@@ -4307,8 +4220,6 @@ export interface Page {
* console.log(await popup.title()); // Popup is ready to use.
* ```
*
- * Shortcut for main frame's
- * [frame.waitForLoadState([state, options])](https://playwright.dev/docs/api/class-frame#frame-wait-for-load-state).
* @param state 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.
* - `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
@@ -4351,9 +4262,6 @@ export interface Page {
*
* > 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.
- *
- * Shortcut for main frame's
- * [frame.waitForNavigation([options])](https://playwright.dev/docs/api/class-frame#frame-wait-for-navigation).
* @param options
*/
waitForNavigation(options?: {
@@ -4475,8 +4383,6 @@ export interface Page {
* await page.waitForTimeout(1000);
* ```
*
- * Shortcut for main frame's
- * [frame.waitForTimeout(timeout)](https://playwright.dev/docs/api/class-frame#frame-wait-for-timeout).
* @param timeout A timeout to wait for
*/
waitForTimeout(timeout: number): Promise<void>;
@@ -4491,8 +4397,6 @@ export interface Page {
* await page.waitForURL('**\/target.html');
* ```
*
- * Shortcut for main frame's
- * [frame.waitForURL(url[, options])](https://playwright.dev/docs/api/class-frame#frame-wait-for-url).
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly
* equal to the string.
* @param options
@@ -6231,10 +6135,7 @@ export interface Frame {
strict?: boolean;
/**
- * **DEPRECATED** This option is ignored.
- * [frame.isHidden(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-hidden) does not wait
- * for the element to become hidden and returns immediately.
- * @deprecated
+ * @deprecated This option is ignored. [`method: Frame.isHidden`] does not wait for the element to become hidden and returns immediately.
*/
timeout?: number;
}): Promise<boolean>;
@@ -6253,10 +6154,7 @@ export interface Frame {
strict?: boolean;
/**
- * **DEPRECATED** This option is ignored.
- * [frame.isVisible(selector[, options])](https://playwright.dev/docs/api/class-frame#frame-is-visible) does not wait
- * for the element to become visible and returns immediately.
- * @deprecated
+ * @deprecated This option is ignored. [`method: Frame.isVisible`] does not wait for the element to become visible and returns immediately.
*/
timeout?: number;
}): Promise<boolean>;
@@ -7868,9 +7766,7 @@ export interface BrowserContext {
}): Promise<void>;
/**
- * **DEPRECATED** Browsers may cache credentials after successful authentication. Create a new browser context
- * instead.
- * @deprecated
+ * @deprecated Browsers may cache credentials after successful authentication. Create a new browser context instead.
* @param httpCredentials
*/
setHTTPCredentials(httpCredentials: null|{
@@ -10765,10 +10661,7 @@ export interface Locator {
*/
isHidden(options?: {
/**
- * **DEPRECATED** This option is ignored.
- * [locator.isHidden([options])](https://playwright.dev/docs/api/class-locator#locator-is-hidden) does not wait for
- * the element to become hidden and returns immediately.
- * @deprecated
+ * @deprecated This option is ignored. [`method: Locator.isHidden`] does not wait for the element to become hidden and returns immediately.
*/
timeout?: number;
}): Promise<boolean>;
@@ -10779,10 +10672,7 @@ export interface Locator {
*/
isVisible(options?: {
/**
- * **DEPRECATED** This option is ignored.
- * [locator.isVisible([options])](https://playwright.dev/docs/api/class-locator#locator-is-visible) does not wait for
- * the element to become visible and returns immediately.
- * @deprecated
+ * @deprecated This option is ignored. [`method: Locator.isVisible`] does not wait for the element to become visible and returns immediately.
*/
timeout?: number;
}): Promise<boolean>;
@@ -11828,8 +11718,7 @@ export interface BrowserType<Unused = {}> {
userAgent?: string;
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videoSize?: {
/**
@@ -11844,8 +11733,7 @@ export interface BrowserType<Unused = {}> {
};
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videosPath?: string;
@@ -12117,10 +12005,6 @@ class TimeoutError extends Error {}
}
/**
- * **DEPRECATED** This class is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if
- * you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
- * integration with Axe.
- *
* The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is
* used by assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
* [switches](https://en.wikipedia.org/wiki/Switch_access).
@@ -12137,10 +12021,6 @@ class TimeoutError extends Error {}
*/
export interface Accessibility {
/**
- * **DEPRECATED** This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if
- * you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for
- * integration with Axe.
- *
* Captures the current state of the accessibility tree. The returned object represents the root accessible node of
* the page.
*
@@ -12175,7 +12055,7 @@ export interface Accessibility {
* }
* ```
*
- * @deprecated
+ * @deprecated This method is deprecated. Please use other libraries such as [Axe](https://www.deque.com/axe/) if you need to test page accessibility. See our Node.js [guide](https://playwright.dev/docs/accessibility-testing) for integration with Axe.
* @param options
*/
snapshot(options?: AccessibilitySnapshotOptions): Promise<null|AccessibilityNode>;
@@ -13164,8 +13044,7 @@ export interface AndroidDevice {
userAgent?: string;
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videoSize?: {
/**
@@ -13180,8 +13059,7 @@ export interface AndroidDevice {
};
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videosPath?: string;
@@ -15066,8 +14944,7 @@ export interface Browser extends EventEmitter {
userAgent?: string;
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videoSize?: {
/**
@@ -15082,8 +14959,7 @@ export interface Browser extends EventEmitter {
};
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videosPath?: string;
@@ -17976,8 +17852,7 @@ export interface BrowserContextOptions {
userAgent?: string;
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videoSize?: {
/**
@@ -17992,8 +17867,7 @@ export interface BrowserContextOptions {
};
/**
- * **DEPRECATED** Use `recordVideo` instead.
- * @deprecated
+ * @deprecated Use [`option: recordVideo`] instead.
*/
videosPath?: string;
diff --git a/utils/doclint/api_parser.js b/utils/doclint/api_parser.js
index 9373ce77bc..c21be41002 100644
--- a/utils/doclint/api_parser.js
+++ b/utils/doclint/api_parser.js
@@ -45,7 +45,7 @@ class ApiParser {
const params = paramsPath ? md.parse(fs.readFileSync(paramsPath).toString()) : undefined;
checkNoDuplicateParamEntries(params);
const api = params ? applyTemplates(body, params) : body;
- /** @type {Map<string, documentation.Class>} */
+ /** @type {Map<string, docs.Class>} */
this.classes = new Map();
md.visitAll(api, node => {
if (node.type === 'h1')
@@ -118,7 +118,7 @@ class ApiParser {
if (!member)
throw new Error('Unknown member: ' + spec.text);
- const clazz = /** @type {documentation.Class} */(this.classes.get(match[2]));
+ const clazz = /** @type {docs.Class} */(this.classes.get(match[2]));
const existingMember = clazz.membersArray.find(m => m.name === name && m.kind === member.kind);
if (existingMember && isTypeOverride(existingMember, member)) {
for (const lang of member?.langs?.only || []) {
@@ -174,7 +174,7 @@ class ApiParser {
let options = method.argsArray.find(o => o.name === 'options');
if (!options) {
const type = new docs.Type('Object', []);
- options = docs.Member.createProperty({ langs: {}, experimental: false, since: 'v1.0' }, 'options', type, undefined, false);
+ options = docs.Member.createProperty({ langs: {}, experimental: false, since: 'v1.0', deprecated: undefined, discouraged: undefined }, 'options', type, undefined, false);
method.argsArray.push(options);
}
const p = this.parseProperty(spec);
@@ -201,7 +201,7 @@ class ApiParser {
/**
* @param {MarkdownLiNode} spec
- * @return {{ type: documentation.Type, optional: boolean, experimental: boolean }}
+ * @return {{ type: docs.Type, optional: boolean, experimental: boolean }}
*/
parseType(spec) {
const arg = parseVariable(spec.text);
@@ -210,7 +210,7 @@ class ApiParser {
const { name, text } = parseVariable(/** @type {string} */(child.text));
const comments = /** @type {MarkdownNode[]} */ ([{ type: 'text', text }]);
const childType = this.parseType(child);
- properties.push(docs.Member.createProperty({ langs: {}, experimental: childType.experimental, since: 'v1.0' }, name, childType.type, comments, !childType.optional));
+ properties.push(docs.Member.createProperty({ langs: {}, experimental: childType.experimental, since: 'v1.0', deprecated: undefined, discouraged: undefined }, name, childType.type, comments, !childType.optional));
}
const type = docs.Type.parse(arg.type, properties);
return { type, optional: arg.optional, experimental: arg.experimental };
@@ -345,7 +345,9 @@ function extractMetainfo(spec) {
return {
langs: extractLangs(spec),
since: extractSince(spec),
- experimental: extractExperimental(spec)
+ experimental: extractExperimental(spec),
+ deprecated: extractAttribute(spec, 'deprecated'),
+ discouraged: extractAttribute(spec, 'discouraged'),
};
}
@@ -403,20 +405,33 @@ function extractSince(spec) {
return false;
}
+/**
+ * @param {MarkdownHeaderNode} spec
+ * @param {string} name
+ * @returns {string | undefined}
+ */
+ function extractAttribute(spec, name) {
+ for (const child of spec.children) {
+ if (child.type !== 'li' || child.liType !== 'bullet' || !child.text.startsWith(name + ':'))
+ continue;
+ return child.text.substring(child.text.indexOf(':') + 1).trim() || undefined;
+ }
+}
+
/**
* @param {MarkdownHeaderNode} spec
* @returns {MarkdownNode[]}
*/
function childrenWithoutProperties(spec) {
return (spec.children || []).filter(c => {
- const isProperty = c.type === 'li' && c.liType === 'bullet' && (c.text.startsWith('langs:') || c.text.startsWith('since:') || c.text === 'experimental');
+ const isProperty = c.type === 'li' && c.liType === 'bullet' && (c.text.startsWith('langs:') || c.text.startsWith('since:') || c.text.startsWith('deprecated:') || c.text.startsWith('discouraged:') || c.text === 'experimental');
return !isProperty;
});
}
/**
- * @param {documentation.Member} existingMember
- * @param {documentation.Member} member
+ * @param {docs.Member} existingMember
+ * @param {docs.Member} member
* @returns {boolean}
*/
function isTypeOverride(existingMember, member) {
diff --git a/utils/doclint/cli.js b/utils/doclint/cli.js
index 2e48aa095e..57924b87a4 100755
--- a/utils/doclint/cli.js
+++ b/utils/doclint/cli.js
@@ -192,7 +192,7 @@ async function run() {
// Validates code snippet groups.
rootNode = docs.processCodeGroups(rootNode, lang, tabs => tabs.map(tab => tab.spec));
// Renders links.
- documentation.renderLinksInText(rootNode);
+ documentation.renderLinksInNodes(rootNode);
// Validate links.
{
md.visitAll(rootNode, node => {
diff --git a/utils/doclint/documentation.js b/utils/doclint/documentation.js
index 276c0654d8..06c1f5f9ae 100644
--- a/utils/doclint/documentation.js
+++ b/utils/doclint/documentation.js
@@ -55,6 +55,8 @@ const md = require('../markdown');
* @typedef {{
* langs: Langs,
* since: string,
+ * deprecated: string | undefined,
+ * discouraged: string | undefined,
* experimental: boolean
* }} Metainfo
*/
@@ -162,20 +164,33 @@ class Documentation {
membersMap.set(`${member.kind}: ${clazz.name}.${member.name}`, member);
}
/**
- * @param {Class|Member|null} classOrMember
- * @param {MarkdownNode[] | undefined} nodes
+ * @param {Class|Member|undefined} classOrMember
+ * @param {string} text
*/
- this._patchLinks = (classOrMember, nodes) => patchLinks(classOrMember, nodes, classesMap, membersMap, linkRenderer);
+ this._patchLinksInText = (classOrMember, text) => patchLinksInText(classOrMember, text, classesMap, membersMap, linkRenderer);
for (const clazz of this.classesArray)
- clazz.visit(item => this._patchLinks?.(item, item.spec));
+ clazz.visit(item => item.spec && this.renderLinksInNodes(item.spec, item));
}
/**
* @param {MarkdownNode[]} nodes
+ * @param {Class|Member=} classOrMember
*/
- renderLinksInText(nodes) {
- this._patchLinks?.(null, nodes);
+ renderLinksInNodes(nodes, classOrMember) {
+ md.visitAll(nodes, node => {
+ if (!node.text)
+ return;
+ node.text = this.renderLinksInText(node.text, classOrMember);
+ });
+ }
+
+ /**
+ * @param {string} text
+ * @param {Class|Member=} classOrMember
+ */
+ renderLinksInText(text, classOrMember) {
+ return this._patchLinksInText?.(classOrMember, text);
}
/**
@@ -214,6 +229,8 @@ class Documentation {
this.langs = metainfo.langs;
this.experimental = metainfo.experimental;
this.since = metainfo.since;
+ this.deprecated = metainfo.deprecated;
+ this.discouraged = metainfo.discouraged;
this.name = name;
this.membersArray = membersArray;
this.spec = spec;
@@ -265,7 +282,7 @@ class Documentation {
}
clone() {
- const cls = new Class({ langs: this.langs, experimental: this.experimental, since: this.since }, this.name, this.membersArray.map(m => m.clone()), this.extends, this.spec);
+ const cls = new Class({ langs: this.langs, experimental: this.experimental, since: this.since, deprecated: this.deprecated, discouraged: this.discouraged }, this.name, this.membersArray.map(m => m.clone()), this.extends, this.spec);
cls.comment = this.comment;
return cls;
}
@@ -369,6 +386,8 @@ class Member {
this.langs = metainfo.langs;
this.experimental = metainfo.experimental;
this.since = metainfo.since;
+ this.deprecated = metainfo.deprecated;
+ this.discouraged = metainfo.discouraged;
this.name = name;
this.type = type;
this.spec = spec;
@@ -382,13 +401,6 @@ class Member {
this.clazz = null;
/** @type {Member=} */
this.enclosingMethod = undefined;
- this.deprecated = false;
- if (spec) {
- md.visitAll(spec, node => {
- if (node.text && node.text.includes('**DEPRECATED**'))
- this.deprecated = true;
- });
- };
this.async = false;
this.alias = name;
this.overloadIndex = 0;
@@ -472,7 +484,7 @@ class Member {
}
clone() {
- const result = new Member(this.kind, { langs: this.langs, experimental: this.experimental, since: this.since }, this.name, this.type?.clone(), this.argsArray.map(arg => arg.clone()), this.spec, this.required);
+ const result = new Member(this.kind, { langs: this.langs, experimental: this.experimental, since: this.since, deprecated: this.deprecated, discouraged: this.discouraged }, this.name, this.type?.clone(), this.argsArray.map(arg => arg.clone()), this.spec, this.required);
result.alias = this.alias;
result.async = this.async;
result.paramOrOption = this.paramOrOption;
@@ -801,50 +813,45 @@ function matchingBracket(str, open, close) {
}
/**
- * @param {Class|Member|null} classOrMember
- * @param {MarkdownNode[]|undefined} spec
+ * @param {Class|Member|undefined} classOrMember
+ * @param {string} text
* @param {Map<string, Class>} classesMap
* @param {Map<string, Member>} membersMap
* @param {Renderer} linkRenderer
*/
-function patchLinks(classOrMember, spec, classesMap, membersMap, linkRenderer) {
- if (!spec)
- return;
- md.visitAll(spec, node => {
- if (!node.text)
- return;
- node.text = node.text.replace(/\[`(\w+): ([^\]]+)`\](?:\(([^)]*?)\))?/g, (match, p1, p2, href) => {
- if (['event', 'method', 'property'].includes(p1)) {
- const memberName = p1 + ': ' + p2;
- const member = membersMap.get(memberName);
- if (!member)
- throw new Error('Undefined member references: ' + match);
- return linkRenderer({ member, href }) || match;
- }
- if (p1 === 'param') {
- let alias = p2;
- if (classOrMember) {
- // param/option reference can only be in method or same method parameter comments.
- // @ts-ignore
- const method = classOrMember.enclosingMethod;
- const param = method.argsArray.find(a => a.name === p2);
- if (!param)
- throw new Error(`Referenced parameter ${match} not found in the parent method ${method.name} `);
- alias = param.alias;
- }
- return linkRenderer({ param: alias, href }) || match;
+function patchLinksInText(classOrMember, text, classesMap, membersMap, linkRenderer) {
+ text = text.replace(/\[`(\w+): ([^\]]+)`\](?:\(([^)]*?)\))?/g, (match, p1, p2, href) => {
+ if (['event', 'method', 'property'].includes(p1)) {
+ const memberName = p1 + ': ' + p2;
+ const member = membersMap.get(memberName);
+ if (!member)
+ throw new Error('Undefined member references: ' + match);
+ return linkRenderer({ member, href }) || match;
+ }
+ if (p1 === 'param') {
+ let alias = p2;
+ if (classOrMember) {
+ // param/option reference can only be in method or same method parameter comments.
+ // @ts-ignore
+ const method = classOrMember.enclosingMethod;
+ const param = method.argsArray.find(a => a.name === p2);
+ if (!param)
+ throw new Error(`Referenced parameter ${match} not found in the parent method ${method.name} `);
+ alias = param.alias;
}
- if (p1 === 'option')
- return linkRenderer({ option: p2, href }) || match;
- throw new Error(`Undefined link prefix, expected event|method|property|param|option, got: ` + match);
- });
- node.text = node.text.replace(/\[([\w]+)\](?:\(([^)]*?)\))?/g, (match, p1, href) => {
- const clazz = classesMap.get(p1);
- if (clazz)
- return linkRenderer({ clazz, href }) || match;
- return match;
- });
+ return linkRenderer({ param: alias, href }) || match;
+ }
+ if (p1 === 'option')
+ return linkRenderer({ option: p2, href }) || match;
+ throw new Error(`Undefined link prefix, expected event|method|property|param|option, got: ` + match);
+ });
+ text = text.replace(/\[([\w]+)\](?:\(([^)]*?)\))?/g, (match, p1, href) => {
+ const clazz = classesMap.get(p1);
+ if (clazz)
+ return linkRenderer({ clazz, href }) || match;
+ return match;
});
+ return text;
}
/**
diff --git a/utils/generate_types/index.js b/utils/generate_types/index.js
index a4ed499b41..9a4fbb2b69 100644
--- a/utils/generate_types/index.js
+++ b/utils/generate_types/index.js
@@ -474,7 +474,7 @@ class TypesGenerator {
if (member.comment)
lines.push(...member.comment.split('\n'));
if (member.deprecated)
- lines.push('@deprecated');
+ lines.push('@deprecated ' + member.deprecated);
lines.push(...member.argsArray.map(arg => `@param ${arg.alias.replace(/\./g, '')} ${arg.comment.replace('\n', ' ')}`));
if (!lines.length)
return indent;