Skip to content

[WebDriver BiDi] Cover command dispatch without an associated session #63211

Open

Description

@sergedeh

Summary

The WebDriver WPT suite does not currently verify how a remote end dispatches commands received on a WebSocket connection that is not associated with a session.

The existing session.status test uses the bidi_session fixture. That fixture creates a session and associates the WebSocket connection with it before sending the command. The test therefore verifies the command's result shape, but it does not verify the defining property of session.status: it is a static command and must be usable without an active session.

Without this coverage, an implementation can reject every command on an unassociated connection before classifying the command and still pass the existing test.

Required behavior

The WebDriver BiDi incoming-message algorithm identifies the requested command before applying the session requirement. Commands are session-bound unless their definition explicitly declares them static. session.status is a static command.

For a connection without an associated session, this produces three distinct outcomes:

  • session.status succeeds because it is static.
  • A known session-bound command, such as browsingContext.getTree, returns invalid session id.
  • An unknown method returns unknown command; it is not reclassified as a session error.

Closing an unassociated connection must also remove that connection without terminating the remote end or requiring a session to exist.

The central invariant is: the remote end classifies a command before deciding whether that command requires an associated session.

Proposed coverage

Add a WebDriver test that obtains an unassociated WebSocket connection without relying on runner-specific port configuration:

  1. Create a classic WebDriver session with the webSocketUrl capability enabled, solely to discover the BiDi listener URL.
  2. Save the returned URL and delete that session.
  3. Replace the session-specific resource path with /session and open a raw WebSocket connection.
  4. Send session.status and verify a success response containing a boolean ready and a string message. The value of ready remains implementation-defined.
  5. Send browsingContext.getTree and verify an invalid session id response.
  6. Send an unknown method and verify an unknown command response.
  7. Close the unassociated connection, reconnect, and send session.status again to verify that connection cleanup leaves the remote end usable.

This setup exercises the no-session state while avoiding a dependency on session.new or a browser-specific WebDriver runner option.

Scope

This issue covers command classification, the session gate, and cleanup of an unassociated connection. It does not cover:

  • creating a BiDi-only session with session.new;
  • associating the connection after session.new succeeds;
  • command-specific behavior after a session has been created.

References

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions