chore: deprecate page.waitForNavigation, locator.elementHandle (#19977)

This commit is contained in:
Pavel Feldman 2023-01-09 20:04:04 -08:00 committed by GitHub
parent 3c8bc0b2f9
commit 6022a4098f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -643,6 +643,7 @@ Locator of the element to drag to.
## async method: Locator.elementHandle
* since: v1.14
* discouraged: Always prefer using [Locator]s and web assertions over [ElementHandle]s because latter are inherently racy.
- returns: <[ElementHandle]>
Resolves given locator to the first matching DOM element. If there are no matching elements, waits for one. If multiple elements match the locator, throws.
@ -652,6 +653,7 @@ Resolves given locator to the first matching DOM element. If there are no matchi
## async method: Locator.elementHandles
* since: v1.14
* discouraged: Always prefer using [Locator]s and web assertions over [ElementHandle]s because latter are inherently racy.
- returns: <[Array]<[ElementHandle]>>
Resolves given locator to all matching DOM elements. If there are no matching elements, returns an empty list.

View File

@ -4031,6 +4031,7 @@ Console.WriteLine(await popup.TitleAsync()); // popup is ready to use.
## async method: Page.waitForNavigation
* since: v1.8
* deprecated: This method is inherently racy, please use [`method: Page.waitForURL`] instead.
* langs:
* alias-python: expect_navigation
* alias-csharp: RunAndWaitForNavigation

View File

@ -4462,6 +4462,8 @@ 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.
* @deprecated This method is inherently racy, please use
* [page.waitForURL(url[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-url) instead.
* @param options
*/
waitForNavigation(options?: {
@ -10085,6 +10087,8 @@ export interface Locator {
*/
evaluateAll<R, E extends SVGElement | HTMLElement = SVGElement | HTMLElement>(pageFunction: PageFunctionOn<E[], void, R>): Promise<R>;
/**
* **NOTE** Always prefer using [Locator]s and web assertions over [ElementHandle]s because latter are inherently racy.
*
* Resolves given locator to the first matching DOM element. If there are no matching elements, waits for one. If
* multiple elements match the locator, throws.
* @param options
@ -10614,6 +10618,8 @@ export interface Locator {
}): Promise<void>;
/**
* **NOTE** Always prefer using [Locator]s and web assertions over [ElementHandle]s because latter are inherently racy.
*
* Resolves given locator to all matching DOM elements. If there are no matching elements, returns an empty list.
*/
elementHandles(): Promise<Array<ElementHandle>>;