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] [bidi] Added UnhandledPromptBehavior for new session capability #15391

Merged

Conversation

nvborisenko
Copy link
Member

@nvborisenko nvborisenko commented Mar 8, 2025

User description

https://w3c.github.io/webdriver-bidi/#type-session-UserPromptHandler

Motivation and Context

Contribute to BiDi implementation.

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


Description

  • Introduced UnhandledPromptBehavior for session capabilities in BiDi.

  • Converted CapabilitiesRequest and CapabilityRequest classes to records.

  • Added UserPromptHandler class and UserPromptHandlerType enum for prompt handling.

  • Enhanced session capabilities with better user prompt management.


Changes walkthrough 📝

Relevant files
Enhancement
CapabilitiesRequest.cs
Refactor `CapabilitiesRequest` to record type                       

dotnet/src/webdriver/BiDi/Modules/Session/CapabilitiesRequest.cs

  • Changed CapabilitiesRequest from class to record.
+1/-1     
CapabilityRequest.cs
Update `CapabilityRequest` with prompt handling                   

dotnet/src/webdriver/BiDi/Modules/Session/CapabilityRequest.cs

  • Changed CapabilityRequest from class to record.
  • Replaced WebSocketUrl with UnhandledPromptBehavior.
  • +2/-2     
    UserPromptHandler.cs
    Add `UserPromptHandler` and `UserPromptHandlerType` for prompts

    dotnet/src/webdriver/BiDi/Modules/Session/UserPromptHandler.cs

  • Added new UserPromptHandler record for managing user prompts.
  • Introduced UserPromptHandlerType enum for prompt actions.
  • +42/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Sorry, something went wrong.

    Copy link
    Contributor

    qodo-merge-pro bot commented Mar 8, 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

    Removed Property

    The WebSocketUrl property was removed without replacement. Verify this property is no longer needed or used elsewhere in the codebase.

    public UserPromptHandler? UnhandledPromptBehavior { get; set; }

    Copy link
    Contributor

    qodo-merge-pro bot commented Mar 8, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Learned
    best practice
    Initialize properties with meaningful default values to provide predictable behavior when not explicitly set

    The UserPromptHandler record has nullable enum properties that could benefit
    from having default values. Consider initializing the Default property with a
    meaningful default value like UserPromptHandlerType.Dismiss to provide
    predictable behavior when not explicitly set.

    dotnet/src/webdriver/BiDi/Modules/Session/UserPromptHandler.cs [22-35]

     public record UserPromptHandler
     {
         public UserPromptHandlerType? Alert { get; set; }
     
         public UserPromptHandlerType? BeforeUnload { get; set; }
     
         public UserPromptHandlerType? Confirm { get; set; }
     
    -    public UserPromptHandlerType? Default { get; set; }
    +    public UserPromptHandlerType? Default { get; set; } = UserPromptHandlerType.Dismiss;
     
         public UserPromptHandlerType? File { get; set; }
     
         public UserPromptHandlerType? Prompt { get; set; }
     }
    • Apply this suggestion
    Suggestion importance[1-10]: 6
    Low
    • Update

    Sorry, something went wrong.

    @nvborisenko nvborisenko merged commit 80feb18 into SeleniumHQ:trunk Mar 8, 2025
    9 of 10 checks passed
    @nvborisenko nvborisenko deleted the bidi-unhandledPromptBehavior branch March 8, 2025 17:34
    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.

    None yet

    1 participant