Class: Selenium::WebDriver::BiDi::LogHandler Private
- Inherits:
-
Object
- Object
- Selenium::WebDriver::BiDi::LogHandler
- Defined in:
- lib/selenium/webdriver/bidi/log_handler.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Implements the Log of the WebDriver-BiDi specification This functionality should be accessed through driver.script method
Constant Summary collapse
- ConsoleLogEntry =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
BiDi::Struct.new(:level, :text, :timestamp, :stack_trace, :type, :source, :method, :args)
- JavaScriptLogEntry =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
BiDi::Struct.new(:level, :text, :timestamp, :stack_trace, :type, :source)
Instance Method Summary collapse
-
#add_message_handler(type) ⇒ int
private
steep:ignore:start.
-
#initialize(bidi) ⇒ LogHandler
constructor
private
A new instance of LogHandler.
- #remove_message_handler(id) ⇒ Object private
Constructor Details
#initialize(bidi) ⇒ LogHandler
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.
Returns a new instance of LogHandler.
32 33 34 35 |
# File 'lib/selenium/webdriver/bidi/log_handler.rb', line 32 def initialize(bidi) @bidi = bidi @log_entry_subscribed = false end |
Instance Method Details
#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
39 40 41 42 43 44 45 46 47 |
# File 'lib/selenium/webdriver/bidi/log_handler.rb', line 39 def (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 |
#remove_message_handler(id) ⇒ Object
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.
51 52 53 54 |
# File 'lib/selenium/webdriver/bidi/log_handler.rb', line 51 def (id) @bidi.remove_callback('log.entryAdded', id) unsubscribe_log_entry if @log_entry_subscribed && @bidi.callbacks['log.entryAdded'].empty? end |