- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.6k
 
[py] Support RelativeBy in type annotations #15050
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
Conversation
          PR Reviewer Guide 🔍(Review updated until commit 012d7f7)Here are some key observations to aid the review process: 
  | 
    
          PR Code Suggestions ✨Latest suggestions up to 012d7f7 
 Previous suggestionsSuggestions up to commit 25124be
  | 
    |||||||||||||||||||
          Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 Additional details and impacted files@@            Coverage Diff             @@
##            trunk   #15050      +/-   ##
==========================================
+ Coverage   58.48%   58.86%   +0.38%     
==========================================
  Files          86       94       +8     
  Lines        5270     6012     +742     
  Branches      220      259      +39     
==========================================
+ Hits         3082     3539     +457     
- Misses       1968     2214     +246     
- Partials      220      259      +39     ☔ View full report in Codecov by Sentry.  | 
    
| 
           @gryznar Thanks for the PR! Please run scripts/format.sh to pass the formatting tests  | 
    
| 
           Sure. I was not aware of this script and therefore I've formatted manually  | 
    
          
 No worries, I didn't know about it either until someone directed me to it  | 
    
28d4f96    to
    474d3b7      
    Compare
  
    
          
 @shbenzer Done  | 
    
474d3b7    to
    d8c871a      
    Compare
  
    | 
           I've also reverted changes in   | 
    
| 
           @gryznar Could you please provide some tests for this enhancement? We'll need to ensure that RelativeBy is fully handleable here before we can roll this out.  | 
    
| 
           I'll try  | 
    
| 
           Sorry, that this is taking so long from my side, but I am unsure where to put these tests and what would they to cover?  | 
    
| 
           Is this still relevant? If so, can you fix the merge conflicts?  | 
    
          
 To answer this question: 
  | 
    
          
 Thanks for the answer! I'll try to both resolve conflicts and add these tests this week  | 
    
| 
           @gryznar if you have any questions about adding tests, join us on Slack: https://inviter.co/seleniumhq  | 
    
e95b544    to
    1e84a2b      
    Compare
  
    d242ef8    to
    0f00068      
    Compare
  
    0f00068    to
    7d8068d      
    Compare
  
    | 
           Are you no longer working on this @gryznar?  | 
    
| 
           I've broken something and trying to fix Edit: Done, conflicts also solved. Now I am trying to add tests and check if everything works  | 
    
012d7f7    to
    080a63e      
    Compare
  
    | 
           This broke every single test :) Check out the CI logs... I think there is a circular import.  | 
    
| 
           Yeah, I am aware of this. I was trying to set up Bazel environment (this is not obvious) and almost figure out that. I will take care of it in a bit  | 
    
| 
           no problem. Feel free to ask for help in our Slack if you can't get bazel working: You can also do the build with bazel (  | 
    
| 
           Nice trick, thanks!  | 
    
| 
           I didn't manage to run   | 
    
User description
Fixes: #14881
Description
This change adds support for
RelativeByin type annotationsMotivation and Context
Lack of these annotations causes linting issues
Types of changes
Checklist
PR Type
Bug fix
Description
Add
RelativeByto type annotations in element-finding methodsUpdate expected conditions to accept
RelativeByin locatorsImprove type hinting for better linting and static analysis
Changes walkthrough 📝
shadowroot.py
Add RelativeBy to ShadowRoot element-finding type annotationspy/selenium/webdriver/remote/shadowroot.py
RelativeByto type annotations forfind_elementandfind_elementswebdriver.py
Add RelativeBy to WebDriver element-finding type annotationspy/selenium/webdriver/remote/webdriver.py
find_elementandfind_elementsto acceptRelativeByin typehints
ByTypeimport for improved type hintingevent_firing_webdriver.py
Add RelativeBy to EventFiringWebDriver element-finding typeannotationspy/selenium/webdriver/support/event_firing_webdriver.py
find_elementandfind_elementsto acceptRelativeByin typehints
expected_conditions.py
Add RelativeBy to expected_conditions locator type annotationspy/selenium/webdriver/support/expected_conditions.py
LocatorTypeas a union includingRelativeByRelativeBy