Repository navigation
[WebDriver BiDi] Cover command dispatch without an associated session #63211
Description
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.statussucceeds because it is static.- A known session-bound command, such as
browsingContext.getTree, returnsinvalid 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:
- Create a classic WebDriver session with the
webSocketUrlcapability enabled, solely to discover the BiDi listener URL. - Save the returned URL and delete that session.
- Replace the session-specific resource path with
/sessionand open a raw WebSocket connection. - Send
session.statusand verify a success response containing a booleanreadyand a stringmessage. The value ofreadyremains implementation-defined. - Send
browsingContext.getTreeand verify aninvalid session idresponse. - Send an unknown method and verify an
unknown commandresponse. - Close the unassociated connection, reconnect, and send
session.statusagain 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.newsucceeds; - command-specific behavior after a session has been created.
Activity