mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 13:45:36 +03:00
chore: discourage waitForSelector (#22133)
This commit is contained in:
parent
82e52004c9
commit
ee39af260d
@ -2104,6 +2104,8 @@ a navigation.
|
||||
|
||||
## async method: Frame.waitForSelector
|
||||
* since: v1.8
|
||||
* discouraged: Use web assertions that assert visibility or a locator-based [`method: Locator.waitFor`] instead.
|
||||
Read more about [locators](../locators.md).
|
||||
- returns: <[null]|[ElementHandle]>
|
||||
|
||||
Returns when element specified by selector satisfies [`option: state`] option. Returns `null` if waiting for `hidden` or
|
||||
|
@ -4654,6 +4654,8 @@ changed by using the [`method: BrowserContext.setDefaultTimeout`] or [`method: P
|
||||
|
||||
## async method: Page.waitForSelector
|
||||
* since: v1.8
|
||||
* discouraged: Use web assertions that assert visibility or a locator-based [`method: Locator.waitFor`] instead.
|
||||
Read more about [locators](../locators.md).
|
||||
- returns: <[null]|[ElementHandle]>
|
||||
|
||||
Returns when element specified by selector satisfies [`option: state`] option. Returns `null` if waiting for `hidden` or
|
||||
@ -4814,6 +4816,8 @@ Codition to wait for.
|
||||
|
||||
## async method: Page.waitForTimeout
|
||||
* since: v1.8
|
||||
* discouraged: Never wait for timeout in production. Tests that wait for time are
|
||||
inherently flaky. Use [Locator] actions and web assertions that wait automatically.
|
||||
|
||||
Waits for the given [`param: timeout`] in milliseconds.
|
||||
|
||||
|
35
packages/playwright-core/types/types.d.ts
vendored
35
packages/playwright-core/types/types.d.ts
vendored
@ -611,6 +611,10 @@ export interface Page {
|
||||
waitForFunction<R>(pageFunction: PageFunction<void, R>, arg?: any, options?: PageWaitForFunctionOptions): Promise<SmartHandle<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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -645,6 +649,10 @@ export interface Page {
|
||||
*/
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options?: PageWaitForSelectorOptionsNotHidden): 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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -679,6 +687,10 @@ export interface Page {
|
||||
*/
|
||||
waitForSelector(selector: string, options?: PageWaitForSelectorOptionsNotHidden): 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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -713,6 +725,10 @@ export interface Page {
|
||||
*/
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options: PageWaitForSelectorOptions): 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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -4558,6 +4574,9 @@ export interface Page {
|
||||
}): Promise<Response>;
|
||||
|
||||
/**
|
||||
* **NOTE** Never wait for timeout in production. Tests that wait for time are inherently flaky. Use [Locator] actions and web
|
||||
* assertions that wait automatically.
|
||||
*
|
||||
* Waits for the given `timeout` in milliseconds.
|
||||
*
|
||||
* Note that `page.waitForTimeout()` should only be used for debugging. Tests using the timer in production are going
|
||||
@ -5202,6 +5221,10 @@ export interface Frame {
|
||||
waitForFunction<R>(pageFunction: PageFunction<void, R>, arg?: any, options?: PageWaitForFunctionOptions): Promise<SmartHandle<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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -5236,6 +5259,10 @@ export interface Frame {
|
||||
*/
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options?: PageWaitForSelectorOptionsNotHidden): 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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -5270,6 +5297,10 @@ export interface Frame {
|
||||
*/
|
||||
waitForSelector(selector: string, options?: PageWaitForSelectorOptionsNotHidden): 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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
@ -5304,6 +5335,10 @@ export interface Frame {
|
||||
*/
|
||||
waitForSelector<K extends keyof HTMLElementTagNameMap>(selector: K, options: PageWaitForSelectorOptions): 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. Read more
|
||||
* about [locators](https://playwright.dev/docs/locators).
|
||||
*
|
||||
* Returns when element specified by selector satisfies `state` option. Returns `null` if waiting for `hidden` or
|
||||
* `detached`.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user