class Selenium::WebDriver::BiDi::Transport

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

def error_message(reply)

def error_message(reply)
  "#{reply['error']}: #{reply['message']}\n#{reply['stacktrace']}"
end

def execute(cmd:, params: nil, result: nil)

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

def initialize(connection)

def initialize(connection)
  @connection = connection
end

def serialize(params)

def serialize(params)
  params&.as_json || {}
end