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 Attribute Summary collapse

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.



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

def initialize(connection)
  @connection = connection
end

Instance Attribute Details

#connectionObject (readonly)

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.

The websocket the transport sends over. Exposed so a domain can build a sibling domain (e.g. a vendor variant) over the same connection without Transport ever becoming a public constructor argument.



31
32
33
# File 'lib/selenium/webdriver/bidi/transport.rb', line 31

def 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.



37
38
39
40
41
42
43
# File 'lib/selenium/webdriver/bidi/transport.rb', line 37

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

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