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.

[Question] Ability to disconnect from browser server without closing contexts

See original GitHub issue

Hi, is it possible to disconnect from a browser server while keeping open the browser contexts that were opened?

In puppeteer, the browser.disconnect method does this. It looks like playwright doesn’t have a disconnect method, just a close that disconnects and closes the browser contexts

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
PeterCassell92commented, Feb 12, 2022

I am also in need of this feature.

My use case: I am running automated tests for applications in an embedded browser (powered by Chromium) and I am connecting Playwright using Chromium.connectOverCDP(). The embedded browser (deliberately) has limited functionality so newPage() is not valid here and neither is browserContext.close(). There can only ever be one browser context and one page per instance of the desktop application. In the jest environment setup, I connect to using connectOverCDP() however in the environment teardown I cannot use browserContext.close() as closing the browser context will close the desktop application (and therefore will disrupt other tests).

In puppeteer, I used to use browser.disconnect() and this worked because it does not try to close the browserContext, allowing my jest tests to finish correctly, with no open processes. I would like to know how to achieve the same result in Playwright or suggest a similar feature for a future release.

0reactions
calebebycommented, Jan 12, 2021

Thanks for clarifying. Unfortunately Jest force-kills test processes that don’t terminate gracefully, so that’s not an option for me:

image

I’ll be sticking to Puppeteer for now, thanks for your help anyways!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Web API Internal server error when client is ...
This issue may be related to ASP.NET Web API OperationCanceledException when browser cancels the request, however the accepted solution does not ...
Read more >
How to prevent SSH from disconnecting if it's been idle for a ...
If you would like to quickly terminate the session as soon as the server does not respond anymore, you should choose a low...
Read more >
How To Use Contexts in Go - DigitalOcean
Context that includes information about the client making the request and will end if the client disconnects before the request is finished. By ......
Read more >
I want to disable search in the address bar and browser.urlbar ...
I have repeatedly removed the ability to search from the URL BAR from my web browser and FF keeps putting it back. Dammit!!...
Read more >
Session Management - OWASP Cheat Sheet Series
Web applications must provide a visible and easily accessible logout (logoff, exit, or close session) button that is available on the web application...
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