Skip to content

[Feature]: support signal in waitFor* APIs #40578

@tmkx

Description

@tmkx

🚀 Feature Request

Many Playwright ⁠waitFor* APIs support a ⁠timeout option, which works well for fixed upper bounds. A complementary capability would be support for ⁠AbortSignal, so callers can cancel an in-flight wait based on external application state.

Example

A consistent API shape could look like this wherever ⁠timeout is already supported:

await locator.waitFor({
  state: 'visible',
  timeout: 30_000,
  signal,
});

await page.waitForURL('**/dashboard', {

Motivation

This would make Playwright waiting APIs easier to compose with:

  • shared cancellation across multiple concurrent operations
  • higher-level test orchestration
  • user-defined deadlines and cascading cancellation
  • integration with standard Web Platform and Node.js cancellation patterns

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions