-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Fix relativeby annotations #15875
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
Fix relativeby annotations #15875
Conversation
|
Thank you, @ShauryaDusht 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 Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
|
Closed : messed up in fetching from "trunk" branch |
User description
🔗 Related Issues
Closes #14881
Closes #15050
💥 What does this PR do?
Adds missing
RelativeBytype annotation support to:find_elementandfind_elementsexpected_conditions.py(conditions now supportRelativeBylocators)Also adds unit tests to validate these changes.
🔧 Implementation Notes
Updated type hints from
Tuple[str, str]toUnion[Tuple[ByType, str], Tuple[RelativeBy, None]]where needed.Minor ShadowRoot update added as per doc coverage.
Bazel issues on Windows remain unresolved.
💡 Additional Considerations
None — ready for review. ShadowRoot usage can be revisited if needed.
🔄 Types of changes
Files Changed/Added
selenium/webdriver/remote/shadowroot.pyselenium/webdriver/remote/webdriver.pyselenium/webdriver/remote/webelement.pyselenium/webdriver/support/expected_conditions.pytest/unit/selenium/webdriver/support/test_expected_conditions_relative_by.pytest/unit/selenium/webdriver/test_relative_by_annotations.pyPR Type
Bug fix, Enhancement, Tests
Description
Add
RelativeBysupport to type annotations forfind_element/find_elementsUpdate expected_conditions to accept
RelativeBylocators in type hintsAdd unit tests to validate
RelativeByannotation supportImprove type safety and error handling in BiDi browsing context classes
Changes walkthrough 📝
4 files
Add RelativeBy to find_element(s) type annotationsAdd RelativeBy to WebElement find_element(s) type annotationsAdd RelativeBy to ShadowRoot find_element(s) type annotationsSupport RelativeBy in expected_conditions locator type hints2 files
Add unit tests for RelativeBy annotation supportAdd unit tests for expected_conditions with RelativeBy3 files
Improve type safety and error handling in BiDi contextFix type for pause method argumentFix type handling in find_connectable_ip and keys_to_typing