Fix relativeby annotations new #15876
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
🔗 Related Issues
Closes #14881
💥 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
Tuple[str, str]toUnion[Tuple[ByType, str], Tuple[RelativeBy, None]]where needed.💡 Additional Considerations
N/A
🔄 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 tofind_elementandfind_elementsmethodsUpdate expected_conditions to accept
RelativeBylocatorsAdd unit tests for
RelativeBytype annotation supportChanges walkthrough 📝
shadowroot.py
Add RelativeBy support to ShadowRoot element search methodspy/selenium/webdriver/remote/shadowroot.py
find_elementandfind_elementsto acceptRelativeByRelativeByByTypefor improved type hintswebdriver.py
Add RelativeBy support to WebDriver element search methodspy/selenium/webdriver/remote/webdriver.py
find_elementandfind_elementsto acceptRelativeByRelativeByByTypefor improved type hintswebelement.py
Add RelativeBy support to WebElement search methodspy/selenium/webdriver/remote/webelement.py
find_elementandfind_elementsto acceptRelativeByRelativeByByTypefor improved type hintsexpected_conditions.py
Add RelativeBy support to expected_conditions locator argumentspy/selenium/webdriver/support/expected_conditions.py
RelativeByLocatorTypealias for union of locator typeshints
test_expected_conditions_relative_by.py
Add tests for RelativeBy support in expected_conditionspy/test/unit/selenium/webdriver/support/test_expected_conditions_relative_by.py
RelativeBylocators
RelativeBytest_relative_by_annotations.py
Add tests for RelativeBy support in element search methodspy/test/unit/selenium/webdriver/test_relative_by_annotations.py
find_elementandfind_elementsacceptRelativeByRelativeBy