Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Headless Chrome Terminates

When trying to run Headless Chrome on both mac and linux, it fails with the following error

Chrome --headless --disable-gpu https://www.yahoo.com
[0505/072239.922334:ERROR:browser_process_sub_thread.cc(217)] Waited 5 ms for network service

I'm testing with version Google Chrome 74.0.3729.131

like image 969
Anshul Koka Avatar asked May 05 '19 14:05

Anshul Koka


People also ask

How do I run headless chrome?

There are a few different ways you can run headless Chrome. One option is to run headless Chrome directly from the command line interface (see next section for details). This can be a bit more straightforward as a place to begin. However, the options for what to run from the command line can be limited.

What is a headless browser?

There are a number of headless browser options, but the one I’ll focus on is the headless version of Google Chrome. You can execute and run Google Chrome without the graphical user interface.

Can you run headless Chrome in AWS Lambda?

Chromeless, as some might not be familiar with, is not only a rich API for driving headless Chrome, but comes with a prescription for how to execute headless work in a production/CI environment. Their take is fascinating: instead of running and managing the binary in your own infrastructure, just do it in AWS lambda.

How many headless chrome libraries are there?

In contrast, there’s currently two predominant headless Chrome libraries, signaling an already fractured ecosystem ( though hopefully not for long ). Only one comes bundled with a version of Chrome guaranteed to work with it, though at the cost of flexibility.


1 Answers

Try adding some of the following options:

chromeOptions.addArguments("--headless")
chromeOptions.addArguments("--no-sandbox")
chromeOptions.addArguments("--disable-dev-shm-usage")
chromeOptions.addArguments("--disable-gpu")
chromeOptions.addArguments("--disable-features=NetworkService") ##this did it for me
chromeOptions.addArguments("--window-size=1920x1080")
chromeOptions.addArguments("--disable-features=VizDisplayCompositor")
like image 173
imp Avatar answered Sep 26 '22 02:09

imp