-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Remove HEADLESS option #24537
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
Remove HEADLESS option #24537
Conversation
Looks like the codesize issues were fixed in #24538 |
Perhaps we can add a headless flag to emrun, as suggested here? |
I thought about that, but the problem is that browser automation is actually not trivial - it requires special "drivers" to communicate with their API in headless mode, and integration is different for each browser. That's why projects like Playwright and Puppeteer exist, but what would we do in this case? Install it for the user as part of emsdk and maintain their versions? It seems easier to point users to said projects for the migration so they can choose the right one for their usecase (eg do they want one-off execution, do they want automated testing, are they limited by Node.js instead of real browser etc). |
It's also not very clear what exactly should emrun do in headless mode. Intercept console that we normally display in the HTML? Produce a screenshot of the final result after some delay? There's too many options and it would require careful design. |
Oh, I was hoping |
It starts a process in background, but then you need to connect to it over a special remote port and communicate commands via a driver. From the console you can take a screenshot or dump DOM. https://developer.chrome.com/docs/chromium/headless However, even that is browser-specific - AFAIK emrun is not tied to just Chrome at the moment? |
HEADLESS mode was used in cases without a driver. Imagine a web page that just needs to run for a bit, then it exits. This is useful for tests, where the exit code indicates success (and also benchmarks). emrun does handle exit codes from pages, so basically my hope was that
Hmm, Firefox has In general all I was thinking about was an emrun flag that passes But, I see there is
So perhaps the readme can just mention |
Yes, that is what I was thinking. If you just want to control browser args you already have options for doing that yourself. |
But this alone doesn't wait for the app "exit" nor returns exit code on failures. It only loads page in background and that's it. |
emrun itself has its own existing mechanisms for tracking the lifetime of the program and the browser process. |
Ah hmm maybe I didn't look deeply enough into what emrun does.
So this is sufficient and works as expected? |
Yes, if emrun works on a page already, than that flag should make it run in a headless environment I think (though I didn't test in one, but I see no window is shown on my laptop). Another thought, maybe add |
Ok yeah then it's easier than I thought as most work is already done.
What did you mean by readme though - I assume not literally putting this into emscripten repo README? Just changelog or is there a relevant docs page we should add this to? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant changelog and not readme. Like this:
Co-authored-by: Alon Zakai <[email protected]>
Closes #20554.