Class: Playwright::WebSocket

Inherits:
PlaywrightApi show all
Defined in:
lib/playwright_api/web_socket.rb

Overview

The ‘WebSocket` class represents websocket connections in the page.

Instance Method Summary collapse

Methods inherited from PlaywrightApi

#==, #initialize, wrap

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#closed?Boolean

Indicates that the web socket has been closed.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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

#urlObject

Contains the URL of the WebSocket.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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