I cannot use my currently installed extensions in Google Chrome using headless mode. Is there any way to enable them?
An easy way to check if the extensions work is by adding, for example, the "Comic Sans Everything" extension.
So Google looks like that:
However, if I take a screenshot of the page using the headless mode (google-chrome --headless --disable-gpu --screenshot https://www.google.com
), the result is:
Chromebook user or not, as long as you're a Chrome user, you can install offline extensions (and apps) for common tasks like note taking and editing PDFs.
How to run Chrome in headless mode. In order to run your tests in headless mode, you will need to use the ChromeOptions as follows. ChromeOptions options = new ChromeOptions(); options. addArguments("--headless");
Headless Browsers are Faster than Real Browsers But you will typically see a 2x to 15x faster performance when using a headless browser. So if performance is critical for you, headless browsers may be a way to go.
Headless Chromium allows running Chromium in a headless/server environment. Expected use cases include loading web pages, extracting metadata (e.g., the DOM) and generating bitmaps from page contents -- using all the modern web platform features provided by Chromium and Blink.
You can run Chrome with extensions headless using Xvfb.
sudo dnf install xorg-x11-server-Xvfb
xvfb-run google-chrome --remote-debugging-port=9222 --disable-gpu https://www.google.com
More complicated, but it does work. It's what we use for headless chrome extension testing.
EDIT: This answer is no longer correct, see https://stackoverflow.com/a/73079789/934239
No, it's not possible, and Chrome developers decided against implementing it in any near future due to complexity of the task.
If you look at that issue you may get the idea that they are still considering it due to ChromeDriver requirements - but instead they decided to make ChromeDriver work without extensions (through DevTools).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With