Skip to content
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

[py] Upgraded WebDriverWait Docstrings #15054

Open
wants to merge 10 commits into
base: trunk
Choose a base branch
from

Conversation

shbenzer
Copy link
Contributor

@shbenzer shbenzer commented Jan 9, 2025

User description

Description

improved the docstrings of the WebDriverWait class and its methods

Motivation and Context

improves documentation and better informs users

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Documentation


Description

  • Enhanced docstrings for WebDriverWait class and methods.

  • Improved parameter descriptions with detailed explanations.

  • Added examples for better understanding of usage.

  • Updated formatting for consistency and clarity.


Changes walkthrough 📝

Relevant files
Documentation
wait.py
Enhanced docstrings for `WebDriverWait` class methods       

py/selenium/webdriver/support/wait.py

  • Updated docstrings for __init__, until, and until_not methods.
  • Reformatted parameter descriptions for clarity.
  • Added detailed examples for method usage.
  • Improved consistency in documentation style.
  • +84/-27 

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    qodo-merge-pro bot commented Jan 9, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Documentation Error

    The docstring for until_not() method incorrectly states it waits for a non-False value, but it actually waits for a False value. This could mislead users.

    """Wait until the method returns a value that is not False
    
    Calls the method provided with the driver as an argument until the 
    return value does not evaluate to ``False``.

    Copy link
    Contributor

    qodo-merge-pro bot commented Jan 9, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Fix incorrect docstring that contradicts the actual behavior of the method

    The docstring for until_not method incorrectly states it waits for a non-False
    value, when it actually waits for a False value. Update the description to
    accurately reflect the method's behavior.

    py/selenium/webdriver/support/wait.py [144-147]

     def until_not(self, method: Callable[[D], T], message: str = "") -> Union[T, Literal[True]]:
    -    """Wait until the method returns a value that is not False
    +    """Wait until the method returns False
         
         Calls the method provided with the driver as an argument until the 
    -    return value does not evaluate to ``False``."""
    +    return value evaluates to ``False``."""
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: The docstring contains a critical error that completely misrepresents the method's behavior, which could lead to incorrect usage. The method waits for a False value, not a non-False value as currently documented.

    9
    General
    Provide a more appropriate example that demonstrates the intended usage of the method

    The example in until_not docstring shows waiting for element visibility when it
    should demonstrate waiting for element invisibility, which is the typical use case
    for this method.

    py/selenium/webdriver/support/wait.py [172-174]

    -# Wait until an element is visible on the page
    +# Wait until an element disappears from the page
     >>> wait = WebDriverWait(driver, 10)
    ->>> is_disappeared = wait.until_not(EC.visibility_of_element_located((By.ID, "exampleId")))
    +>>> is_disappeared = wait.until_not(EC.presence_of_element_located((By.ID, "exampleId")))
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The example's comment and code are inconsistent, potentially confusing users. The improved version better demonstrates the typical use case of waiting for an element to disappear, making the documentation more helpful.

    7

    @shbenzer shbenzer changed the title Improved WebDriverWait Docstrings [py] Upgraded WebDriverWait Docstrings Jan 9, 2025
    @shbenzer
    Copy link
    Contributor Author

    shbenzer commented Jan 12, 2025

    @diemol should be good to go now

    Copy link

    codecov bot commented Jan 12, 2025

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 58.61%. Comparing base (4aee006) to head (e3d089f).
    Report is 4 commits behind head on trunk.

    Additional details and impacted files
    @@           Coverage Diff           @@
    ##            trunk   #15054   +/-   ##
    =======================================
      Coverage   58.61%   58.61%           
    =======================================
      Files          94       94           
      Lines        5998     5998           
      Branches      259      259           
    =======================================
      Hits         3516     3516           
      Misses       2223     2223           
      Partials      259      259           

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    @shbenzer
    Copy link
    Contributor Author

    @AutomatedTester should work now

    @shbenzer
    Copy link
    Contributor Author

    one of the packages format.sh used needed to be reinstalled

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants