I want to get the response data for the particular API call using chrome-remote-interface. I am not sure how to print the response. I am able to get the APIs that are being called using the demo code available in their GitHub repo.
Mentioned a screenshot that I need from Chrome DevTools.
const chromeLauncher = require("chrome-launcher");
const CDP = require("chrome-remote-interface");
const axios = require("axios");
(async function () {
async function launchChrome() {
return await chromeLauncher.launch({
chromeFlags: ["--no-first-run", "--disable-gpu", "--no-sandbox"],
});
}
const chrome = await launchChrome();
const client = await CDP({
port: chrome.port,
});
const { Network, Page } = client;
await Page.enable();
await Network.enable();
await Page.navigate({ url: "[URL]" });
await Page.loadEventFired();
Network.requestWillBeSent((params) => {
if (
params.request.url ===
"[URL]/rest/api/v1/ra/user?key=value&key=value"
)
{
**Want to get the response for the API**
}
});
})();