Class: Playwright::WebSocket
- Inherits:
-
PlaywrightApi
- Object
- PlaywrightApi
- Playwright::WebSocket
- Defined in:
- lib/playwright_api/web_socket.rb
Overview
The ‘WebSocket` class represents websocket connections in the page.
Instance Method Summary collapse
-
#closed? ⇒ Boolean
Indicates that the web socket has been closed.
-
#expect_event(event, predicate: nil, timeout: nil) ⇒ Object
Waits for event to fire and passes its value into the predicate function.
-
#url ⇒ Object
Contains the URL of the WebSocket.
-
#wait_for_event(event, predicate: nil, timeout: nil) ⇒ Object
> NOTE: In most cases, you should use [‘method: WebSocket.waitForEvent`].
Methods inherited from PlaywrightApi
Constructor Details
This class inherits a constructor from Playwright::PlaywrightApi
Instance Method Details
#closed? ⇒ Boolean
Indicates that the web socket has been closed.
6 7 8 |
# File 'lib/playwright_api/web_socket.rb', line 6 def closed? raise NotImplementedError.new('closed? is not implemented yet.') end |
#expect_event(event, predicate: nil, timeout: nil) ⇒ Object
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. Returns the event data value.
17 18 19 |
# File 'lib/playwright_api/web_socket.rb', line 17 def expect_event(event, predicate: nil, timeout: nil) raise NotImplementedError.new('expect_event is not implemented yet.') end |
#url ⇒ Object
Contains the URL of the WebSocket.
11 12 13 |
# File 'lib/playwright_api/web_socket.rb', line 11 def url raise NotImplementedError.new('url is not implemented yet.') end |
#wait_for_event(event, predicate: nil, timeout: nil) ⇒ Object
> NOTE: In most cases, you should use [‘method: WebSocket.waitForEvent`].
Waits for given ‘event` to fire. If predicate is provided, it passes event’s value into the ‘predicate` function and waits for `predicate(event)` to return a truthy value. Will throw an error if the socket is closed before the `event` is fired.
26 27 28 |
# File 'lib/playwright_api/web_socket.rb', line 26 def wait_for_event(event, predicate: nil, timeout: nil) raise NotImplementedError.new('wait_for_event is not implemented yet.') end |