Skip to content

Instantly share code, notes, and snippets.

@radum
Created May 11, 2018 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radum/1ba3c188ba795453b678020ff8f8c515 to your computer and use it in GitHub Desktop.
Save radum/1ba3c188ba795453b678020ff8f8c515 to your computer and use it in GitHub Desktop.
Devtools protocol monitor in JS
const ws = new WebSocket('http://localhost:9222/json');
ws.on('open', () => {
ws.send(JSON.stringify({
id: 1,
method: 'Runtime.evaluate',
params: {
expression: 'document.title'
}
}));
}).on('message', data => {
data = JSON.parse(data);
console.log(data.result.result.value);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment