Skip to content

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

chore: discourage networkidle (#22247)

Pavel Feldman3400d62a7afa
diff --git a/docs/src/api/params.md b/docs/src/api/params.md
index 7abbc9dd5a..5c56a7f6b4 100644
--- a/docs/src/api/params.md
+++ b/docs/src/api/params.md
@@ -4,7 +4,7 @@
When to consider operation succeeded, defaults to `load`. Events can be either:
* `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* `'load'` - consider operation to be finished when the `load` event is fired.
-* `'networkidle'` - consider operation to be finished when there are no network connections for at least `500` ms.
+* `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* `'commit'` - consider operation to be finished when network response is received and the document started loading.
## navigation-timeout
@@ -767,7 +767,7 @@ Optional load state to wait for, defaults to `load`. If the state has been alrea
method resolves immediately. Can be one of:
* `'load'` - wait for the `load` event to be fired.
* `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
- * `'networkidle'` - wait until there are no network connections for at least `500` ms.
+ * `'networkidle'` - **DISCOURAGED** wait until there are no network connections for at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
## java-wait-for-event-callback
* langs: java
diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.ts
index d15abf6d95..2413995ec6 100644
--- a/packages/playwright-core/types/types.d.ts
+++ b/packages/playwright-core/types/types.d.ts
@@ -2801,8 +2801,8 @@ export interface Page {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -2831,8 +2831,8 @@ export interface Page {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -2885,8 +2885,8 @@ export interface Page {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -3503,8 +3503,8 @@ export interface Page {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -3812,8 +3812,8 @@ export interface Page {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -4443,7 +4443,8 @@ export interface Page {
* document, the method resolves immediately. Can be one of:
* - `'load'` - wait for the `load` event to be fired.
* - `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
- * - `'networkidle'` - wait until there are no network connections for at least `500` ms.
+ * - `'networkidle'` - **DISCOURAGED** wait until there are no network connections for at least `500` ms. Don't use
+ * this method for testing, rely on web assertions to assess readiness instead.
* @param options
*/
waitForLoadState(state?: "load"|"domcontentloaded"|"networkidle", options?: {
@@ -4504,8 +4505,8 @@ export interface Page {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -4625,8 +4626,8 @@ export interface Page {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -6277,8 +6278,8 @@ export interface Frame {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -6886,8 +6887,8 @@ export interface Frame {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -7206,7 +7207,8 @@ export interface Frame {
* document, the method resolves immediately. Can be one of:
* - `'load'` - wait for the `load` event to be fired.
* - `'domcontentloaded'` - wait for the `DOMContentLoaded` event to be fired.
- * - `'networkidle'` - wait until there are no network connections for at least `500` ms.
+ * - `'networkidle'` - **DISCOURAGED** wait until there are no network connections for at least `500` ms. Don't use
+ * this method for testing, rely on web assertions to assess readiness instead.
* @param options
*/
waitForLoadState(state?: "load"|"domcontentloaded"|"networkidle", options?: {
@@ -7266,8 +7268,8 @@ export interface Frame {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/
@@ -7313,8 +7315,8 @@ export interface Frame {
* When to consider operation succeeded, defaults to `load`. Events can be either:
* - `'domcontentloaded'` - consider operation to be finished when the `DOMContentLoaded` event is fired.
* - `'load'` - consider operation to be finished when the `load` event is fired.
- * - `'networkidle'` - consider operation to be finished when there are no network connections for at least `500`
- * ms.
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished when there are no network connections for
+ * at least `500` ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
* - `'commit'` - consider operation to be finished when network response is received and the document started
* loading.
*/