Class: Selenium::WebDriver::BiDi::Transport Private
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | rb/lib/selenium/webdriver/bidi/transport.rb |
Overview
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.
Class Method Summary
- .new(connection) ⇒ Transport constructor Internal use only
Instance Method Summary
- #execute(cmd:, params: nil, result: nil) Internal use only
- #error_message(reply) private Internal use only
- #serialize(params) private Internal use only
Constructor Details
.new(connection) ⇒ Transport
# File 'rb/lib/selenium/webdriver/bidi/transport.rb', line 28
def initialize(connection) @connection = connection end
Instance Method Details
#error_message(reply) (private)
[ GitHub ]# File 'rb/lib/selenium/webdriver/bidi/transport.rb', line 46
def (reply) "#{reply['error']}: #{reply['message']}\n#{reply['stacktrace']}" end
#execute(cmd:, params: nil, result: nil)
# File 'rb/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, (reply) if reply['error'] value = reply['result'] result ? result.from_json(value) : value end
#serialize(params) (private)
[ GitHub ]# File 'rb/lib/selenium/webdriver/bidi/transport.rb', line 42
def serialize(params) params&.as_json || {} end