Sha256: 45590ebeecee1eb2b1179ef6a5c2bfaa6250066d39d84cf5bc20aaa725a0a608

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module WithClues
  class BrowserLogs
    def dump(notifier, page:, context:)
      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)
        if page.driver.browser.respond_to?(:manage)
          if page.driver.browser.manage.respond_to?(:logs)
            logs = page.driver.browser.manage.logs
            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"
          else
            notifier.notify "NO BROWSER LOGS: page.driver.browser.manage #{page.driver.browser.manage.class} does not respond to #logs"
          end
        else
          notifier.notify "NO BROWSER LOGS: page.driver.browser #{page.driver.browser.class} does not respond to #manage"
        end
      else
        notifier.notify "NO BROWSER LOGS: page.driver #{page.driver.class} does not respond to #browser"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
with_clues-1.1.0 lib/with_clues/browser_logs.rb
with_clues-1.0.0 lib/with_clues/browser_logs.rb