Skip to content

[Feature]: unroute WebSocket #41158

@TTSPhilipp

Description

@TTSPhilipp

🚀 Feature Request

Playwright currently provides:

page.route() / page.unroute() for HTTP request routing
page.routeWebSocket() for WebSocket routing

However, there is no equivalent to remove a previously registered WebSocket route handler (for example, something like page.unrouteWebSocket()).

Example

No response

Motivation

I want to test that my web application behaves correctly when the connection to the WebSocket server drops and cannot be re-established.

The current problem is that Playwright’s WebSocket always sends an open event. However, the test should cover the case where a connection is never established in the first place. So simply calling ws.close() on the WebSocket is not sufficient.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions