[BUG] 0.15 Cannot launch new chromium context after closing old one
See original GitHub issueContext:
- Playwright Version: 0.15.0
- Operating System: macOS 10.15.4
Code Snippet
let browser;
beforeAll(async () => {
browser = await playwright['chromium'].launch({
headless: false,
});
});
afterAll(async () => {
await browser.close();
});
test('1', async () => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://www.example.com');
await context.close();
});
test('2', async () => {
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://www.example.com');
await context.close();
});
Describe the bug
Error output:
Protocol error (Target.createBrowserContext): Target closed.
32 | await context.close();
33 |
> 34 | const context2 = await browser.newContext();
| ^
35 |
36 | const page2 = await context2.newPage();
37 |
at Promise (node_modules/playwright-core/lib/chromium/crConnection.js:130:63)
at CRSession.send (node_modules/playwright-core/lib/chromium/crConnection.js:129:16)
at CRSession.<anonymous> (node_modules/playwright-core/lib/helper.js:64:31)
at CRBrowser.newContext (node_modules/playwright-core/lib/chromium/crBrowser.js:93:58)
at CRBrowser.newContext (node_modules/playwright-core/lib/helper.js:64:31)
at _callee3$ (tests/playwright/login.test.js:34:36)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:274:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/playwright/login.test.js:11:103)
at _next (tests/playwright/login.test.js:13:194)
This does seems to work for webkit and firefox.
Not sure if I’m doing something wrong – I did see this note in the docs: the default browser context cannot be closed.
but it wasn’t clear to me if this meant “you cannot close the first new context you create via invoking newContext()” or “you cannot close a context if you do not invoke newContext() at all”.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Chrome returns black screen with no logged errors on WebGL ...
1. Open those URLs 2. In the last URL example, the blending appears to be broken. ... this bug or have new data,...
Read more >Changelog - Cypress Documentation
Fixed a regression in 8.3.0 where Cypress would cause a SIGSEGV error on Mac when closing the Cypress app opened via cypress open...
Read more >Bug listing with status UNCONFIRMED as at 2022/12/24 17 ...
system fails to shutdown with automount+nfs" status:UNCONFIRMED resolution: severity: ... Bug:547510 - "net-misc/netifrc: udhcpc can not run in background" ...
Read more >Playwright v0.16.0 release notes (2020-05-01) | LibHunt
Playwright now uses a single location on your machine to install all ... #1962 - [BUG] 0.15 Cannot launch new chromium context after...
Read more >JupyterLab Changelog — JupyterLab 3.6.0b0 documentation
Bump to the latest Lumino 1.x #13190 (@fcollonval) ... Fix debugger extension error when notebooks is closed quickly #12396 (@fcollonval).
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 Free
Top 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
Fixing upstream in https://chromium-review.googlesource.com/c/chromium/src/+/2168515
Minimal repro case: