Class: Selenium::WebDriver::BiDi::Transport Private

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/webdriver/bidi/transport.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The seam between the generated Protocol layer and the websocket: serializes a command's params, sends it, and parses the reply into its declared type.

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Transport

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Transport.



28
29
30
# File 'lib/selenium/webdriver/bidi/transport.rb', line 28

def initialize(connection)
  @connection = connection
end

Instance Method Details

#execute(cmd:, params: nil, result: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
35
36
37
38
# File 'lib/selenium/webdriver/bidi/transport.rb', line 32

def execute(cmd:, params: nil, result: nil)
  reply = @connection.send_cmd(method: cmd, params: serialize(params))
  raise Error::WebDriverError, error_message(reply) if reply['error']

  value = reply['result']
  result ? result.from_json(value) : value
end