Module: Capybara::Lightpanda::Browser::Console

Included in:
Capybara::Lightpanda::Browser
Defined in:
lib/capybara/lightpanda/browser/console.rb

Overview

Runtime.consoleAPICalled consumers: the user-facing console_logs ring buffer, the optional IO-logger stream, and the Turbo busy/idle sentinel tracking behind Browser#wait_for_idle.

Instance Method Summary collapse

Instance Method Details

#clear_console_logsObject



22
23
24
# File 'lib/capybara/lightpanda/browser/console.rb', line 22

def clear_console_logs
  @console_logs_mutex.synchronize { @console_logs.clear }
end

#console_logsObject

Console messages captured from ‘Runtime.consoleAPICalled` since the last `reset` (Turbo-tracker sentinels excluded). Loose hashes, like Network#traffic: `text:, timestamp:, args:` where `type` is the console method name (“log”, “error”, “warning”, …), `text` joins the arguments’ primitive values/descriptions, and ‘args` keeps the raw CDP RemoteObjects. Lets suites assert on JS console errors (`browser.console_logs.select { |m| m == “error” }`) the way peer drivers do via custom Ferrum loggers.



18
19
20
# File 'lib/capybara/lightpanda/browser/console.rb', line 18

def console_logs
  @console_logs_mutex.synchronize { @console_logs.dup }
end