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
Ability to exit a script while keeping browser running #8261
Comments
I found why: As I am on Windows, the chromium process is not launched as "detached" in BrowserRunner:
After forcing detached to true, It works fine. I don't understand why it is not detached on Windows? |
Looks like same issue is happening on the Linux platform as well. |
Launching a detached browser and using exiting the script process.exit(0) work, but only on Windows. |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
for me this doesn't work on windows. i'm using these args to launch a detached browser, maybe i'm doing it incorrectly:
Asking same question op did: |
Why do you want to kill the parent process that launched Chromium (you can just keep it running as long as you need the shared chromium instance)? I don't think we will support detaching child processes though so marking it as not planned for now. |
To keep file image and script files in cache and to connect fastly to a dynamic page (because pupetter and chromium are too slow to launch and open a page: almost 2 seconds). |
@SuperPat45 what I mean is you can start |
To avoid keeping a superflux nodejs process in memory. |
@SuperPat45 in that case I suggest that you launch the chromium binary directly |
Let me re-classify this a feature but it'd be a very low priority for us. |
Hi, is there alternate approach on windows? I am running a script using powershell which launches browser using puppeteer. I run some automated puppeteer commands but after that I want to keep the browser running and disconnect puppeteer. |
Yes I am facing the same issue, does anyone have any solution? I have already posted this on stackoverflow too but no response. Searched on chat gpt too but no use |
I want to keep the browser open while I update my process and then reconnect to it without losing any information. |
My java server need to convert some HTML pages to PDF.
Today I call a script who use process.launch().
All work fine except I take seconds to complete, and it is too slow.
After investigations, 1.5 to 3 seconds are needed just to launch() chromium and open newPage()...
Bug description
To speed up this, I try to create a new script that use puppeteer to launch a headless chromium instance, save the browserWSEndpoint on the file system and exiting the script leaving the browser opened.
So, other puppeteer scripts can connect to this browserWSEndpoint later to speed up it.
My main problem is that the script hang without calling browser.close();
So I try with the 3 parameters: handleSIGINT : false, handleSIGTERM : false, handleSIGHUP : false
They seem to have no effect, pressing Ctrl+c kill the script and chromium too.
I try with adding process.kill(0); at the end of the script function to force exit, but the chromium is killed too.
Are-there another way to let the chromium process alive after script execution?
Puppeteer version
13.4.0
Node.js version
v16.14.2
npm version
8.5.0
What operating system are you seeing the problem on?
Windows
Relevant log output
No response
The text was updated successfully, but these errors were encountered: