Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 10 : Chrome headless not doing anything

When entering the following command in Windows 10 and start a headless chrome version, nothing is happening (with/without extensions):

"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 
      --disable-extensions --headless --disable-gpu --print-to-pdf

It just returns to the command line silently and I can't find any pdf file.

Does anybody had the same issue and manage to solve it ?

I'm using : Google Chrome 63.0.3239.84 (Official Build) (64-bit) (cohort: 63_win_84)

like image 872
ic3 Avatar asked Dec 13 '17 09:12

ic3


People also ask

How do I run Chrome headless in Windows?

Which command starts the Google Chrome web browser in headless mode? You want to use the “–headless” argument in the command line to start Google Chrome Canary in headless mode.

How do I start Chrome headless?

Which command starts the google chrome web browser in headless mode? As we have already seen, you just have to add the flag –headless when you launch the browser to be in headless mode. With CLI (Command Line Interface), just write: chrome \<br> – headless \ # Runs Chrome in headless mode.

What is happening when the browser is running in headless mode?

A headless browser is a web browser without a graphical user interface. Headless browsers provide automated control of a web page in an environment similar to popular web browsers, but they are executed via a command-line interface or using network communication.

Does headless Chrome use cookies?

We're working on a project that requires to automatically login to a Google Account and few other services. However, as you may know, Headless Chrome does not remember cookies from previous instances, so we have to re-login to that account every time when we started a new Chrome instance.


1 Answers

It looks like Chrome doesn't have rights to write in the directory.
Try to launch command with --enable-logging flag. Like:
"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --enable-logging --disable-extensions --headless --disable-gpu --print-to-pdf
You will receive an error. Fix it and it will start to work. You can find more information here:
How do I use Headless Chrome in Chrome 60 on Windows 10?

like image 132
Dima Kurilo Avatar answered Jan 01 '23 18:01

Dima Kurilo