Method: Selenium::WebDriver::BiDi::LogHandler#add_message_handler

Defined in:
lib/selenium/webdriver/bidi/log_handler.rb

#add_message_handler(type) ⇒ int

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.

steep:ignore:start

Returns:

  • (int)

    id of the handler



39
40
41
42
43
44
45
46
47
# File 'lib/selenium/webdriver/bidi/log_handler.rb', line 39

def add_message_handler(type)
  subscribe_log_entry unless @log_entry_subscribed
  @bidi.add_callback('log.entryAdded') do |params|
    if params['type'] == type
      log_entry_klass = type == 'console' ? ConsoleLogEntry : JavaScriptLogEntry
      yield(log_entry_klass.new(**params))
    end
  end
end