await page.route(
`**/a_url*`,
async (route) => {
const response = await route.fetch({ timeout: 0 });
await route.fulfill({ response });
},
{ times: 1 }
);
I have this setup and I'm getting the following behaviour. I'm running my tests in Chromium.
Error: page.waitForResponse: Page closed
413 | );
414 |
> 415 | const rPromise = page.waitForResponse((response) => response.url().includes("/another_url"));
| ^
416 | await page.goto(`my.website.com`);
417 | await rPromise;
418 | });
It does not happen if I just continue, for example. My best guess so far is that I am hitting some sort of protocol/DevTools limitation. I tried investigating a little bit on my own, but could not find anything conclusive or a workaround.
Does anybody have an idea what is happening? I'd be happy to provide some additional logs, let me know, the options I have tried did not seem to be too useful in figuring out what the issue is.
This thread is trying to answer question "Why does the test crash when trying to fulfill a large response body using the route.fulfill method in Chromium and how can it be resolved?"
The whole setup:
test("repro", async ({ page }) => {
await page.route(
`**/another_url*`,
async (route) => {
const response = await route.fetch({ timeout: 0 });
await route.fulfill({ response });
},
{ times: 1 }
);
await page.route(
`**/a_url*`, // this is the route that fulfils first and is large
async (route) => {
const response = await route.fetch({ timeout: 0 });
await route.fulfill({ response });
},
{ times: 1 }
);
const rPromise = page.waitForResponse((response) => response.url().includes("/another_url"));
await page.goto("my.website.com");
await rPromise;
});
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].