Drive with DevTools Protocol via WS port
Example: This example implements DevTools protocol via WS port
const dp = require('chrome-remote-interface');
async function test() {
const client = await dp();
const {Profiler, Runtime} = client;
await Profiler.enable();
await Profiler.setSamplingInterval({interval: 500});
await Profiler.start();
await Runtime.evaluate({expression: 'startTest();'});
await sleep(800);
const data = await Profiler.stop();
require('fs').writeFileSync('data.cpuprofile',
JSON.stringify(data.profile));
};
test().then((result)=>{
console.log(result);
})
.catch((error)=>{
console.log(error);
});
Node Debugging
Debugging is a concept to identify and remove errors from software applications. In this article, we will learn about the technique to debug a Node application.
Table of Content
- Why not to use console.log()?
- How to debug in Node?
- Steps for debugging in Node
- Additional Debugging APIs
- Drive with DevTools Protocol via WS port
- DevTools Protocol via require(âinspectorâ)
Contact Us