Skip to content

Instantly share code, notes, and snippets.

@fernyb
Last active August 29, 2015 14:01
Show Gist options
  • Save fernyb/4caec5950d95998ab5a4 to your computer and use it in GitHub Desktop.
Save fernyb/4caec5950d95998ab5a4 to your computer and use it in GitHub Desktop.
Remote Debugging Protocol
# View the messages sent to the websocket
# https://developers.google.com/chrome-developer-tools/docs/debugger-protocol
#
_old_send = function(msg) { console.log(msg); console.log(" "); WebInspector.socket.send(msg); };
InspectorFrontendHost.sendMessageToBackend = _old_send;
WebInspector.socket.onmessage = function(message) { console.log(message.data); console.log(" "); InspectorBackend.dispatch(message.data); };
Sent:
{"method":"Runtime.evaluate","params":{"expression":"document.location.href","objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptions":false,"frameId":"0.1","returnByValue":false},"id":150}
Result:
{"result":{"result":{"type":"string","value":"http://stage-www.yellowpages.com/"},"wasThrown":false},"id":150}
InspectorFrontendHost.sendMessageToBackend("{\"method\":\"Runtime.evaluate\", \"params\":{\"expression\":\"window.getComputedStyle(btns[0], null).getPropertyValue('display')\"}, \"id\":365, \"returnByValue\":false}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment