[š Feature]: Better Logging and Debug Info for WebDriver Wait Failures
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
@sarathckrishnan, thank you for creating this issue. We will troubleshoot it as soon as we can.
Selenium Triage Team: remember to follow the Triage Guide
Iād be happy to raise a PR for this enhancement, if this sounds useful.
Which language bindings are you referring to?
Can you also verify you are human? ... this request sounds totally AI-generated.
@cgoldberg š - I wanted to do it for Java binding. Sorry for using AI to paraphrase my thoughts. I'll edit my request.
@skrish99hsirks You are welcome to send in a PR with the suggested changes. We are happy to receive contributions.
Hi, @ceekay10.
This is related to code in the Support packages. The support packages contain example code that many users find helpful, but they do not necessarily represent the best practices for using Selenium, and the Selenium team is not prioritizing work on them right now. This doesn't mean that we won't ever work on them, but it is not on our long term roadmap.
We actively encourage people to create their own wrapper and helper code that makes sense for them. If you have any questions, please contact us