mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-12 11:50:22 +03:00
chore: discourage methods on ElementHandle (#28637)
Mirrors the deprecations from page.* over to ElementHandle.
This commit is contained in:
parent
e31e5b1b7c
commit
e8c8852c00
@ -156,6 +156,7 @@ await page.Mouse.ClickAsync(box.X + box.Width / 2, box.Y + box.Height / 2);
|
||||
|
||||
## async method: ElementHandle.check
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.check`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
This method checks the element by performing the following steps:
|
||||
1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
|
||||
@ -191,6 +192,7 @@ When all steps combined have not finished during the specified [`option: timeout
|
||||
|
||||
## async method: ElementHandle.click
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.click`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
This method clicks the element by performing the following steps:
|
||||
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
|
||||
@ -241,6 +243,7 @@ Returns the content frame for element handles referencing iframe nodes, or `null
|
||||
|
||||
## async method: ElementHandle.dblclick
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.dblclick`] instead. Read more about [locators](../locators.md).
|
||||
* langs:
|
||||
- alias-csharp: DblClickAsync
|
||||
|
||||
@ -289,6 +292,7 @@ When all steps combined have not finished during the specified [`option: timeout
|
||||
|
||||
## async method: ElementHandle.dispatchEvent
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.dispatchEvent`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
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
|
||||
@ -383,6 +387,9 @@ Optional event-specific initialization properties.
|
||||
|
||||
## async method: ElementHandle.evalOnSelector
|
||||
* since: v1.9
|
||||
* discouraged: This method does not wait for the element to pass actionability
|
||||
checks and therefore can lead to the flaky tests. Use [`method: Locator.evaluate`],
|
||||
other [Locator] helper methods or web-first assertions instead.
|
||||
* langs:
|
||||
- alias-python: eval_on_selector
|
||||
- alias-js: $eval
|
||||
@ -445,6 +452,8 @@ Optional argument to pass to [`param: expression`].
|
||||
|
||||
## async method: ElementHandle.evalOnSelectorAll
|
||||
* since: v1.9
|
||||
* discouraged: In most cases, [`method: Locator.evaluateAll`],
|
||||
other [Locator] helper methods and web-first assertions do a better job.
|
||||
* langs:
|
||||
- alias-python: eval_on_selector_all
|
||||
- alias-js: $$eval
|
||||
@ -511,6 +520,7 @@ Optional argument to pass to [`param: expression`].
|
||||
|
||||
## async method: ElementHandle.fill
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.fill`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
This method 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.
|
||||
|
||||
@ -538,11 +548,13 @@ Value to set for the `<input>`, `<textarea>` or `[contenteditable]` element.
|
||||
|
||||
## async method: ElementHandle.focus
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.focus`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
||||
|
||||
## async method: ElementHandle.getAttribute
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.getAttribute`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[null]|[string]>
|
||||
|
||||
Returns element attribute value.
|
||||
@ -555,6 +567,7 @@ Attribute name to get the value for.
|
||||
|
||||
## async method: ElementHandle.hover
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.hover`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
This method hovers over the element by performing the following steps:
|
||||
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
|
||||
@ -590,18 +603,21 @@ When all steps combined have not finished during the specified [`option: timeout
|
||||
|
||||
## async method: ElementHandle.innerHTML
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.innerHTML`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[string]>
|
||||
|
||||
Returns the `element.innerHTML`.
|
||||
|
||||
## async method: ElementHandle.innerText
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.innerText`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[string]>
|
||||
|
||||
Returns the `element.innerText`.
|
||||
|
||||
## async method: ElementHandle.inputValue
|
||||
* since: v1.13
|
||||
* discouraged: Use locator-based [`method: Locator.inputValue`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[string]>
|
||||
|
||||
Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
||||
@ -616,36 +632,42 @@ Throws for non-input elements. However, if the element is inside the `<label>` e
|
||||
|
||||
## async method: ElementHandle.isChecked
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.isChecked`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[boolean]>
|
||||
|
||||
Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
||||
|
||||
## async method: ElementHandle.isDisabled
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.isDisabled`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[boolean]>
|
||||
|
||||
Returns whether the element is disabled, the opposite of [enabled](../actionability.md#enabled).
|
||||
|
||||
## async method: ElementHandle.isEditable
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.isEditable`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[boolean]>
|
||||
|
||||
Returns whether the element is [editable](../actionability.md#editable).
|
||||
|
||||
## async method: ElementHandle.isEnabled
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.isEnabled`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[boolean]>
|
||||
|
||||
Returns whether the element is [enabled](../actionability.md#enabled).
|
||||
|
||||
## async method: ElementHandle.isHidden
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.isHidden`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[boolean]>
|
||||
|
||||
Returns whether the element is hidden, the opposite of [visible](../actionability.md#visible).
|
||||
|
||||
## async method: ElementHandle.isVisible
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.isVisible`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[boolean]>
|
||||
|
||||
Returns whether the element is [visible](../actionability.md#visible).
|
||||
@ -658,6 +680,7 @@ Returns the frame containing the given element.
|
||||
|
||||
## async method: ElementHandle.press
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.press`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
Focuses the element, and then uses [`method: Keyboard.down`] and [`method: Keyboard.up`].
|
||||
|
||||
@ -702,6 +725,7 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.
|
||||
|
||||
## async method: ElementHandle.querySelector
|
||||
* since: v1.9
|
||||
* discouraged: Use locator-based [`method: Page.locator`] instead. Read more about [locators](../locators.md).
|
||||
* langs:
|
||||
- alias-python: query_selector
|
||||
- alias-js: $
|
||||
@ -715,6 +739,7 @@ returns `null`.
|
||||
|
||||
## async method: ElementHandle.querySelectorAll
|
||||
* since: v1.9
|
||||
* discouraged: Use locator-based [`method: Page.locator`] instead. Read more about [locators](../locators.md).
|
||||
* langs:
|
||||
- alias-python: query_selector_all
|
||||
- alias-js: $$
|
||||
@ -728,6 +753,7 @@ returns empty array.
|
||||
|
||||
## async method: ElementHandle.screenshot
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.screenshot`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[Buffer]>
|
||||
|
||||
This method captures a screenshot of the page, clipped to the size and position of this particular element. If the element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable container, only the currently scrolled content will be visible on the screenshot.
|
||||
@ -753,6 +779,7 @@ Returns the buffer with the captured screenshot.
|
||||
* since: v1.41
|
||||
|
||||
## async method: ElementHandle.scrollIntoViewIfNeeded
|
||||
* discouraged: Use locator-based [`method: Locator.scrollIntoViewIfNeeded`] instead. Read more about [locators](../locators.md).
|
||||
* since: v1.8
|
||||
|
||||
This method waits for [actionability](../actionability.md) checks, then tries to scroll element into view, unless it is
|
||||
@ -770,6 +797,7 @@ Throws when `elementHandle` does not point to an element
|
||||
|
||||
## async method: ElementHandle.selectOption
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.selectOption`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[Array]<[string]>>
|
||||
|
||||
This method waits for [actionability](../actionability.md) checks, waits until all specified options are present in the `<select>` element and selects these options.
|
||||
@ -863,6 +891,7 @@ await handle.SelectOptionAsync(new[] {
|
||||
|
||||
## async method: ElementHandle.selectText
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.selectText`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
This method waits for [actionability](../actionability.md) checks, then focuses the element and selects all its text
|
||||
content.
|
||||
@ -879,6 +908,7 @@ If the element is inside the `<label>` element that has an associated [control](
|
||||
* since: v1.8
|
||||
|
||||
## async method: ElementHandle.setChecked
|
||||
* discouraged: Use locator-based [`method: Locator.setChecked`] instead. Read more about [locators](../locators.md).
|
||||
* since: v1.15
|
||||
|
||||
This method checks or unchecks an element by performing the following steps:
|
||||
@ -917,6 +947,7 @@ When all steps combined have not finished during the specified [`option: timeout
|
||||
|
||||
## async method: ElementHandle.setInputFiles
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.setInputFiles`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
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.
|
||||
@ -938,6 +969,7 @@ This method expects [ElementHandle] to point to an
|
||||
|
||||
## async method: ElementHandle.tap
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.tap`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
This method taps the element by performing the following steps:
|
||||
1. Wait for [actionability](../actionability.md) checks on the element, unless [`option: force`] option is set.
|
||||
@ -977,6 +1009,7 @@ When all steps combined have not finished during the specified [`option: timeout
|
||||
|
||||
## async method: ElementHandle.textContent
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.textContent`] instead. Read more about [locators](../locators.md).
|
||||
- returns: <[null]|[string]>
|
||||
|
||||
Returns the `node.textContent`.
|
||||
@ -1014,6 +1047,7 @@ Time to wait between key presses in milliseconds. Defaults to 0.
|
||||
|
||||
## async method: ElementHandle.uncheck
|
||||
* since: v1.8
|
||||
* discouraged: Use locator-based [`method: Locator.uncheck`] instead. Read more about [locators](../locators.md).
|
||||
|
||||
This method checks the element by performing the following steps:
|
||||
1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
|
||||
@ -1079,6 +1113,7 @@ A state to wait for, see below for more details.
|
||||
|
||||
## async method: ElementHandle.waitForSelector
|
||||
* since: v1.8
|
||||
* discouraged: Use web assertions that assert visibility or a locator-based [`method: Locator.waitFor`] instead.
|
||||
- returns: <[null]|[ElementHandle]>
|
||||
|
||||
Returns element specified by selector when it satisfies [`option: state`] option. Returns `null` if waiting for `hidden`
|
||||
|
152
packages/playwright-core/types/types.d.ts
vendored
152
packages/playwright-core/types/types.d.ts
vendored
@ -9098,12 +9098,18 @@ export interface JSHandle<T = any> {
|
||||
*/
|
||||
export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
/**
|
||||
* **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* The method finds an element matching the specified selector in the `ElementHandle`'s subtree. If no elements match
|
||||
* the selector, returns `null`.
|
||||
* @param selector A selector to query for.
|
||||
*/
|
||||
$<K extends keyof HTMLElementTagNameMap>(selector: K, options?: { strict: boolean }): Promise<ElementHandleForTag<K> | null>;
|
||||
/**
|
||||
* **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* The method finds an element matching the specified selector in the `ElementHandle`'s subtree. If no elements match
|
||||
* the selector, returns `null`.
|
||||
* @param selector A selector to query for.
|
||||
@ -9111,12 +9117,18 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
$(selector: string, options?: { strict: boolean }): Promise<ElementHandle<SVGElement | HTMLElement> | null>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* The method finds all elements matching the specified selector in the `ElementHandle`s subtree. If no elements match
|
||||
* the selector, returns empty array.
|
||||
* @param selector A selector to query for.
|
||||
*/
|
||||
$$<K extends keyof HTMLElementTagNameMap>(selector: K): Promise<ElementHandleForTag<K>[]>;
|
||||
/**
|
||||
* **NOTE** Use locator-based [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* The method finds all elements matching the specified selector in the `ElementHandle`s subtree. If no elements match
|
||||
* the selector, returns empty array.
|
||||
* @param selector A selector to query for.
|
||||
@ -9124,6 +9136,11 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
$$(selector: string): Promise<ElementHandle<SVGElement | HTMLElement>[]>;
|
||||
|
||||
/**
|
||||
* **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests.
|
||||
* Use
|
||||
* [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate),
|
||||
* other {@link Locator} helper methods or web-first assertions instead.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a
|
||||
@ -9147,6 +9164,11 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
$eval<K extends keyof HTMLElementTagNameMap, R, Arg>(selector: K, pageFunction: PageFunctionOn<HTMLElementTagNameMap[K], Arg, R>, arg: Arg): Promise<R>;
|
||||
/**
|
||||
* **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests.
|
||||
* Use
|
||||
* [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate),
|
||||
* other {@link Locator} helper methods or web-first assertions instead.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a
|
||||
@ -9170,6 +9192,11 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
$eval<R, Arg, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(selector: string, pageFunction: PageFunctionOn<E, Arg, R>, arg: Arg): Promise<R>;
|
||||
/**
|
||||
* **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests.
|
||||
* Use
|
||||
* [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate),
|
||||
* other {@link Locator} helper methods or web-first assertions instead.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a
|
||||
@ -9193,6 +9220,11 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
$eval<K extends keyof HTMLElementTagNameMap, R>(selector: K, pageFunction: PageFunctionOn<HTMLElementTagNameMap[K], void, R>, arg?: any): Promise<R>;
|
||||
/**
|
||||
* **NOTE** This method does not wait for the element to pass actionability checks and therefore can lead to the flaky tests.
|
||||
* Use
|
||||
* [locator.evaluate(pageFunction[, arg, options])](https://playwright.dev/docs/api/class-locator#locator-evaluate),
|
||||
* other {@link Locator} helper methods or web-first assertions instead.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a
|
||||
@ -9217,6 +9249,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
$eval<R, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(selector: string, pageFunction: PageFunctionOn<E, void, R>, arg?: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* **NOTE** In most cases,
|
||||
* [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all),
|
||||
* other {@link Locator} helper methods and web-first assertions do a better job.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array
|
||||
@ -9248,6 +9284,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
$$eval<K extends keyof HTMLElementTagNameMap, R, Arg>(selector: K, pageFunction: PageFunctionOn<HTMLElementTagNameMap[K][], Arg, R>, arg: Arg): Promise<R>;
|
||||
/**
|
||||
* **NOTE** In most cases,
|
||||
* [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all),
|
||||
* other {@link Locator} helper methods and web-first assertions do a better job.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array
|
||||
@ -9279,6 +9319,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
$$eval<R, Arg, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(selector: string, pageFunction: PageFunctionOn<E[], Arg, R>, arg: Arg): Promise<R>;
|
||||
/**
|
||||
* **NOTE** In most cases,
|
||||
* [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all),
|
||||
* other {@link Locator} helper methods and web-first assertions do a better job.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array
|
||||
@ -9310,6 +9354,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
$$eval<K extends keyof HTMLElementTagNameMap, R>(selector: K, pageFunction: PageFunctionOn<HTMLElementTagNameMap[K][], void, R>, arg?: any): Promise<R>;
|
||||
/**
|
||||
* **NOTE** In most cases,
|
||||
* [locator.evaluateAll(pageFunction[, arg])](https://playwright.dev/docs/api/class-locator#locator-evaluate-all),
|
||||
* other {@link Locator} helper methods and web-first assertions do a better job.
|
||||
*
|
||||
* Returns the return value of `pageFunction`.
|
||||
*
|
||||
* The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array
|
||||
@ -9342,6 +9390,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
$$eval<R, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(selector: string, pageFunction: PageFunctionOn<E[], void, R>, arg?: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use web assertions that assert visibility or a locator-based
|
||||
* [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead.
|
||||
*
|
||||
* Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -9367,6 +9418,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options?: ElementHandleWaitForSelectorOptionsNotHidden): Promise<ElementHandleForTag<K>>;
|
||||
/**
|
||||
* **NOTE** Use web assertions that assert visibility or a locator-based
|
||||
* [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead.
|
||||
*
|
||||
* Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -9392,6 +9446,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
waitForSelector(selector: string, options?: ElementHandleWaitForSelectorOptionsNotHidden): Promise<ElementHandle<SVGElement | HTMLElement>>;
|
||||
/**
|
||||
* **NOTE** Use web assertions that assert visibility or a locator-based
|
||||
* [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead.
|
||||
*
|
||||
* Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -9417,6 +9474,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
*/
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options: ElementHandleWaitForSelectorOptions): Promise<ElementHandleForTag<K> | null>;
|
||||
/**
|
||||
* **NOTE** Use web assertions that assert visibility or a locator-based
|
||||
* [locator.waitFor([options])](https://playwright.dev/docs/api/class-locator#locator-wait-for) instead.
|
||||
*
|
||||
* Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -9486,6 +9546,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.check([options])](https://playwright.dev/docs/api/class-locator#locator-check) instead.
|
||||
* Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method checks the element by performing the following steps:
|
||||
* 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
|
||||
* checked, this method returns immediately.
|
||||
@ -9541,6 +9604,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.click([options])](https://playwright.dev/docs/api/class-locator#locator-click) instead.
|
||||
* Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method clicks the element by performing the following steps:
|
||||
* 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the element, unless `force` option is set.
|
||||
* 1. Scroll the element into view if needed.
|
||||
@ -9619,6 +9685,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
contentFrame(): Promise<null|Frame>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.dblclick([options])](https://playwright.dev/docs/api/class-locator#locator-dblclick)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method double clicks the element by performing the following steps:
|
||||
* 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the element, unless `force` option is set.
|
||||
* 1. Scroll the element into view if needed.
|
||||
@ -9690,6 +9759,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.dispatchEvent(type[, eventInit, options])](https://playwright.dev/docs/api/class-locator#locator-dispatch-event)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* 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
|
||||
* [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
|
||||
@ -9729,6 +9802,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
dispatchEvent(type: string, eventInit?: EvaluationArgument): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.fill(value[, options])](https://playwright.dev/docs/api/class-locator#locator-fill)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method waits for [actionability](https://playwright.dev/docs/actionability) 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.
|
||||
*
|
||||
@ -9765,17 +9841,27 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.focus([options])](https://playwright.dev/docs/api/class-locator#locator-focus) instead.
|
||||
* Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Calls [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus) on the element.
|
||||
*/
|
||||
focus(): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.getAttribute(name[, options])](https://playwright.dev/docs/api/class-locator#locator-get-attribute)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns element attribute value.
|
||||
* @param name Attribute name to get the value for.
|
||||
*/
|
||||
getAttribute(name: string): Promise<null|string>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.hover([options])](https://playwright.dev/docs/api/class-locator#locator-hover) instead.
|
||||
* Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method hovers over the element by performing the following steps:
|
||||
* 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the element, unless `force` option is set.
|
||||
* 1. Scroll the element into view if needed.
|
||||
@ -9834,16 +9920,26 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.innerHTML([options])](https://playwright.dev/docs/api/class-locator#locator-inner-html)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns the `element.innerHTML`.
|
||||
*/
|
||||
innerHTML(): Promise<string>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.innerText([options])](https://playwright.dev/docs/api/class-locator#locator-inner-text)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns the `element.innerText`.
|
||||
*/
|
||||
innerText(): Promise<string>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.inputValue([options])](https://playwright.dev/docs/api/class-locator#locator-input-value) instead. Read
|
||||
* more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns `input.value` for the selected `<input>` or `<textarea>` or `<select>` element.
|
||||
*
|
||||
* Throws for non-input elements. However, if the element is inside the `<label>` element that has an associated
|
||||
@ -9862,31 +9958,51 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<string>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.isChecked([options])](https://playwright.dev/docs/api/class-locator#locator-is-checked)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
|
||||
*/
|
||||
isChecked(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.isDisabled([options])](https://playwright.dev/docs/api/class-locator#locator-is-disabled) instead. Read
|
||||
* more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns whether the element is disabled, the opposite of [enabled](https://playwright.dev/docs/actionability#enabled).
|
||||
*/
|
||||
isDisabled(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.isEditable([options])](https://playwright.dev/docs/api/class-locator#locator-is-editable) instead. Read
|
||||
* more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns whether the element is [editable](https://playwright.dev/docs/actionability#editable).
|
||||
*/
|
||||
isEditable(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.isEnabled([options])](https://playwright.dev/docs/api/class-locator#locator-is-enabled)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns whether the element is [enabled](https://playwright.dev/docs/actionability#enabled).
|
||||
*/
|
||||
isEnabled(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.isHidden([options])](https://playwright.dev/docs/api/class-locator#locator-is-hidden)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns whether the element is hidden, the opposite of [visible](https://playwright.dev/docs/actionability#visible).
|
||||
*/
|
||||
isHidden(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.isVisible([options])](https://playwright.dev/docs/api/class-locator#locator-is-visible)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns whether the element is [visible](https://playwright.dev/docs/actionability#visible).
|
||||
*/
|
||||
isVisible(): Promise<boolean>;
|
||||
@ -9897,6 +10013,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
ownerFrame(): Promise<null|Frame>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.press(key[, options])](https://playwright.dev/docs/api/class-locator#locator-press)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Focuses the element, and then uses
|
||||
* [keyboard.down(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-down) and
|
||||
* [keyboard.up(key)](https://playwright.dev/docs/api/class-keyboard#keyboard-up).
|
||||
@ -9945,6 +10064,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.screenshot([options])](https://playwright.dev/docs/api/class-locator#locator-screenshot)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method captures a screenshot of the page, clipped to the size and position of this particular element. If the
|
||||
* element is covered by other elements, it will not be actually visible on the screenshot. If the element is a
|
||||
* scrollable container, only the currently scrolled content will be visible on the screenshot.
|
||||
@ -10033,6 +10155,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<Buffer>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.scrollIntoViewIfNeeded([options])](https://playwright.dev/docs/api/class-locator#locator-scroll-into-view-if-needed)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method waits for [actionability](https://playwright.dev/docs/actionability) checks, then tries to scroll element into view, unless
|
||||
* it is completely visible as defined by
|
||||
* [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s `ratio`.
|
||||
@ -10052,6 +10178,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.selectOption(values[, options])](https://playwright.dev/docs/api/class-locator#locator-select-option)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method waits for [actionability](https://playwright.dev/docs/actionability) checks, waits until all specified options are present in
|
||||
* the `<select>` element and selects these options.
|
||||
*
|
||||
@ -10135,6 +10265,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<Array<string>>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.selectText([options])](https://playwright.dev/docs/api/class-locator#locator-select-text) instead. Read
|
||||
* more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method waits for [actionability](https://playwright.dev/docs/actionability) checks, then focuses the element and selects all its
|
||||
* text content.
|
||||
*
|
||||
@ -10159,6 +10293,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.setChecked(checked[, options])](https://playwright.dev/docs/api/class-locator#locator-set-checked)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method checks or unchecks an element by performing the following steps:
|
||||
* 1. Ensure that element is a checkbox or a radio input. If not, this method throws.
|
||||
* 1. If the element already has the right checked state, this method returns immediately.
|
||||
@ -10214,6 +10352,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.setInputFiles(files[, options])](https://playwright.dev/docs/api/class-locator#locator-set-input-files)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
@ -10272,6 +10414,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.tap([options])](https://playwright.dev/docs/api/class-locator#locator-tap) instead. Read
|
||||
* more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method taps the element by performing the following steps:
|
||||
* 1. Wait for [actionability](https://playwright.dev/docs/actionability) checks on the element, unless `force` option is set.
|
||||
* 1. Scroll the element into view if needed.
|
||||
@ -10332,6 +10477,10 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based
|
||||
* [locator.textContent([options])](https://playwright.dev/docs/api/class-locator#locator-text-content) instead. Read
|
||||
* more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns the `node.textContent`.
|
||||
*/
|
||||
textContent(): Promise<null|string>;
|
||||
@ -10374,6 +10523,9 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
||||
}): Promise<void>;
|
||||
|
||||
/**
|
||||
* **NOTE** Use locator-based [locator.uncheck([options])](https://playwright.dev/docs/api/class-locator#locator-uncheck)
|
||||
* instead. Read more about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* This method checks the element by performing the following steps:
|
||||
* 1. Ensure that element is a checkbox or a radio input. If not, this method throws. If the element is already
|
||||
* unchecked, this method returns immediately.
|
||||
|
Loading…
Reference in New Issue
Block a user