module

Playwright::WebSocket

The WebSocket class represents websocket connections in the page.

Instance methods

add_listener(type : EventType, listener : Listener(EventType))
Source
is_closed

Indicates that the web socket has been closed.

Source
remove_listener(type : EventType, listener : Listener(EventType))
Source
url

Contains the URL of the WebSocket.

Source
wait_for_event(event : EventType, predicate : Event(EventType) -> Bool) : Deferred(Event(EventType))
Source
wait_for_event(event : EventType, options : WaitForEventOptions | Nil) : Deferred(Event(EventType))

Returns the event data value. Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the webSocket is closed before the event is fired.

Source
wait_for_event(event : EventType) : Deferred(Event(EventType))
Source

Nested types