-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[py] support for custom error messages through functions for WebDriverWait.until/until_not
#15723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
…erWait.until/until_not`
PR Reviewer Guide 🔍(Review updated until commit 147913a)Here are some key observations to aid the review process:
|
Thank you, @Delta456 for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR Code Suggestions ✨Latest suggestions up to 147913a
Previous suggestionsSuggestions up to commit 147913a
|
@@ -92,7 +93,9 @@ def __init__( | |||
def __repr__(self) -> str: | |||
return f'<{type(self).__module__}.{type(self).__name__} (session="{self._driver.session_id}")>' | |||
|
|||
def until(self, method: Callable[[D], Union[Literal[False], T]], message: str = "") -> T: | |||
def until( | |||
self, method: Callable[[D], Union[Literal[False], T]], message: Union[str, Callable[[Any], str]] = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work.
I think it would be better to indicate that the Callable cannot take any arguments.
self, method: Callable[[D], Union[Literal[False], T]], message: Union[str, Callable[[Any], str]] = "" | |
self, method: Callable[[D], Union[Literal[False], T]], message: Union[str, Callable[[], str]] = "" |
User description
🔗 Related Issues
Implements #14552
💥 What does this PR do?
Allow specifying a callable for the message argument in
WebDriverWait.until / until_not
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement, Tests
Description
Allow callable as
message
inWebDriverWait.until/until_not
Update method signatures and error handling for callables
Add tests for callable and string timeout messages
Changes walkthrough 📝
wait.py
Add callable support for timeout messages in WebDriverWait
py/selenium/webdriver/support/wait.py
message
inuntil
anduntil_not
webdriverwait_tests.py
Add tests for callable and string timeout messages
py/test/selenium/webdriver/common/webdriverwait_tests.py