This is an interface that talks Chrome's Remote Debugging Protocol.
var cd = require('chrome-debugger')('ws://localhost:9222/devtools/page/123')
cd.runtime.evaluate('5', console.log.bind(console));
// 5
Also, see test.js.
-
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 asConsole.messageAdded
,Console.messagesCleared
, andConsole.messageRepeatCountUpdated
.clearMessages
-([callback])
Clears the consoledisable
-([callback])
Disable the console to stop receiving messagesenable
-([ callback])
Enable the console to start receiving messages. The callback will let you know whether the request was succeeded or not.
runtime
- The runtimecallFunctionOn
-(options, [, callback])
, the expression on the page.options
objectId
- [required] object to call function onfunctionDeclaration
- [required] declaration of the function as a stringarguments
- [optional] arguments to give to the call. Objects need to be remote objects as wellreturnByValue
- [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 evaluateobjectGroup
- [optional] Symbolic group name to release objectsreturnByValue
- [optional] Should the return be returned by value, for example, JSON
getProperties
-(remoteObjectId [, ownProperties [, callback]])
, returns the properties of the given remote objectreleaseObject
-(remoteObjectId, [, callback])
, releases a remote objectreleaseObjectGroup
-(objectGroup, [, callback])
, releases a remote objectgroup
npm install
Afterwards, you can start developing on this.