This function has multiple overloads
- Wrapper Function Pattern
- Decorator
Executes a function and waits for network activity to settle before returning. This helper monitors network requests and waits until all network activity has completed.
This pattern executes a function and waits for network activity to settle before returning the result of the function.
wait_for_network_settled vs wait_for_dom_settled
- Use
wait_for_network_settledwhen watching network requests (API calls, form submissions, resource loading) - Use wait_for_dom_settled when watching DOM mutations (elements added/removed/modified, loading spinners, dynamic content injection)
Examples
Arguments
Playwright Page object to monitor network activity on.
The async function to execute before waiting for network to settle. This function should contain the action that triggers network requests.
Maximum seconds to wait for network to settle. If timeout is reached, logs a warning and continues. Defaults to 30.
Maximum number of ongoing requests to consider network as “settled”. Defaults to 0 (waits for all requests).