microsoft / microsoft/playwright
[Bug]: `RenderDocument` introduces `page.close()` hang
@dgozman is already working on this.
Since Jul 31, 2026.
- Dominant language
- TypeScript
- Stars
- 96.3k
- Forks
- 6.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 180
Description
### Version
ToT
### Steps to reproduce
```ts
test('should close page while reload is committing', async ({ context, browserName }) => {
test.skip(browserName !== 'chromium');
for (let i = 0; i < 20; i++) {
const page = await context.newPage();
await expect(page.evaluate(() => {
location.reload();
return new Promise(() => {});
})).rejects.toThrow(/navigation/);
await page.close(); // intermittently hangs
}
});
```
### Expected behavior
The test passes fine.
### Actual behavior
`page.close()` hangs. To expose this behaviour, it's important to have the loop inside the test, running it without the loop but with `--repeat-each` doesn't expose it. I suppose it's linked to races within the context or something.
### Additional context
This started at https://github.com/microsoft/playwright/pull/41303.
Discovered through https://github.com/microsoft/playwright-python/pull/3161.
### Environment
```shell
Simon's Mac
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.