Class: WithClues::BrowserLogs

Inherits:
Object
  • Object
show all
Defined in:
lib/with_clues/browser_logs.rb

Instance Method Summary collapse

Instance Method Details

#dump(notifier, page:, context:, captured_logs: []) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/with_clues/browser_logs.rb', line 3

def dump(notifier, page:, context:, captured_logs: [])
  if !page.respond_to?(:driver)
    notifier.notify "Something may be wrong. page (#{page.class}) does not respond to #driver"
    return
  end
  if page.driver.respond_to?(:browser)
    logs = locate_logs(page.driver.browser, notifier: notifier)
    if !logs.nil?
      browser_logs = logs.get(:browser)
      notifier.notify "BROWSER LOGS {"
      browser_logs.each do |log|
        notifier.notify_raw log.message
      end
      notifier.notify "} END BROWSER LOGS"
    end
  else
    notifier.notify "[with_clues: #{self.class}] NO BROWSER LOGS: page.driver #{page.driver.class} does not respond to #browser"
  end
end