Skip to content

[Feature]: Adaptive waiting layer for non-DOM and unstable timing scenarios #3019

@LuizSeabraDeMarco

Description

@LuizSeabraDeMarco

🚀 Feature Request

Introduce an optional adaptive waiting layer that complements Playwright’s existing
auto-waiting and locator-based synchronization mechanisms, targeting scenarios where
the triggering signal is outside the DOM or highly variable across environments.

Instead of relying solely on fixed polling intervals or static timeouts, this layer would
dynamically adjust wait behavior based on execution context and optional external signals
(e.g. visual state changes or OS-level UI feedback), without replacing Playwright’s current
waiting model.

Example

This feature would be useful in hybrid or edge-case automation flows, such as:

  • Waiting for OS-level dialogs, native file pickers, or screen-based UI elements
  • Handling workflows where the visual state changes before the DOM reflects it
  • Stabilizing tests that behave differently across machines, CI environments, or network conditions
  • Running an adaptive pre-wait before executing a Playwright action, rather than relying on
    extended static timeouts

The intent is not to change Playwright’s auto-waiting behavior, but to offer an optional
adaptive layer for scenarios where DOM-based signals are insufficient.

Motivation

Playwright already provides one of the strongest synchronization models in browser automation.
However, there are real-world cases where the relevant signal is external to the DOM or
highly unstable across environments, leading users to fall back to extended timeouts or
manual sleeps.

An adaptive waiting approach could:

  • Reduce flaky tests caused by over-reliance on static timeouts
  • Improve reliability in hybrid automation scenarios
  • Encourage more expressive and resilient waiting strategies without compromising
    Playwright’s existing design principles

This proposal aims to explore whether such an adaptive layer aligns with Playwright’s philosophy,
or if there are recommended patterns already in use by the community for these edge cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions