Skip to content

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

docs: improve waitForElementState documentation (#4883)

Yury Semikhatsky0f8d7ec0a604
diff --git a/docs/src/api-body.md b/docs/src/api-body.md
index 24efe5a5cd..8fc230047d 100644
--- a/docs/src/api-body.md
+++ b/docs/src/api-body.md
@@ -3846,7 +3846,7 @@ When all steps combined have not finished during the specified [`option: timeout
## async method: ElementHandle.waitForElementState
-Returns the element satisfies the [`param: state`].
+Returns when the element satisfies the [`param: state`].
Depending on the [`param: state`] parameter, this method waits for one of the [actionability](./actionability.md)
checks to pass. This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.
@@ -3868,7 +3868,7 @@ A state to wait for, see below for more details.
## async method: ElementHandle.waitForSelector
- returns: <[null]|[ElementHandle]>
-Returns element specified by selector satisfies [`option: state`] option. Returns `null` if waiting for `hidden` or
+Returns element specified by selector when it satisfies [`option: state`] option. Returns `null` if waiting for `hidden` or
`detached`.
Wait for the [`param: selector`] relative to the element handle to satisfy [`option: state`] option (either
diff --git a/types/types.d.ts b/types/types.d.ts
index 6582b48cd3..9be4179c1e 100644
--- a/types/types.d.ts
+++ b/types/types.d.ts
@@ -5407,7 +5407,8 @@ 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>;
/**
- * Returns element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or `detached`.
+ * Returns element specified by selector when it satisfies `state` option. Returns `null` if waiting for `hidden` or
+ * `detached`.
*
* Wait for the `selector` relative to the element handle to satisfy `state` option (either appear/disappear from dom, or
* become visible/hidden). If at the moment of calling the method `selector` already satisfies the condition, the method
@@ -6196,7 +6197,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
}): Promise<void>;
/**
- * Returns the element satisfies the `state`.
+ * Returns when the element satisfies the `state`.
*
* Depending on the `state` parameter, this method waits for one of the [actionability](https://github.com/microsoft/playwright/blob/master/docs/actionability.md) checks to pass.
* This method throws when the element is detached while waiting, unless waiting for the `"hidden"` state.