Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: b1b0c6a7bf
Fetching contributors…

Cannot retrieve contributors at this time

78 lines (53 sloc) 2.63 KB

Chrome Debugger

Ever wanted to capture stats (#requests, onload time, etc.) about the state of your frontend? Us too! Chrome Debugger uses the remote debugging protocol in Chrome to do just that!

Intended to be a used in a post-deploy or CI step.



gem install chrome_debugger

Extra Requirements

Chrome 18 or higher must be installed and available on the path.


require 'chrome_debugger' do |chrome|
  document = chrome.load_url("")

  puts "request count:                      #{document.request_count}"
  puts "onload event fired:                 #{document.onload_event}"
  puts "dom content event fired:            #{document.dom_content_event}"
  puts "payload document encoded bytes:     #{document.encoded_bytes("Document")}"
  puts "payload script encoded bytes:       #{document.encoded_bytes("Script")}"
  puts "payload image encoded bytes:        #{document.encoded_bytes("Image")}"
  puts "payload stylesheet encoded bytes:   #{document.encoded_bytes("Stylesheet")}"
  puts "payload other encoded bytes:        #{document.encoded_bytes("Other")}"
  puts "payload document bytes:             #{document.bytes("Document")}"
  puts "payload script bytes:               #{document.bytes("Script")}"
  puts "payload image bytes:                #{document.bytes("Image")}"
  puts "payload stylesheet bytes:           #{document.bytes("Stylesheet")}"
  puts "payload other bytes:                #{document.bytes("Other")}"
  puts "script requests:                    #{document.request_count_by_resource("Script")}"
  puts "image requests:                     #{document.request_count_by_resource("Image")}"
  puts "stylesheet requests:                #{document.request_count_by_resource("Stylesheet")}"

Refer to the ChromeDebugger::Client and ChromeDebugger::Document classes for detailed docs.

ChromeDebugger::Client starts and manages a new chrome session.

ChromeDebugger::Document provides an entry point for querying the results of a page load.


Justin Morris

James Healy

Further Reading


Possible further work.

  • make the chrome path configurable
  • make headless mode configurable


chrome_debugger is Copyright (c) 2012 The Conversation Media Group and distributed under the MIT license.

Jump to Line
Something went wrong with that request. Please try again.