-
Notifications
You must be signed in to change notification settings - Fork 120
Description
From the Puppeteer docs about headless mode it reads:
Before v22, Puppeteer launched the old Headless mode by default. The old headless mode is now known as chrome-headless-shell and ships as a separate binary. chrome-headless-shell does not match the behavior of the regular Chrome completely but it is currently more performant for automation tasks where the complete Chrome feature set is not needed. If the performance is more important for your use case, switch to chrome-headless-shell as following:
const browser = await puppeteer.launch({headless: 'shell'});
And in a blog post about chrome-headless-shell i found:
At the same time, we acknowledge that there are distinct use cases for the old and the new Headless modes:
- The old Headless mode is a lightweight wrapper around Chromium's //content module, and it therefore has substantially fewer dependencies. Specifically, it does not require X11/Wayland, D-Bus, and is in some ways more performant than the fully-fledged Chrome browser. This makes it suitable for use cases such as automated screenshotting or web scraping.
- New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing.
With an image showing:
I researched all of this because after upgrading Puppeteer from 19.x to 24.x we've seen random occurances of Grover::JavaScript::TimeoutError errors.
After reading the above, I thought I should switch to the old headless mode. After configuring it wrongly via Grover.new(html, launch_args: ["--headless=shell"]), I realized I have to use the debug option:
Grover.new(html, debug: { headless: "shell" })
Which then uses the correct chrome version:
/.cache/puppeteer/chrome-headless-shell/mac_arm-138.0.7204.157/chrome-headless-shell-mac-arm64/chrome-headless-shell --allow-pre-commit-input --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-crash-reporter --disable-default-apps --disable-dev-shm-usage --disable-hang-monitor --disable-infobars --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-search-engine-choice-screen --disable-sync --enable-automation --export-tagged-pdf --force-color-profile=srgb --generate-pdf-document-outline --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain --disable-features=Translate,AcceptCHFrame,MediaRouter,OptimizationHints,ProcessPerSiteUpToMainFrameThreshold,IsolateSandboxedIframes --enable-features=PdfOopif --user-data-dir=/var/folders/8v/hrwnvywd7g92hcbg_jj2w1wr0000gn/T/grover-9q6l6L --headless --hide-scrollbars --mute-audio --disable-extensions about:blank --remote-debugging-port=0
Without the debug option, per default, it uses the new headless version:
/.cache/puppeteer/chrome/mac_arm-138.0.7204.157/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing --allow-pre-commit-input --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-crash-reporter --disable-default-apps --disable-dev-shm-usage --disable-hang-monitor --disable-infobars --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-search-engine-choice-screen --disable-sync --enable-automation --export-tagged-pdf --force-color-profile=srgb --generate-pdf-document-outline --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain --disable-features=Translate,AcceptCHFrame,MediaRouter,OptimizationHints,ProcessPerSiteUpToMainFrameThreshold,IsolateSandboxedIframes --enable-features=PdfOopif --user-data-dir=/var/folders/8v/hrwnvywd7g92hcbg_jj2w1wr0000gn/T/grover-jvpoQ7 --headless=new --hide-scrollbars --mute-audio --disable-extensions about:blank --remote-debugging-port=0
Two questions:
- Does it maybe make sense for grover to use the old headless version per default?
- If not, should I open a PR with a new section in the Readme, documenting how to enable the old headless version?