Skip to content

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

chore: mark waitForNavigation as deprecated consistently (#21309)

Pavel Feldman2cbafd7adf43
diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md
index ef9ed9a8cb..806a274a64 100644
--- a/docs/src/api/class-frame.md
+++ b/docs/src/api/class-frame.md
@@ -1937,6 +1937,7 @@ await frame.WaitForLoadStateAsync(); // Defaults to LoadState.Load
## async method: Frame.waitForNavigation
* since: v1.8
+* deprecated: This method is inherently racy, please use [`method: Frame.waitForURL`] instead.
* langs:
* alias-python: expect_navigation
* alias-csharp: RunAndWaitForNavigation
@@ -1995,6 +1996,7 @@ a navigation.
## async method: Frame.waitForNavigation
* since: v1.8
+* deprecated: This method is inherently racy, please use [`method: Frame.waitForURL`] instead.
* langs: python
- returns: <[EventContextManager]<[Response]>>
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index fce271e693..b3ed6544fa 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -4249,6 +4249,7 @@ a navigation.
## async method: Page.waitForNavigation
* since: v1.8
+* deprecated: This method is inherently racy, please use [`method: Page.waitForURL`] instead.
* langs: python
- returns: <[EventContextManager]<[Response]>>
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index d1d5846dad..7cd013cdf7 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -7163,6 +7163,8 @@ export interface Frame {
*
* **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
+ * [frame.waitForURL(url[, options])](https://playwright.dev/docs/api/class-frame#frame-wait-for-url) instead.
* @param options
*/
waitForNavigation(options?: {