class Selenium::WebDriver::BiDi::LogHandler
Constants
- ConsoleLogEntry
- JavaScriptLogEntry
Public Class Methods
Source
# File lib/selenium/webdriver/bidi/log_handler.rb, line 27 def initialize(bidi) @bidi = bidi @log_entry_subscribed = false end
Public Instance Methods
Source
# File lib/selenium/webdriver/bidi/log_handler.rb, line 34 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
@return [int] id of the handler steep:ignore:start
Source
# File lib/selenium/webdriver/bidi/log_handler.rb, line 46 def remove_message_handler(id) @bidi.remove_callback('log.entryAdded', id) unsubscribe_log_entry if @log_entry_subscribed && @bidi.callbacks['log.entryAdded'].empty? end
@param [int] id of the handler previously added
Private Instance Methods
Source
# File lib/selenium/webdriver/bidi/log_handler.rb, line 53 def subscribe_log_entry @bidi.session.subscribe('log.entryAdded') @log_entry_subscribed = true end
Source
# File lib/selenium/webdriver/bidi/log_handler.rb, line 58 def unsubscribe_log_entry @bidi.session.unsubscribe('log.entryAdded') @log_entry_subscribed = false end