Skip to content

[java] Refactor DriverCommand and W3CHttpCommandCodec for improved readability #16013

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

iampopovich
Copy link
Contributor

@iampopovich iampopovich commented Jul 7, 2025

User description

🔗 Related Issues

fixes #10397

💥 What does this PR do?

changes to remove driver commands are the same as in the commit
also rb and node bindings need similar changes

🔧 Implementation Notes

This pull request removes support for local storage and session storage commands from the Selenium WebDriver's W3C HTTP Command Codec. The changes streamline the codebase by eliminating unused or deprecated commands and their associated logic.

Removal of Local Storage and Session Storage Commands:

💡 Additional Considerations

🔄 Types of changes

  • Cleanup (formatting, renaming)

PR Type

Bug fix


Description

  • Remove deprecated HTML5 local storage and session storage commands

  • Clean up unused driver command constants and imports

  • Eliminate associated command codec aliases and implementations

  • Streamline W3C HTTP command codec for better maintainability


Changes diagram

flowchart LR A["DriverCommand.java"] -- "Remove constants" --> B["Storage Commands Removed"] C["W3CHttpCommandCodec.java"] -- "Remove imports" --> B C -- "Remove aliases" --> B C -- "Remove implementations" --> B B --> D["Cleaner Codebase"] 
Loading

Changes walkthrough 📝

Relevant files
Cleanup
DriverCommand.java
Remove HTML5 storage command constants                                     

java/src/org/openqa/selenium/remote/DriverCommand.java

  • Removed 12 local storage command constants
  • Removed 6 session storage command constants
  • Cleaned up interface definition
  • +0/-12   
    W3CHttpCommandCodec.java
    Remove storage command codec implementations                         

    java/src/org/openqa/selenium/remote/codec/w3c/W3CHttpCommandCodec.java

  • Removed 12 static imports for storage commands
  • Removed 12 command aliases for storage operations
  • Removed 12 JavaScript implementations for storage methods
  • Eliminated localStorage and sessionStorage script executions
  • +0/-72   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @selenium-ci selenium-ci added the C-java Java Bindings label Jul 7, 2025
    @iampopovich iampopovich marked this pull request as ready for review July 7, 2025 16:48
    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 7, 2025

    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

    Breaking Change

    Removal of local storage and session storage commands may break existing code that depends on these features. Verify that this is intentional deprecation and that proper migration guidance exists.

    public W3CHttpCommandCodec() { String sessionId = "/session/:sessionId"; alias(GET_ELEMENT_ATTRIBUTE, EXECUTE_SCRIPT); alias(GET_ELEMENT_LOCATION, GET_ELEMENT_RECT); alias(GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW, EXECUTE_SCRIPT); alias(GET_ELEMENT_SIZE, GET_ELEMENT_RECT); alias(IS_ELEMENT_DISPLAYED, EXECUTE_SCRIPT); alias(SUBMIT_ELEMENT, EXECUTE_SCRIPT); defineCommand(EXECUTE_SCRIPT, post(sessionId + "/execute/sync")); defineCommand(EXECUTE_ASYNC_SCRIPT, post(sessionId + "/execute/async")); alias(GET_PAGE_SOURCE, EXECUTE_SCRIPT); String window = sessionId + "/window"; defineCommand(MAXIMIZE_CURRENT_WINDOW, post(window + "/maximize")); defineCommand(MINIMIZE_CURRENT_WINDOW, post(window + "/minimize"));
    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 7, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    2 participants