Class: Selenium::WebDriver::BiDi

Inherits:
Object
  • Object
show all
Defined in:
rb/lib/selenium/webdriver/bidi.rb,
rb/lib/selenium/webdriver/bidi/struct.rb,
rb/lib/selenium/webdriver/bidi/session.rb,
rb/lib/selenium/webdriver/bidi/log_handler.rb,
rb/lib/selenium/webdriver/bidi/log/filter_by.rb,
rb/lib/selenium/webdriver/bidi/log_inspector.rb,
rb/lib/selenium/webdriver/bidi/navigate_result.rb,
rb/lib/selenium/webdriver/bidi/browsing_context.rb,
rb/lib/selenium/webdriver/bidi/log/base_log_entry.rb,
rb/lib/selenium/webdriver/bidi/browsing_context_info.rb,
rb/lib/selenium/webdriver/bidi/log/console_log_entry.rb,
rb/lib/selenium/webdriver/bidi/log/generic_log_entry.rb,
rb/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb

Defined Under Namespace

Classes: BaseLogEntry, BrowsingContext, BrowsingContextInfo, ConsoleLogEntry, FilterBy, GenericLogEntry, JavascriptLogEntry, LogHandler, LogInspector, NavigateResult, Session, Struct

Instance Method Summary collapse

Constructor Details

#initialize(url:) ⇒ BiDi

Returns a new instance of BiDi.



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

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

Instance Method Details

#add_callback(event, &block) ⇒ Object



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

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

#callbacksObject



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

def callbacks
  @ws.callbacks
end

#closeObject



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

def close
  @ws.close
end

#error_message(message) ⇒ Object



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

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

#remove_callback(event, id) ⇒ Object



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

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

#send_cmd(method, **params) ⇒ Object



53
54
55
56
57
58
59
# File 'rb/lib/selenium/webdriver/bidi.rb', line 53

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

#sessionObject



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

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