0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Starts a Google Chrome session. Load pages and examine the results.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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.