Skip to content

[πŸš€ Feature]: Better Logging and Debug Info for WebDriver Wait FailuresΒ #16005

@skrish99hsirks

Description

@skrish99hsirks

Description

Feature Request: Improve WebDriverWait TimeoutException Message with Detailed Context

Context

Given that WebDriverWaitis heavily relied upon for synchronisation and a wait condition fails, the resultingTimeoutException` often lacks sufficient context to understand what exactly went wrong. This slows down root cause analysis during triaging.

Suggestion

It would be helpful to enhance the exception message thrown by WebDriverWait when a condition times out. Specifically, include:

  • The expected condition (via .toString())
  • The total timeout duration
  • The locator (where applicable)

This added context can help quickly identify the exact point of failure without having to dig into logs or source code.

Example

Current:

Timed out waiting for condition.

Proposed:
Timed out after 10 seconds waiting for condition: visibility of element located by By.id("login")

Why This Matters

  • This is a small, backward-compatible improvement with high practical value
  • Helps quickly debug flaky or failing tests.

I’d be happy to raise a PR for this enhancement, if this sounds useful.

Have you considered any alternatives or workarounds?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions