Error: Protocol error (Network.getResponseBody): No resource with given identifier found
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.20.0
- Platform / OS version: Arch Linux
- URLs (if applicable):
- Node.js version: 10.16.1
What steps will reproduce the problem?
I’m trying to get content from an iframe by navigating to the URL of the iframe. I’ve tried without a Chrome Devtools Protocol session:
const client = await page.target().createCDPSession();
and it works but it breaks with the following error otherwise.
client.on("Network.loadingFinished", async ({ requestId }) => {
counter++;
const params = await client.send("Network.getResponseBody", { requestId });
counter--;
const { body, base64Encoded } = params;
events.push({
method: "Network.getResponseBody",
params: {
requestId,
body,
base64Encoded
}
});
if (counter === 0) {
finish();
}
});
if (iframesList.length > 0) {
for (let frameIndex = 0; frameIndex < iframesList.length; frameIndex++) {
const iframe = iframesList[frameIndex];
console.log("frameIndex: ", frameIndex);
const src = await iframe.evaluate(() => {
const inputElementArr = [...document.querySelectorAll("input")];
window.cl("inputElementArr.length: ", inputElementArr.length);
return document.querySelector("iframe").getAttribute("src");
});
console.log(src);
console.log(iframe.url());
await page.goto(src);
await navigationPromise;
}
}
(Code snippet taken from here: https://github.com/cyrus-and/chrome-har-capturer/issues/75#issuecomment-531690406 ) What is the expected result? Navigate to the URL of the iframe and get content without an error.
What happens instead?
(node:1203418) UnhandledPromiseRejectionWarning: Error: Protocol error (Network.getResponseBody): No resource with given identifier found
at Promise (/home/user/node_modules/puppeteer/lib/Connection.js:183:56)
at new Promise (<anonymous>)
at CDPSession.send (/home/user/node_modules/puppeteer/lib/Connection.js:182:12)
at CDPSession.client.on (/home/user/chc03.js:85:33)
at CDPSession.emit (events.js:203:15)
at CDPSession._onMessage (/home/user/node_modules/puppeteer/lib/Connection.js:200:12)
at Connection._onMessage (/home/user/node_modules/puppeteer/lib/Connection.js:112:17)
at WebSocketTransport._ws.addEventListener.event (/home/user/node_modules/puppeteer/lib/WebSocketTransport.js:44:24)
at WebSocket.onMessage (/home/user/node_modules/puppeteer/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
(node:1203418) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 13)
(node:1203418) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1203418) UnhandledPromiseRejectionWarning: Error: Protocol error (Network.getResponseBody): No resource with given identifier found
at Promise (/home/user/node_modules/puppeteer/lib/Connection.js:183:56)
at new Promise (<anonymous>)
at CDPSession.send (/home/user/node_modules/puppeteer/lib/Connection.js:182:12)
at CDPSession.client.on (/home/user/chc03.js:85:33)
at CDPSession.emit (events.js:203:15)
at CDPSession._onMessage (/home/user/node_modules/puppeteer/lib/Connection.js:200:12)
at Connection._onMessage (/home/user/node_modules/puppeteer/lib/Connection.js:112:17)
at WebSocketTransport._ws.addEventListener.event (/home/user/node_modules/puppeteer/lib/WebSocketTransport.js:44:24)
at WebSocket.onMessage (/home/user/node_modules/puppeteer/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:198:13)
(node:1203418) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 14)
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Network.getResponseBody fails for some pages (No resource ...
Network.getResponseBody fails for some pages (No resource with given identifier found undefined) #2258.
Read more >puppeteer - Error: Protocol error (Network.getResponseBody ...
puppeteer - Error: Protocol error (Network.getResponseBody): No resource with given identifier found ; 'dotenv').config ; const readline = require ...
Read more >responseReceived but getResponseBody returns error
responseReceived events and follow up with Network.getResponseBody ... returns an error, 'No data found for resource with given identifier'.
Read more >Chrome Extension: “No resource with given identifier found ...
I'm writing a Chrome Extension that can get HTTP response for a site. I try to use debugger for getting response body: var...
Read more >third_party/blink/renderer/core/inspector ... - Google Git
static std::unique_ptr<protocol::Network::Headers> BuildObjectForHeaders( ... return Response::Error("No data found for resource with given identifier");.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved it this way for your reference
Hello 👋 @hubitor, When a redirect request is encountered, the browser will interrupt the request of other resources on the current page so this error occurs. You can use
setRequestInterception
to queue the request