123456789_123456789_123456789_123456789_123456789_

Class: Selenium::WebDriver::BiDi

Class Method Summary

Instance Method Summary

Constructor Details

.new(url:) ⇒ BiDi

[ GitHub ]

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

def initialize(url:)
  @ws = WebSocketConnection.new(url: url)
end

Instance Method Details

#add_callback(event)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi.rb', line 42

def add_callback(event, &)
  @ws.add_callback(event, &)
end

#callbacks

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi.rb', line 38

def callbacks
  @ws.callbacks
end

#close

[ GitHub ]

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

def close
  @ws.close
end

#error_message(message)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi.rb', line 62

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

#remove_callback(event, id)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi.rb', line 46

def remove_callback(event, id)
  @ws.remove_callback(event, id)
end

#send_cmd(method, **params)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi.rb', line 54

def send_cmd(method, **params)
  data = {method: method, params: params.compact}
  message = @ws.send_cmd(**data)
  raise Error::WebDriverError, error_message(message) if message['error']

  message['result']
end

#session

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/bidi.rb', line 50

def session
  @session ||= Session.new(self)
end