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] Fix adding cookies when ReturnedCookie class is used #14697

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Oct 31, 2024

User description

Motivation and Context

Fixes #14695

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

Bug fix


Description

  • Fixed an issue where adding cookies using the ReturnedCookie class in Selenium WebDriver was not supported due to missing serialization metadata.
  • Added ReturnedCookie to the JsonSerializable attributes in the Command class to resolve the NotSupportedException error.

Changes walkthrough 📝

Relevant files
Bug fix
Command.cs
Add serialization support for `ReturnedCookie` in Command class

dotnet/src/webdriver/Command.cs

  • Added ReturnedCookie to the list of types in JsonSerializable
    attributes.
  • Ensures proper serialization of ReturnedCookie objects.
  • +1/-0     

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

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis ✅

    14695 - Fully compliant

    Fully compliant requirements:

    • Fix the issue of being unable to add cookies in Selenium v4.26.0
    • Resolve the NotSupportedException error when adding cookies
    • Ensure compatibility with .NET/C# Selenium WebDriver
    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Potential Side Effects
    Verify that adding ReturnedCookie to JsonSerializable doesn't introduce unintended serialization behavior for other parts of the codebase.

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Enhancement
    Expand the list of JsonSerializable types to include all relevant Selenium WebDriver classes

    Consider adding other relevant Selenium WebDriver types to the JsonSerializable
    attributes list for comprehensive serialization support.

    dotnet/src/webdriver/Command.cs [158-163]

     [JsonSerializable(typeof(char[]))]
     [JsonSerializable(typeof(byte[]))]
     [JsonSerializable(typeof(Dictionary<string, object>))]
     [JsonSerializable(typeof(Cookie))]
     [JsonSerializable(typeof(ReturnedCookie))]
     [JsonSerializable(typeof(Proxy))]
    +[JsonSerializable(typeof(WebElement))]
    +[JsonSerializable(typeof(DriverOptions))]
    +// Add other relevant Selenium WebDriver types
    • Apply this suggestion
    Suggestion importance[1-10]: 3

    Why: The suggestion to add more Selenium WebDriver types to the JsonSerializable attributes list could enhance serialization support. However, it is speculative and lacks specific context or evidence that these additional types are necessary for the current implementation, thus having a limited impact.

    3

    💡 Need additional feedback ? start a PR chat

    @nvborisenko nvborisenko merged commit 8aee746 into SeleniumHQ:trunk Oct 31, 2024
    10 checks passed
    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.

    [🐛 Bug]: Unable to add cookies in Selenium v4.26.0
    1 participant