Module: Selenium::WebDriver::DriverExtensions::HasLogEvents Private
- Includes:
- Atoms
- Defined in:
- lib/selenium/webdriver/common/driver_extensions/has_log_events.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- KINDS =
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.
%i[console exception mutation].freeze
Instance Method Summary collapse
-
#on_log_event(kind, &block) {|| ... } ⇒ Object
private
Registers listener to be called whenever browser receives a new Console API message such as console.log() or an unhandled exception.
Methods included from Atoms
Instance Method Details
#on_log_event(kind, &block) {|| ... } ⇒ 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.
Registers listener to be called whenever browser receives a new Console API message such as console.log() or an unhandled exception.
This currently relies on DevTools so is only supported in Chromium browsers.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/selenium/webdriver/common/driver_extensions/has_log_events.rb', line 59 def on_log_event(kind, &block) if browser == :firefox WebDriver.logger.deprecate( 'Driver#on_log_event on Firefox', 'the script.add_console_message_handler or the script.add_javascript_error_handler methods', id: :on_log_event ) end raise Error::WebDriverError, "Don't know how to handle #{kind} events" unless KINDS.include?(kind) enabled = log_listeners[kind].any? log_listeners[kind] << block return if enabled devtools.runtime.enable __send__(:"log_#{kind}_events") end |