-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 'Request context disposed' was reported when use route.fetch() #23781
Comments
Reproducible with Node.js, moving upstream so it can be discussed there. import { chromium } from 'playwright';
(async () => {
const browser = await chromium.launch({
headless: false
});
const context = await browser.newContext();
const page = await context.newPage();
await page.route('**/*', async route => {
const response = await route.fetch();
route.fulfill({
response
});
});
await page.goto('https://www.baidu.com/', {
waitUntil: 'domcontentloaded'
});
// ---------------------
await context.close();
await browser.close();
})(); |
Investigation notes:
Possible improvements, that could still lead to minor regression in existing test suites:
|
This is still a problem, and I didn't find a solution to this except for not doing |
I am getting Our code (redacted):
|
The link's broken. I'm getting this error on @playwright/test version 1.38.1, NodeJS v16.20.2 when trying to use context.request.fetch(). For some reason, I only experience this issue when I run my tests against an instance of my React app that is being run locally. If I test against a deployed version of my React app, the command executes without a problem. I've even tried building the React app and serving it locally, but the issue persists. Kind of weird... Anyway, I hope this gets fixed soon because it's slowing me down so much. |
I can confirm that neither In my scenario, none of The proposed solution to await all ongoing route handlers that
What's required to move forward and implement a fix? |
Bump this. We have the same issue |
Capturing notes from the team discussion
So far, the proposal 4 is the preferred one. |
@dgozman agree with you that proposal 4 is preferred. Is that what you moved forward with? |
Discussion notes: unroute
close
runBeforeUnload: trueAll bets are off as it may actually result in not closing the page. No special logic for this scenario. It's still possible to call |
We ended up with a new |
This option does not make sense in the synchronous API where all active routes would be on the same call stack any way. Reference #23781
Context:
Code Snippet
Describe the bug
'Request context disposed' or 'Response context disposed'
I think it's because the page has been closed, but the route handle function is still running.
It appears to be related to microsoft/playwright-python#1402 microsoft/playwright-python#1433 microsoft/playwright-python#1458 and has been fixed, but this issue still persists.
How can I stop a running route handle function before the page is closed?
thanks.
The text was updated successfully, but these errors were encountered: