question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Document that non-fixture contexts/pages should be closed when no longer needed

See original GitHub issue

When a BrowserContext is not obtained from a Playwright Test fixture, but from browser.newContext() in a test or when using Playwright Library, it should be closed once no longer needed (according to @mxschmitt at https://stackoverflow.com/questions/72284057/do-playwright-browser-contexts-opened-manually-need-to-be-closed?noredirect=1#comment127709001_72284057). Similarly pages from context/browser.newPage() should be closed if they are no longer needed and the context is long-living.

However, I wasn’t able to find any place in documentation and examples saying this; the only hint was the existence of close methods. Please consider documenting it.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alikireccommented, Jun 4, 2022

It’s already mentioned in https://playwright.dev/docs/api/class-browsercontext – at the end of the first code snippet

// Dispose context once it's no longer needed.
await context.close();
0reactions
rwollcommented, Jun 6, 2022

Closing as part of triage per above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

playwright - bytemeta
[Feature] Document that non-fixture contexts/pages should be closed when no longer needed · I face many times element not visible or hiddend in...
Read more >
Raw `Result` in redaction macro - Google/Argh - IssueHint
[Feature] Document that non-fixture contexts/pages should be closed when no longer needed, 1, 2022-05-18 ; Anchor generation - grid point or sliding window ......
Read more >
How to solve the hyper-parameter dependency in search space ...
YOU MAY BE INTERESTED ; [Feature] Document that non-fixture contexts/pages should be closed when no longer needed, 5, 2022-05-18, 2022-09-08 ; MiniEngine ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found