/chrome-debugger

An node.js interface to chrome remote debugging protocol

Primary LanguageJavaScriptMIT LicenseMIT

Chrome Debugger

This is an interface that talks Chrome's Remote Debugging Protocol.

Usage

var cd = require('chrome-debugger')('ws://localhost:9222/devtools/page/123')
cd.runtime.evaluate('5', console.log.bind(console));
// 5

Also, see test.js.

API

  • require('chrome-debugger') - This returns a function that given a websocket endpoint for chrome, will return an object that can talk the debugger protocol.

    • console - By enabling the console, you can listen to messages from the console. This object is an event emitter, so, you can listen to messages such as Console.messageAdded, Console.messagesCleared, and Console.messageRepeatCountUpdated.
      • clearMessages - ([callback]) Clears the console
      • disable - ([callback]) Disable the console to stop receiving messages
      • enable - ([ callback]) Enable the console to start receiving messages. The callback will let you know whether the request was succeeded or not.
    • runtime - The runtime
      • callFunctionOn - (options, [, callback]), the expression on the page.
        • options
          • objectId - [required] object to call function on
          • functionDeclaration - [required] declaration of the function as a string
          • arguments - [optional] arguments to give to the call. Objects need to be remote objects as well
          • returnByValue - [optional] Should the return be returned by value, for example, JSON
      • evaluate - (options, [, callback]), evaluates the expression on the page.
        • options
          • expression - [required] The expression to evaluate
          • objectGroup - [optional] Symbolic group name to release objects
          • returnByValue - [optional] Should the return be returned by value, for example, JSON
      • getProperties - (remoteObjectId [, ownProperties [, callback]]), returns the properties of the given remote object
      • releaseObject - (remoteObjectId, [, callback]), releases a remote object
      • releaseObjectGroup - (objectGroup, [, callback]), releases a remote objectgroup

Developing

npm install

Afterwards, you can start developing on this.

LICENSE

MIT