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

[dotnet] Remove obsoleted members/types for 4.30 #15342

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Feb 25, 2025

User description

Remove obsoleted members/types aimed for v4.30

Motivation and Context

Clean old code.

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

Enhancement, Bug fix


Description

  • Removed obsolete exception classes ElementNotSelectableException and ElementNotVisibleException.

  • Updated IWebElement and WebElement interfaces to remove references to obsolete exceptions.

  • Refactored Response class to remove deprecated constructors and properties, making it immutable.

  • Cleaned up WebDriverResult enum by removing obsolete error codes.


Changes walkthrough 📝

Relevant files
Enhancement
ElementNotSelectableException.cs
Removed `ElementNotSelectableException` class.                     

dotnet/src/webdriver/ElementNotSelectableException.cs

  • Removed the ElementNotSelectableException class.
  • This class was marked obsolete and is no longer needed.
  • +0/-63   
    ElementNotVisibleException.cs
    Removed `ElementNotVisibleException` class.                           

    dotnet/src/webdriver/ElementNotVisibleException.cs

  • Removed the ElementNotVisibleException class.
  • This class was marked obsolete and is no longer needed.
  • +0/-63   
    IWebElement.cs
    Updated `IWebElement` interface to remove obsolete exceptions.

    dotnet/src/webdriver/IWebElement.cs

  • Removed references to ElementNotVisibleException in method
    documentation.
  • Updated exception handling to align with removed exceptions.
  • +0/-2     
    Response.cs
    Refactored `Response` class to remove deprecated features.

    dotnet/src/webdriver/Response.cs

  • Removed obsolete constructors and properties.
  • Made the Response class immutable by using init properties.
  • Cleaned up deprecated warnings and obsolete code.
  • +3/-41   
    WebDriver.cs
    Updated `WebDriver` exception handling logic.                       

    dotnet/src/webdriver/WebDriver.cs

  • Removed handling for ElementNotVisibleException and
    ElementNotSelectableException.
  • Updated exception handling logic to align with removed exceptions.
  • +0/-7     
    WebDriverResult.cs
    Cleaned up `WebDriverResult` enum by removing obsolete codes.

    dotnet/src/webdriver/WebDriverResult.cs

  • Removed multiple obsolete error codes from the WebDriverResult enum.
  • Cleaned up deprecated and unused error statuses.
  • +0/-98   
    WebElement.cs
    Updated `WebElement` class to remove obsolete exceptions.

    dotnet/src/webdriver/WebElement.cs

  • Removed references to ElementNotVisibleException in method
    documentation.
  • Updated exception handling to align with removed exceptions.
  • +0/-2     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Error Handling

    Removal of ElementNotDisplayed and NoSuchDocument error cases may affect error handling flows. Verify that these errors are properly handled by the remaining exception types.

    case WebDriverResult.ElementClickIntercepted:
        throw new ElementClickInterceptedException(errorMessage);
    
    case WebDriverResult.ElementNotInteractable:
        throw new ElementNotInteractableException(errorMessage);
    
    case WebDriverResult.InvalidElementState:
        throw new InvalidElementStateException(errorMessage);
    
    case WebDriverResult.Timeout:
        throw new WebDriverTimeoutException(errorMessage);
    
    case WebDriverResult.NoSuchWindow:
    Breaking Change

    Making Response class immutable by changing properties to init-only could break existing code that modifies Response properties after construction.

    public object? Value { get; init; }
    
    /// <summary>
    /// Gets or sets the session ID.
    /// </summary>
    public string? SessionId { get; init; }
    
    /// <summary>
    /// Gets or sets the status value of the response.
    /// </summary>
    public WebDriverResult Status { get; init; }

    Copy link
    Contributor

    qodo-merge-pro bot commented Feb 25, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Copy link
    Contributor

    @RenderMichael RenderMichael left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Always nice to have these improvements! One concern with the Response type.

    @nvborisenko nvborisenko merged commit 505b594 into SeleniumHQ:trunk Feb 25, 2025
    10 checks passed
    @nvborisenko nvborisenko deleted the dotnet-remove-obsolete branch February 25, 2025 22:18
    sandeepsuryaprasad pushed a commit to sandeepsuryaprasad/selenium that referenced this pull request Mar 23, 2025
    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.

    2 participants