dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
15.8k stars 882 forks source link

[feature] Chromedriver with --headless=new #1492

Open adripo opened 1 year ago

adripo commented 1 year ago

Version and OS All

Is your feature request related to a problem? Please describe. related: #529 Using the new headless mode should improve resource usage and work exactly like the headfull mode.

Describe the solution you'd like Use --headless=new command when launching chromedriver

Describe the use-case and give concrete real-world examples The old Headless was a separate, alternate browser implementation that happened to be shipped as part of the same Chrome binary. It doesn’t share any of the Chrome browser code. The new headless mode unifies Headless and headful modes. See article for details.

Additional context https://developer.chrome.com/articles/new-headless/

leiless commented 1 year ago

Hi, @adripo. I wonder if it's possible to use Headless Chrome + WebDriver for dgtlmoon/changedetection.io right now (As of June, 2023)?

https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/content_fetcher.py#L614-L618 seems to start the ChromeDriver without any argument.

My chromedriver logs:

[1685954857.750][INFO]: Launching chrome: /usr/lib/chromium/chrome --allow-pre-commit-input --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging=stderr --log-level=0 --no-first-run --no-service-autorun --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir=/tmp/.org.chromium.Chromium.cDAnhI data:,

Which the --headless is not present in the arguments, and there is no way to override the arguments.

adripo commented 1 year ago

Hi @leiless, I think you can try to use it by setting the parameter in the docker-compose https://github.com/dgtlmoon/changedetection.io/blob/master/docker-compose.yml#L29

- PLAYWRIGHT_DRIVER_URL=ws://playwright-chrome:3000/?--disable-web-security=true&--headless=new

The problem is that this mode has not been tested yet, so I am not sure everything will work as supposed in changedetection.