Skip to content
Control Chrome Remotely
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
lib
.gitignore
CHANGELOG
Gemfile
Gemfile.lock
LICENSE
README.md
chrome_debugger.gemspec

README.md

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.

Yay-hooray!

Installation

gem install chrome_debugger

Extra Requirements

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

Usage

require 'chrome_debugger'

ChromeDebugger::Client.open do |chrome|
  document = chrome.load_url("https://theconversation.edu.au/")

  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")}"
end

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.

Authors

Justin Morris

James Healy

Further Reading

TODO

Possible further work.

  • make the chrome path configurable
  • make headless mode configurable

License

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

Something went wrong with that request. Please try again.